Please see below the behaviour difference compare to BASH. BASH: root@ppc99:~# ll /var/test lrwxrwxrwx 1 root root 10 Apr 1 13:35 /var/test -> /hdd1/test root@ppc99:~# echo $PS1 \u@\h:\w\$ root@ppc99:~# cd /var/test root@ppc99:/var/test# pwd /var/test root@ppc99:/var/test# Busybox ASH: root@ppc99:~# ll /var/test lrwxrwxrwx 1 root root 10 Apr 1 13:35 /var/test -> /hdd1/test root@ppc99:~# echo $PS1 \u@\h:\w\$ root@ppc99:~# cd /var/test/ root@ppc99:/hdd1/test# pwd /var/test root@ppc99:/hdd1/test# pwd is ok, but the command prompt is not as expected.
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 envvar.) 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).