@ page 452 line 17526 section find objection [gwc find first operand]
Problem:
Defect code : 3. Clarification required
What is the allowed behaviour for the following command?
find ! -name . -print
The SYNOPSIS for find is:
find [-H | -L] path ... [operand_expression ...]
which suggests that the above "!" argument should be treated as a
path, but the OPERANDS section states that the first argument
(meaning operand - see XCU ERN 89) that starts with a '-', or is a '!'
or a '(' is treated as the start of the expression, which implies that
the command is syntactically incorrect (because at least one path
operand is required). Thus the standard could be interpreted as
allowing find either to treat the "!" as a path or to report a command
line syntax error.
However, GNU find does neither of these - it implements an extension
whereby a missing path is taken to be "." (the current directory),
thus treating the command as if it were:
find . ! -name . -print
The standard should be changed to state explicitly that the behaviour
is unspecified. This would remove any doubt about whether one or
other of the two possible interpretations is intended, and at the
same time clarify that the GNU behaviour is a permitted extension.
Action:
Change
"The path operand is a pathname of a starting point in the
directory hierarchy."
to
"The first operand and subsequent operands up to but not
including the first operand that starts with a '-', or is a '!'
or a '(', shall be interpreted as path operands. If the first
operand starts with a '-', or is a '!' or a '(', the behavior
is unspecified. Each path operand is a pathname of a starting
point in the directory hierarchy."
|