[Bug 8001] lineedit: \w uses getcwd which canonicalizes symlinks (diff PS1=\w behavior between busybox & bash)

bugzilla at busybox.net bugzilla at busybox.net
Sat Feb 13 04:04:15 UTC 2016


Mike Frysinger <vapier at gentoo.org> changed:

           What    |Removed                     |Added
           Severity|major                       |normal
            Summary|ash: PS1 \w display is not  |lineedit: \w uses getcwd
                   |correct in prompt           |which canonicalizes
                   |                            |symlinks (diff PS1=\w
                   |                            |behavior between busybox &
                   |                            |bash)

--- Comment #1 from Mike Frysinger <vapier at gentoo.org> ---
the reason bash works is that it replaces \w with $PWD.  this is the same
reason the *builtin* pwd works for both busybox & bash.  (actually, it uses the
internal curdir setting that has been validated rather than the explicit $PWD

the reason busybox fails w/PS1 is that it has a common lineedit library that it
uses with all applets that need line editing capabilities.  so when it parses
\w, it will run getcwd() and that is the real path (target of the symlink).

if you run `/bin/pwd` in either env, you'll get the same result because they
too don't have access to the internal shell state -- you'll get /hdd1/test.

i think we should just mark this as a known deviation.  lineedit doesn't have
access to the shell state, and grabbing PWD from the env would also be wrong
(and shells aren't required to export it).

You are receiving this mail because:
You are on the CC list for the bug.

More information about the busybox-cvs mailing list