On 1/3/10 8:02 AM, Leonid Evdokimov wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: i686
> OS: linux-gnu
> Compiler: i686-pc-linux-gnu-gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
> -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib  
> -DDEFAULT_PATH_VALUE='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
>  -DSTANDARD_UTILS_PATH='/bin:/usr/bin:/sbin:/usr/sbin' 
> -DSYS_BASHRC='/etc/bash/bashrc' -DSYS_BASH_LOGOUT='/etc/bash/bash_logout' 
> -DNON_INTERACTIVE_LOGIN_SHELLS -DSSH_SOURCE_BASHRC -O2 -march=pentium-m -pipe
> uname output: Linux thinkpad 2.6.31-gentoo-r6 #2 PREEMPT Fri Dec 18 13:16:52 
> OMST 2009 i686 Intel(R) Pentium(R) M processor 1600MHz GenuineIntel GNU/Linux
> Machine Type: i686-pc-linux-gnu
> 
> Bash Version: 4.0
> Patch Level: 35
> Release Status: release
> 
> Description:
> 
> `pwd` may return incorrect value, moreover, `pwd` output differs from /bin/pwd
> output.
> 
> Repeat-By:
> 
> da...@thinkpad ~ $ cd foo
> da...@thinkpad ~/foo $ touch foo-files
> da...@thinkpad ~/foo $ ls
> foo-files
> da...@thinkpad ~/foo $ mv ~/foo ~/bar
> da...@thinkpad ~/foo $ ls
> foo-files
> da...@thinkpad ~/foo $ echo $PWD
> /home/darkk/foo
> da...@thinkpad ~/foo $ pwd
> /home/darkk/foo
> da...@thinkpad ~/foo $ /bin/pwd
> /home/darkk/bar
> da...@thinkpad ~/foo $ cd .
> da...@thinkpad ~/bar $ echo $PWD
> /home/darkk/bar
> da...@thinkpad ~/bar $ pwd
> /home/darkk/bar
> da...@thinkpad ~/bar $ /bin/pwd
> /home/darkk/bar
> 
> Strace of this bash session may be found at
> http://darkk.net.ru/tmp/bash-pwd-bug.strace.log
> 
> Fix:
> 
> This problem may be fixed if bash does not optimise number of getcwd() calls,
> but I'm not sure if the bug is really a _bug_, but not a sort of strange
> feature.

It's not a bug, nor a "strange feature."  Bash maintains a logical view of
the file system and the current directory for cd, pwd, and $PWD, as Posix
specifies.  One of the consequences is that the pathname of the current
directory depends on the path used to reach it.

If you want to see a physical view of the file system, use `cd -P' or
`set -o physical'.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/


Reply via email to