Bash Version: 3.0
Patch Level: 15
Release Status: release
Description:
when user is in window one in some directory, and from window
two that directory is moved to another
location (or name), the pwd in the first window isn't being
updated and when user tries to access a file
without using full path, it gets the file that was in the
original directory even thought it was moved.
Repeat-By:
in window 1:
-------------
mkdit ~/test;
cd ~/test;
echo "hey" > file;
cat file;
-- "hey"
------------------
in window 2:
------------
mv ~/test ~/test.old
mkdir ~/test
echo "bye" > file;
cat file;
-- "bye";
------------------
in window 1:
------------
cat file;
-- "hey" (even thought ~/test/file contains now "bye")
cat `pwd`/file;
-- "bye" (it's ok using full path)
------------------------
also:
[quatrix@syn test]$ ll
total 0
-rw-rw-r-- 1 quatrix quatrix 0 Sep 11 17:39 go
-rw-rw-r-- 1 quatrix quatrix 0 Sep 11 17:39 hey
-rw-rw-r-- 1 quatrix quatrix 0 Sep 11 17:39 ho
-rw-rw-r-- 1 quatrix quatrix 0 Sep 11 17:39 lets
[quatrix@syn test]$ ll `pwd`
total 0
-rw-rw-r-- 1 quatrix quatrix 0 Sep 11 17:40 a
-rw-rw-r-- 1 quatrix quatrix 0 Sep 11 17:40 b
-rw-rw-r-- 1 quatrix quatrix 0 Sep 11 17:40 c
--------------------------------
P.S. i checked for this bug in csh, just to make sure it's not a
file system glich, and
in csh when one moves a directory, a user who's in that
directory gets its 'pwd' changed to the new value;
Since there's no notification given to a process when its current working
directory is renamed, shells that cache the current directory in $PWD and
make pwd essentially `echo $PWD' can get tripped up by pathological
conditions like this.
You have a couple of choices: alias pwd to "pwd -P" so you always get the
physical path; run in posix mode, where the shell checks its cached value
against `.' before displaying it; or use /bin/pwd like csh.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
Live Strong. No day but today.
Chet Ramey, ITS, CWRU ch...@case.edu http://cnswww.cns.cwru.edu/~chet/