Update of bug #58205 (project findutils): Status: None => In Progress Assigned to: None => berny
_______________________________________________________ Follow-up Comment #1: Sorry for the late reply, I did not receive an email for this issue. The "--" separates the options from the rest of the call arguments, which for find(1) could be path arguments followed by predicates (i.e. tests and actions). Unfortunately, the synopsis in the manpage does not show this. It should be changed like this: -find [-H] [-L] [-P] [-D debugopts] [-Olevel] [starting-point...] [expression] +find [-H] [-L] [-P] [-D debugopts] [-Olevel] [--] [starting-point...] [expression] The problem with the synopsis of find(1) - which is veeerry old - is that there's no way to tell find whether a word following the "--" is a starting point or an expression. This is reflected in your other examples: > ametzler@argenau:/tmp/findtest$ LANG=C find -- -L > find: unknown predicate `-L' The next argv[i] is -L, and as it starts with a minus "-", find assumes that now an expression would follow. As it does not know the expression -L (it is an option!), it complains about that "unknown predicate". > ametzler@argenau:/tmp/findtest$ LANG=C find ./ -- -regextype grep > find: unknown predicate `--' The tool already detected at the "./" argument, that the options (-L,-H,...) have ended, then hits "--" which falls in the same case as above: it starts with a minus "-", but is not a "known predicate". > ametzler@argenau:/tmp/findtest$ LANG=C find -- * > find: unknown predicate `-L' Here, find knows from the "--" that no options (-L,-H,...) will follow. Now it depends on the shell globbing which file name is passed next. In this case, it is again the file "-L", but find has no chance to know that the user wanted to pass it as file name. I don't think adding another kind of separator like "--" to force find to treat some argument as starting points would help here, because that would have the same problem: find [-H] [-L] [-P] [-D debugopts] [-Olevel] [--] [starting-point...] [--] [expression] # What if there is a file named "--"? This would also fail ... find -L -- * -- -type f The only thing I can think of to get out of this dilemma is to add an option to read the starting points from a file, best Zero-separated. # Pass starting points before expressions: find [-H] [-L] [-P] [-D debugopts] [-Olevel] [--] [starting-point...] [expression] # Alternative synopsis: read starting points from file: find [-H] [-L] [-P] [-D debugopts] [-Olevel] -files0-from=FILE [--] [expression] # e.g. ... | find -L -files0-from=- -type f ... _______________________________________________________ Reply to this item at: <https://savannah.gnu.org/bugs/?58205> _______________________________________________ Message sent via Savannah https://savannah.gnu.org/