[bug #62227] Incorrect warning for -name /

anonymous <[email protected]>
Newsgroups gmane.comp.gnu.findutils.bugs
Message-ID <[email protected]>
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
-name/-iname
> 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
basename.

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
spelt:


$ 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:

  <https://savannah.gnu.org/bugs/?62227>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.