[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #62227] Incorrect warning for -name /

From: anonymous
Subject: [bug #62227] Incorrect warning for -name /
Date: Mon, 28 Mar 2022 21:41:23 -0400 (EDT)

Follow-up Comment #2, bug #62227 (project findutils):

[comment #1 comment #1:]
> I personally like to get such a warning, as one should try to use
> with patterns for basenames only, and I think that the use case 'find /
-prune -name /'
> is quite exotic (and I would never have tried it myself TBH), so I'm
wondering if it's
> worth bothering to improve the warning diagnostic as shown above.

I agree that it makes sense to warn for a name that cannot ever be a basename,
but that means no warning should be issued for -name /, as / is a valid

For the record, -name / and -wholename / do not match in exactly the same
cases, because the basename of the root directory is / regardless of how it is

$ find /// -prune -name /
find: warning: ‘-name’ matches against basenames only, but the given
pattern contains a directory separator (‘/’), thus the expression will
evaluate to false all the time.  Did you mean ‘-wholename’?

$ find /// -prune -wholename /
find: warning: -wholename / will not match anything because it ends with /.

(That is another incorrect warning, -wholename / certainly can match despite
ending in /, but that is not part of this bug report.)


Reply to this item at:


  Message sent via Savannah

reply via email to

[Prev in Thread] Current Thread [Next in Thread]