GNU bug report logs -
#6194
pwd tracks logical paths through symlinks
Previous Next
Reported by: eran.shaham <at> gmail.com
Date: Fri, 14 May 2010 19:23:02 UTC
Severity: normal
Tags: wontfix
Done: Bob Proulx <bob <at> proulx.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
retitle 6194 pwd tracks logical paths through symlinks
tags 6194 + wontfix
thanks
eran shaham wrote:
> `pwd' prints the fully resolved name of the current directory. That
> is, all components of the printed name will be actual directory
> names--*none will be symbolic links*.
Thank you for the report. But you are confusing the coreutils
standalone 'pwd' with your shell's internal builtin 'pwd'. The
coreutils pwd command does not behave as you describe. You are
invoking the shell's builtin pwd.
$ type pwd
pwd is a shell builtin
But regardless of that what you are seeing is the shell's logical path
record keeping in action. This is the behavior that most people
prefer and so it is the default. I can tell taht you however are like
me and do not prefer it. In which case if you are using the bash
shell you can change your shell behavior to use only physical paths.
set -o physical
And now the shell will not track logical paths. Putting that in your
$HOME/.bashrc file will give you the behavior you desire.
> When you try the following:
> mkdir dirA dirB
> cd dirA
> ln -s ../dirB/ lnkB
> cd lnkB
> pwd
The pwd above is the shell's builtin pwd. It is not the coreutils
pwd. The shell tracks the logical path in the PWD environment
variable and reports it as if it were a real path. See the bash pwd
documentation for details.
help pwd
Look at the -L and -P options.
> where lnkB is obviously a symbolic link and not an actual directory name.
That is intentional behavior.
Bob
This bug report was last modified 15 years and 63 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.