summaryrefslogtreecommitdiff
path: root/init.cfg
diff options
context:
space:
mode:
authorBernhard Voelker <mail@bernhard-voelker.de>2022-03-29 00:24:47 +0200
committerBernhard Voelker <mail@bernhard-voelker.de>2022-04-24 13:35:49 +0200
commit6d2fa2c9a065743b9655427cedaf54bb55cd143f (patch)
tree9868863a80f7bb06ddcc5795c268abe9b5a9dd36 /init.cfg
parent82e81acc5cf0caaf493227ad80bf35e85089eb48 (diff)
downloadfindutils-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.cfg9
1 files changed, 9 insertions, 0 deletions
diff --git a/init.cfg b/init.cfg
index 5e422291..98423613 100644
--- a/init.cfg
+++ b/init.cfg
@@ -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_()
{