.
Last update: 1997-05-20
9945-2-23
Class: The unaddressed issue
The standard does not speak to this issue, and as such no conformance
distinction can be made between alternative implementations based on this.
This is being referred to the Sponsors of the standard for clarifying
wording in the next amendment.
_____________________________________________________________________________
Topic: test
Relevant Sections: 4.62.4
Defect Report:
-----------------------
The standard describes, in Section 4.62.4 - Operands {of
test}, the -w and -x primaries:
-w True if file exists and is writable.
True shall indicate only that the write
flag is on. The file shall not be
writable on a read-only file system even
if this test indicates true.
-x True if file exists and is executable.
True shall indicate only that the
execute flag is on. If file is a
directory, true indicates that file can
be searched.
[Draft 12 of ISO/IEC 9945-2:1993 (July 1992), p. 474, lines
10241-10246]
However, for the -r primary, the standard states that -r
file returns ``[t]rue if file exists and is readable.''
[Ibid., p. 474, line 10235]
Does the -r primary have the same caveat as the -w and -x
primaries, namely, only checking the read flag in the mode
bits?
The descriptions of the -w and -x primaries mention ``the
write flag,'' and ``the execute flag.'' Which of the
respective flags should be checked: owner, group, or other?
Or is this unspecified by POSIX.2. Otherwise, may we assume
the standard intends the ``appropriate'' flag: the user flag
if the user ID matches the owner of the file, the group flag
if the file is owned by any group in the current grouplist,
else the other flag, with no check for appropriate
privileges?
WG15 response for 9945-2:1993
-----------------------------------
The standard does not state that -r checks the read bit, so it does not
have that restriction the way the -w and -x flags do. The question of
which flags are checked (and the order) is unspecified by the standard,
and thus any behavior is allowed. Concern over the wording of this
section of the standard has been forwarded to the sponsors of the
standard.
Rationale for Interpretation:
-----------------------------
None.
_____________________________________________________________________________