Defect report from : Dorothy DeLuca , Telcordia Technologies
(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)
@ page 0 line 0 section 0 comment {none known}
Problem:
Edition of Specification (Year): 2004
Defect code : 3. Clarification required
The man page for pwd found at:
http://www.opengroup.org/onlinepubs/009695399/toc.htm
The pwd man page is a link on the toc page.
On Solaris 10 which is SUSv3 compliant, I have experienced some unexpected
behavior that Sun claims is due to the fact they are following the SUSv3
convention. I have looked at the SUSv3 description of pwd and I disagree with
Sun's interpretation.
EXAMPLE of unexpected behavior:
shaw[17] ls -ld /bin
lrwxrwxrwx 1 root root 9 Sep 10 2004 /bin -> ./usr/bin/
shaw[18] ls -ld /usr/bin
drwxr-xr-x 4 root bin 16384 Feb 1 09:17 /usr/bin/
shaw[19] cd /bin
shaw[20] pwd
/bin
shaw[21] echo $PWD
/bin
shaw[22] ksh
shaw[23] pwd
/usr/bin
shaw[24] echo $PWD
/usr/bin
if I am in a directory /bin, which is a link to /usr/bin and I issue a pwd
command, then I get the absolute path to the current directory, less the dot
and dot-dot filenames according to the description in the man page.
However if I issue a new shell, without changing anything else, and then run
the pwd again, it now returns the absolute path of the current directory, less
the dot and dot-dot filenames, and in the context of that path now any
filenames that were symbolic links are replaced by what the link pointed to.
It does not seem that the pwd description states that this is how the command
should behave. I think that Sun is misinterpreting the description of absolute
pathname to mean canonical pathname, when in fact the descriptions for both
"pwd -L" and "pwd -P" start with the absolute pathname in the description and
the -P goes on to say that any links will be replaced.
In fact, if Sun believes that pwd should return the canonical form of the path
with pwd, then it should return that whether or not I issue the command in a
new shell or the current shell. The fact is, Sun's implementation returns a
non-canonical path and switches to canonical path after a new shell is spawned.
Action:
Could you clarify what the expectation should be?
Should pwd return a non-canonical version of the path until a new shell is
spawned then a canonical version of the current directory until a change takes
place to another path that has links at which point it no longer returns the
canonical path?
or
Should pwd return an absolute path, and only return a canonical path if the -P
option is given.
|