[Top][All Lists]

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

bug#6194: bug: pwd

From: Eric Blake
Subject: bug#6194: bug: pwd
Date: Fri, 14 May 2010 13:40:39 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20100430 Fedora/3.0.4-3.fc13 Lightning/1.0b1 Mnenhy/0.8.2 Thunderbird/3.0.4

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

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   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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