[Top][All Lists]

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

Re: pwd does not update when path component is renamed

From: Bob Proulx
Subject: Re: pwd does not update when path component is renamed
Date: Mon, 20 Sep 2010 15:07:30 -0600
User-agent: Mutt/1.5.20 (2009-06-14)

Krzysztof ┼╗elechowski wrote:
> The text of pwd and the value of $PWD return a cached value,
> regardless of the actual current path.
>         mkdir '-p' 'a' && cd 'a' && mv '../a' '../b' && enable '-n' 'pwd' && 
> builtin 'pwd' && pwd
> Fix:
>         cd '-P' '.'

That is just the way that things are.  The logical path used to get to
someplace isn't canonical.  There may be multiple logical paths that
point to a location.  You can only cache the logical value.  If the
physical path changes out from under the cached value then they will
be out of sync and there isn't any way to avoid it.  And your fix of
switching to the physical path isn't appropriate when a user is
requesting logical paths.

This is a user configurable setting.  If you want canonical paths that
are always correct you should use physical paths.  The ~/.bashrc file
would be an appropriate place to place that setting.

  set -o physical


reply via email to

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