findutils icon indicating copy to clipboard operation
findutils copied to clipboard

Empty brackets accepted

Open tavianator opened this issue 8 years ago • 3 comments

I assume this isn't an intentional extension:

$ ./target/debug/find \( \)
.
./.git
...

tavianator avatar Jun 14 '17 22:06 tavianator

I worked on the basis "when in doubt, do what GNU's find does". I grant you that it's fairly useless behaviour, but

  • it matches GNU find
  • it's harmless enough

mcharsley avatar Jun 15 '17 09:06 mcharsley

But

$ find \( \)
find: invalid expression; empty parentheses are not allowed.

Anyway, I agree it's relatively harmless to allow it.

tavianator avatar Jun 15 '17 13:06 tavianator

My mistake. I tried

find /tmp ()

and killed the process before I saw "find: `()': No such file or directory"

putting a space between the brackets does indeed give an error. That should be simple enough to fix.

thanks for the bug reports by the way. Nice to see someone's looking at the code :-).

On Thu, Jun 15, 2017 at 2:35 PM, Tavian Barnes [email protected] wrote:

But

$ find ( ) find: invalid expression; empty parentheses are not allowed.

Anyway, I agree it's relatively harmless to allow it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/uutils/findutils/issues/29#issuecomment-308730899, or mute the thread https://github.com/notifications/unsubscribe-auth/ALbIF1sLPvjrBLh0Xl499vle8zGmQ71Zks5sETMcgaJpZM4N6hS7 .

mcharsley avatar Jun 15 '17 13:06 mcharsley

Hello, I tried to solve it by adding a special judgment in the Matcher of uutils/findutils, and it seems to work. I've submitted a PR. :)

hanbings avatar Apr 11 '24 21:04 hanbings