Hey find users,

I have a question about the behavior of GNU find. Consider the following
invocation of find

    $ find one/ two/ -name file
    one/file
    two/file

I want to know if there exists directories one/ and two/ and a matching file in
each directory, is the above output guaranteed in the given order? Does find
always print all the matches below the first starting point argument before any
matches below the following starting point argument and so on?

With a glance at the code, it seems this does describe the current behavior of
GNU find since it process each arg in order (please correct me if wrong), and I
think it's a somewhat useful property, but I could find no statement
guaranteeing the behavior in the man page or info pages, and no related
discussion on this list. Theoretically there might exist some possible
optimization on platforms like Linux with, say io_uring, which would not
necessarily lend themselves quite as naturaly to the same guarantee, especially
if dir one had many many more files than dir two.

Can we decide whether this is an unintended behavior or intended feature of GNU
find?

Thanks,
Ronan

Reply via email to