Defect report from : Jakub Jermar , Sun Microsystems, Inc.
(Please direct followup comments direct to austin-group-l@xxxxxx)
@ page 1233 line 38679 section rename objection {1}
Problem:
Edition of Specification (Year): 2004
Defect code : 2. Omission
Synopsis:
The standard for rename() does not specify the behaviour for the
case in which a component of "new" does not exist at all.
Rationale:
# ls
# touch a
# mv a b/a
I have tried this on three implementations of the standard (i.e.
Solaris, Mac OS X and Linux) and all of them return ENOENT in the
underlying call to rename(). This behaviour is reasonable, but is
left out by the part of the standard that deals with the rename()
interface.
Quoting description of rename() return code ENOENT on lines
38679-38680 of XSH 1233:
The link named by old does not name an existing file, or either
old or new points to an empty string.
Note that the assumption of this implication is not met in our
testcase because old names an existing file and none of old and
new points to an empty string.
One could argue that the ENOTDIR return code (lines 38682-38683
of XSH 1233) should be returned instead:
A component of either path prefix is not a directory; or the old
argument names a directory and new argument names a non-directory
file.
But the general idea of ENOTDIR, as stated on lines 1043-1044 of
XSH 26, is clear in that:
Not a directory. A component of the specified pathname exists,
but it is not a directory, when a directory was expected.
So ENOTDIR is not suitable for our case because the assumption of
the implication is not met either (the component does not exist).
Action:
The standard should explicitly state that the reanme() interface will return
ENOENT for the case outlined above. That will be
aligned with the current implementations and also with the
general spirit of ENOENT as found in XSH 25, lines 1007-1008:
No such file or directory. A component of a specified pathname
does not exist, or the pathname is an empty string.
Suggested change of XSH 1233, lines 38679-38680:
The link named by old does not name an existing file, a component
of the path prefix of new does not exist, or either old or new
points to an empty string.
|