diff options
author | Bernhard Voelker <mail@bernhard-voelker.de> | 2022-03-29 00:24:47 +0200 |
---|---|---|
committer | Bernhard Voelker <mail@bernhard-voelker.de> | 2022-04-24 13:35:49 +0200 |
commit | 6d2fa2c9a065743b9655427cedaf54bb55cd143f (patch) | |
tree | 9868863a80f7bb06ddcc5795c268abe9b5a9dd36 /init.cfg | |
parent | 82e81acc5cf0caaf493227ad80bf35e85089eb48 (diff) | |
download | findutils-6d2fa2c9a065743b9655427cedaf54bb55cd143f.tar.gz |
find: omit warning diagnostic for -name '/'
Although usually a pattern containing a directory separator does not match
anything, a pattern solely consisting of one '/' still does (and has to)
for the root directory "/".
* find/parser.c (check_name_arg): Omit the warning in the case the
given pattern equals "/".
find/find.1 (-name): Clarify better that the pattern "/" is valid to
match the "/" directory.
* init.cfg (find_emits_warnings_): Add utility function.
* tests/find/name-slash.sh: Add test.
* tests/local.mk (all_tests): Reference it.
* MEWS (Bug Fixes): Mention the fix.
Fixes https://savannah.gnu.org/bugs/?62227
Diffstat (limited to 'init.cfg')
-rw-r--r-- | init.cfg | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -514,6 +514,15 @@ fiemap_capable_() python "$abs_srcdir"/tests/fiemap-capable "$@" } +# Determine if find(1) emits warnings. This is not the case +# e.g. if stdin is not a tty. +find_emits_warnings_() +{ + # Find usually emits a warning for the deprecated -d option. + find -maxdepth 0 -d -quit 2>&1 \ + | grep -q 'warning:' +} + # Skip the current test if "." lacks d_type support. require_dirent_d_type_() { |