Defect report from : Nick Stoughton , USENIX Association
(Please direct followup comments direct to yyyyyyyyyyyyyy@xxxxxxxxxxxxx)
@ page 319 line 12299 section diff comment {nms-diff-01}
Problem:
Edition of Specification (Year): 2004
Defect code : 3. Clarification required
The diff command states "No output shall be produced if the files are
identical."
Are two symbolic links to the same non-existant file identical?
e.g.
$ rm -rf a b
$ ln -s /nonexist a
$ ln -s /nonexist b
$ diff a b
should this produce no output, since the files could be viewed as
identical? Or should it (as most implementations appear to) complain
that neither file exists?
At line 12333, it states that input files may be of any type.
Presumably this includes symbolic links.
Most implementations I have tried complain that one or both of the
files do not exist, and exit with error code 2. Are such
implementations conforming?
Filename Resolution (XBD 4.11, page XBD 101) suggests that since there
are no arguments directing the "function" to act on the symbolic link
itself, pathname resolution is not complete, and therefore the current
behavior implementation behavior is correct.
However, consider the case of two identical directory hierarchies:
$ rm -rf a b
$ mkdir a b
$ ln -s /nonexist a
$ ln -s /nonexist b
$ diff -r a b
Should these hierarchies compare equal?
Action:
clarify the behavior.
If it is intended that two symbolic links to the same non-existant file
compare identical, then this should be noted in the description. Add at
line 12300 "When comparing two symbolic links to the same file, these
links shall be considered identical if they refer to the same file,
whether or not that file exists."
Alternatively, if the existing practice of actually opening the files to
compare the contents is considered correct, then add to line 12323
(before the sentence starting "Futher details ..."): "Symbolic link
files shall be resolved as described in XBD 4.11, Pathname Resolution".
Although this latter change is strictly unnecessary, it clarifies the
situation beyond doubt.
|