bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Language lawyering the man pages


From: Álvaro António Santos
Subject: Language lawyering the man pages
Date: Wed, 29 Jan 2020 18:43:57 +0000

Hello all,

The man pages for find (version 4.7.0-git) say the following at the
end of the "EXPRESSION" section:
If the whole expression contains no actions other than -prune or
-print, -print is performed on all files for which the whole
expression is true.

For the following 2 examples, assume that find is being run within a
directory whose only contents are a .git directory (which has the
"typical" .git project directory structure itself, although that's not
relevant for this discussion).

Running the following command:
find . -path "*/.git" -prune -o -true
Produces, expectedly, the following output:
.
./.git

However, running the following command:
find . -path "*/.git" -prune -o -true -print
Produces:
.

A similar example can be found at the end of the "OPERATORS" subsection:
Please note that -a when specified implicitly (for example by two
tests appearing without an explicit operator between them) or
explicitly has higher precedence than -o. This means that find . -name
afile -o -name bfile -print will never print afile.
This example is also repeated in the "NON-BUGS" section, explicitly
showing how -print binds to -name bfile and not the disjunction of
both -name tests.

You may already see where this is going... :-)
Per the man pages for find, the only actions present in any of the
previous examples are "-print" and "-prune". Specifically, "-path" is
a test, "-o" is an operator, "-true" is a test, and "-name" is a test.
Thus, -print should be executed for both branches of the -o,
regardless of being bound to the right hand branch.

Is my interpretation of the man pages, albeit nitpicky, correct? If
so, I believe that the sentence at the end of the "EXPRESSIONS"
section should be changed to correctly describe find's behaviour, xor
that find should be changed to always execute -print on both -o
branches of the previous examples [probably not the best option].

Any feedback would be appreciated,
Álvaro



reply via email to

[Prev in Thread] Current Thread [Next in Thread]