Robin is correct. It all depends on what
resolves means. And, the standards lawyers love stuff like this. And, the text agenda.kgb quoted:
Quote:
If a symbolic link is encountered during pathname resolution, the behavior shall depend on whether the pathname component is at the end of the pathname and on the function being performed. If
all of the following are true, then pathname resolution is complete:
- This is the last pathname component of the pathname.
- The pathname has no trailing slash.
- The function is required to act on the symbolic link itself, or certain arguments direct that the function act on the symbolic link itself.
is the key here. If the function you're using is
stat(), then pathname resolution is NOT complete when the final component of a path names a symbolic link and the file named by the symlink does not exist. If the function you're using is
lstat(), then pathname resolution is complete because the description of the
stat() and
lstat() functions explicitly states:
Quote:
The lstat() function shall be equivalent to stat(), except when path refers to a symbolic link. In that case lstat() shall return information about the link, while stat() shall return information about the file the link references.
And, in the Commands and Utilities Volume of the POSIX standards, pathname resolution is not complete when a symlink is found at the end of the path unless the utility description explicitly states that a symbolic link is being processed rather than the file the symlink references. The description of
test -L pathname is:
Quote:
True if pathname resolves to an existing directory entry for a symbolic link. False if pathname cannot be resolved, or if pathname resolves to an existing directory entry for a file that is not a symbolic link. If the final component of pathname is a symbolic link, that symbolic link is not followed.
which makes it clear that for the
-L option,
test needs to use the equivalent of
lstat(pathname, ...). But, the description of
test -e:
Quote:
True if pathname resolves to an existing directory entry. False if pathname cannot be resolved.
does not make any exception for symlinks. So, it needs to use the equivalent of
stat(pathname, ...).
Speaking as a standards lawyer, it appears to me that the
ksh88 AIX 7.1
test -e and
test -L utility is behaving properly.