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
[Message part 1 (text/plain, inline)]
Thanks.
I suggest you add into
$man pwd
or
$info pwd
the remark that was on
$ help pwd
pwd: pwd [-LP]
Print the current working directory. With the -P option, pwd prints
the physical directory, without any symbolic links; the -L option
makes pwd follow symbolic links.
It would save other people bothering you on that subject :-)
Thanks,
Eran
On Fri, May 14, 2010 at 22:57, Bob Proulx <bob <at> proulx.com> wrote:
> 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
>
[Message part 2 (text/html, inline)]
This bug report was last modified 15 years and 62 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.