bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pwd isn't being updated when moved


From: Chet Ramey
Subject: Re: pwd isn't being updated when moved
Date: Mon, 11 Sep 2006 22:54:47 -0400
User-agent: Thunderbird 1.5.0.5 (Macintosh/20060719)

Eddie wrote:
> Machine: i686
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686'
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-redhat-linux-gnu'
> -DCONF_VENDOR='redhat' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
> -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib 
> -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -pipe -m32 -march=i386
> -mtune=pentium4
> uname output: Linux syn.walla.co.il 2.6.9-22.EL #1 Sat Oct 8 17:48:27
> CDT 2005 i686 i686 i386 GNU/Linux
> Machine Type: i686-redhat-linux-gnu
> 
> 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.

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    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]