clarification regarding the evaluation of global options

[email protected]
Newsgroups gmane.comp.gnu.findutils.bugs
Message-ID <[email protected]>
Let's assume the following current folder:

.
|
+---- a.txt
|
+---- b.txt
|
+---- c.txt

in which we issue the following command

$ find . -depth -name a.txt -o -name b.txt

We get the following result:

./a.txt
./b.txt


-------- Problem 1 --------

By evaluating the expression according to the information in the manual of find
the command should return also c.txt as part of the result. Let me explain my
reasoning. The above command is equivalent to the following command:

$ find . -depth -a -name a.txt -o -name b.txt

and the expression is evaluated for each file, that is even for c.txt and because
the result is known immediately after the evaluation of -depth (which always returns
true) the command should print it to the standard output.

Not having c.txt in the result it seems to me that find performs the following
evaluation:

     $ find . -depth -a \( -name a.txt -o -name b.txt \)

Is this correct? If so, then some information in the manual page should clarify
that all global options are (probably) evaluated only once and before the rest of
the expression.


-------- Problem 2 --------

I've tried to use "-D tree" to see that is going on. The first section shows:

Predicate List:
[(] [-depth] [-a] [-name] [-o] [-name] [)] [-a] [-print]

I deduce that before printing "Predicate list" section find elaborates the expression
and adds a "-print". Correct. But, in this printed form the order of evaluation
has the same problems as mentioned in the section "Problem 1" above. The same is true
for the next sections "Normalized Eval Tree", "Optimized Eval Tree", etc.



Thank you
Cristian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.