GNU bug report logs - #6194
pwd tracks logical paths through symlinks

Previous Next

Package: coreutils;

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

From: Eric Blake <eblake <at> redhat.com>
To: eran.shaham <at> gmail.com
Cc: 6194 <at> debbugs.gnu.org, eran shaham <eranshaham <at> gmail.com>
Subject: bug#6194: bug: pwd
Date: Fri, 14 May 2010 13:40:39 -0600
[Message part 1 (text/plain, inline)]
On 05/14/2010 01:13 PM, eran shaham wrote:
> from:
> info pwd
> 
> one get:
> `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*.

Thanks for the report.  However, this is probably not a bug, but a
misunderstanding on your part.  That sentence is true for 'pwd -P', but
POSIX states that for 'pwd -L', the result can contain symlinks.

POSIX also states that the default must be 'pwd -L'.  With GNU
coreutils, we only default to -L if you have POSIXLY_CORRECT set in your
environment, since many scripts expected 'pwd -P' behavior when invoking
/bin/pwd.

One other thing to remember is the piece of advice given in both the
'/bin/pwd --help' and 'info pwd' pages - your shell probably has a
built-in version of pwd that will supersede /bin/pwd if you don't
qualify which version you are running.  And most built-in pwd's follow
the POSIX rule of -L by default; and at least bash has a shell option
that lets you control whether -L or -P is default.

> 
> When you try the following:
> mkdir dirA dirB
> cd dirA
> ln -s ../dirB/ lnkB
> cd lnkB
> pwd

Try '/bin/pwd' instead of 'pwd' to see the difference.  And to prove to
yourself that you were getting the shell built-in, try 'pwd --help',
contrasted with '/bin/pwd --help'.

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

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.