[Top][All Lists]

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

Re: bug in pwd POSIX-compliance

From: Eric Blake
Subject: Re: bug in pwd POSIX-compliance
Date: Fri, 18 Feb 2005 15:03:03 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Chet Ramey <chet <at> caleb.ins.cwru.edu> writes:
> > 
> > Description:
> > POSIX requires pwd(1) with the -P option to update the PWD environment
> > variable with a version scrubbed of all symlinks.  See
> > http://www.opengroup.org/onlinepubs/009695399/utilities/pwd.html
> > 
> > Bash currently does not do this, but leaves PWD untouched with the
> > non-canonical form of the current directory.
> I agree that the standard says that, but no shell does it that way.  I'm
> going to ignore it for now.  I'd bet that someone pinched the text in
> question from the `cd' description at some point.

On further research, the requirement for `pwd -P' to set PWD was intentional, 
and not a mistake.  See POSIX XRAT A.3 
(http://www.opengroup.org/onlinepubs/009695399/xrat/xbd_chap03.html) under 
Symbolic Links line 1148, which states:

Historically, several shells have had built-in versions of the pwd utility. In 
some of these shells, pwd reported the physical path, and in others, the 
logical path. Implementations of the shell corresponding to IEEE Std 1003.1-
2001 must report the logical path by default. Earlier versions of IEEE Std 
1003.1-2001 did not require the pwd utility to be a built-in utility. Now that 
pwd is required to set an environment variable in the current shell execution 
environment, it must be a built-in utility.

Also, see the followup mails to my defect report, as posted on the Austin 
mailing lists: http://www.opengroup.org/austin/mailarchives/ag/msg08028.html.  
Just because no non-compliant shell does it that way is not an excuse for bash 
to not do it, at least when bash is installed as the compliant sh.

Eric Blake

reply via email to

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