On 3/13/25 18:45, Bernhard Voelker wrote:
$ find "-)" "," "-!" "-ls"
find: invalid expression: expected expression before closing parentheses '-)'.

This one seems to have been fixed with this commit:
  https://git.savannah.gnu.org/cgit/findutils.git/commit/?id=a5659a42fa2db

What worries me more is the use of the extra dash '-' for the logical elements 
'-)' and '-!'.
I've ever wondered about the line in the find_parser() function:

  if (*search_name == '-')
    search_name++;

  
https://git.savannah.gnu.org/cgit/findutils.git/tree/find/parser.c?id=faa13013686b179ab8f23a9ea7d238fb090c5ffe#n658

This statement exists since "the beginning" in the Git repository, but it looks
just like to being able to use the same code for regular options and predicates
(like -name) and the parser entries '(', ')', ',' and '!'.

On the downside, this allows to prefix them with the dash, e.g. '-(', '-)', 
'-,' and '-!',
and find(1) would accept them.

  $ find '-(' -name . '-)'
  .

I'm wondering whether any serious, existing script makes use of that.
Otherwise, I'd rather like to fix this.

Opinions?

Have a nice day,
Berny

Reply via email to