]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: avoid new grep -q syntax-check failures
authorPádraig Brady <P@draigBrady.com>
Tue, 15 Nov 2022 13:27:57 +0000 (13:27 +0000)
committerPádraig Brady <P@draigBrady.com>
Tue, 15 Nov 2022 14:02:10 +0000 (14:02 +0000)
* cfg.mk: Exclude NEWS from the check.
* init.cfg: s/grep -q/grep >/dev/null/.
* tests/ls/hyperlink.sh: Likewise.
* tests/ls/symlink-quote.sh: Likewise.

cfg.mk
init.cfg
tests/ls/hyperlink.sh
tests/ls/symlink-quote.sh

diff --git a/cfg.mk b/cfg.mk
index 99a9ad4d337e2b97c128c341602b8e5a8113fd7c..992aabc86bedf61f655f3d5aa1c6e1494473de27 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -599,8 +599,8 @@ sc_env_test_dependencies:
                grep -vF '[' |paste -d'|' -s))" tests | \
            sed "s/\([^:]\):.*env \([^)' ]*\).*/\1 \2/" | uniq | \
            while read test prog; do \
-             printf '%s' $$test | grep -q '\.pl$$' && continue; \
-             grep -q "print_ver_.* $$prog" $$test \
+             printf '%s' $$test | grep '\.pl$$' >/dev/null && continue; \
+             grep "print_ver_.* $$prog" $$test >/dev/null \
                || echo $$test should call: print_ver_ $$prog; \
            done | grep . && exit 1 || :
 
@@ -657,7 +657,7 @@ sc_prohibit_test_calls_print_ver_with_irrelevant_argument:
              while read file name; do                                  \
                for i in $$name; do                                     \
                  case "$$i" in install) i=ginstall;; esac;             \
-                 grep -w "$$i" $$file|grep -vw print_ver_|grep -q .    \
+                 grep -w "$$i" $$file|grep -vw print_ver_|grep . >/dev/null \
                    || { fail=1;                                        \
                         echo "*** Test: $$file, offending: $$i." 1>&2; };\
                done;                                                   \
@@ -906,6 +906,10 @@ exclude_file_name_regexp--sc_ensure_dblspace_after_dot_before_id_est = \.diff$$
 exclude_file_name_regexp--sc_ensure_comma_after_id_est = \.diff|$(_ll)$$
 exclude_file_name_regexp--sc_long_lines = \.diff$$|$(_ll)
 
+# `grep . -q` is not exactly equivalent to `grep . >/dev/null`
+# and this difference is significant in the NEWS description
+exclude_file_name_regexp--sc_unportable_grep_q = NEWS
+
 # Augment AM_CFLAGS to include our per-directory options:
 AM_CFLAGS += $($(@D)_CFLAGS)
 
index eb57de2643eb5c3e7db1af0def9db3dd1e78c1dc..576f6ecd673f70cf43cddff65acdd0fe0b49d1bd 100644 (file)
--- a/init.cfg
+++ b/init.cfg
@@ -636,7 +636,7 @@ mkfifo_or_skip_()
 
 trap_sigpipe_or_skip_()
 {
-  (trap '' PIPE && yes | :) 2>&1 | grep -qF 'Broken pipe' ||
+  (trap '' PIPE && yes | :) 2>&1 | grep -F 'Broken pipe' >/dev/null ||
     skip_ 'trapping SIGPIPE is not supported'
 }
 
index e87b3cfe88811ce84a67b9d9f9a6c6d085ea1580..27c775777f119571a4ca5a6dcf895d165a900965 100755 (executable)
@@ -29,7 +29,7 @@ encode() {
 
 ls_encoded() {
   ef=$(encode "$1")
-  echo "$ef" | grep -q 'dir$' && dir=: || dir=''
+  echo "$ef" | grep 'dir$' >/dev/null && dir=: || dir=''
   printf '\033]8;;file:///%s\a%s\033]8;;\a%s\n' \
     "$ef" "$1" "$dir"
 }
index 688b9a4c1ffa04789819080942a4037f3871763f..43e1546d91d39478a2b8d2ab23bb5f190da23a55 100755 (executable)
@@ -24,7 +24,7 @@ ln -s 'needs quoting' symlink || framework_failure_
 ls -l --quoting-style='shell-escape' symlink >out || fail=1
 
 # Coreutils v8.26 and 8.27 failed to quote the target name
-grep -q "symlink -> 'needs quoting'\$" out ||
+grep "symlink -> 'needs quoting'\$" out >/dev/null ||
   { cat out; fail=1; }
 
 Exit $fail