Answering questions that may arise related to the meaning of portions of an IEEE standard concerning specific applications.

IEEE Standards Interpretation for IEEE Std 1003.1™-2001 IEEE Standard Standard for Information Technology -- Portable Operating System Interface (POSIX®)

Copyright © 2006 by the Institute of Electrical and Electronics Engineers, Inc. 3 Park Avenue New York, New York 10016-5997 USA All Rights Reserved.

Interpretations are issued to explain and clarify the intent of a standard and do not constitute an alteration to the original standard. In addition, interpretations are not intended to supply consulting information. Permission is hereby granted to download and print one copy of this document. Individuals seeking permission to reproduce and/or distribute this document in its entirety or portions of this document must contact the IEEE Standards Department for the appropriate license. Use of the information contained in this document is at your own risk.

IEEE Standards Department Copyrights and Permissions 445 Hoes Lane, Piscataway, New Jersey 08855-1331, USA

Interpretation Request #97
Topic: pwd -P Relevant Sections: XCU pwd

The Environment Variables section of the pwd(1) command,, is clear that execution of ``pwd -P'' shall set the environment variable PWD to a canonical form (no symlinks, ., or ..). But in practice, I was unable to find any system where pwd could change the environment, whether provided as a shell built-in (ash, bash, pdksh, zsh) or as a separate utility (GNU coreutils, Solaris 8). Additionally, I don't see how a separate utility would be capable of setting the environment of the invoking shell, which would implicitly require pwd to be a shell builtin; but unlike the cd utility, the Application Usage section of pwd is silent on this fact.

For example,
$ cd /tmp
$ mkdir a
$ ln -s a b
$ cd -L b
$ pwd -L
$ echo $PWD
$ pwd -P
$ echo $PWD # pwd -P did not change $PWD

Under the description of the use of the PWD variable by pwd, change:

"If the -P option is in effect, this variable shall be set to an absolute pathname of the current working directory..."


"If the -L option is in effect, this variable is read as described in the DESCRIPTION. If the -P option is in effect, this variable may be set to an absolute pathname of the current working directory..."

Interpretation Response
The standards states the requirements for pwd, and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.

Rationale for Interpretation