]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: avoid :> pattern in tests
authorPádraig Brady <P@draigBrady.com>
Sat, 26 Jul 2025 19:06:42 +0000 (20:06 +0100)
committerPádraig Brady <P@draigBrady.com>
Sat, 26 Jul 2025 19:06:42 +0000 (20:06 +0100)
This was seen to trigger the EXIT trap on cygwin

* cfg.mk (sc_prohibit_colon_redirection): Disallow all
cases of :> in tests/
* tests/cksum/md5sum-bsd.sh: Adjust to avoid more
stringent syntax check.

cfg.mk
tests/cksum/md5sum-bsd.sh

diff --git a/cfg.mk b/cfg.mk
index 96aac603784d2c6657b79f0aecf80311808cc837..56c70f244d2205ded8685b54a33577402699e373 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -144,9 +144,10 @@ sc_ensure_gl_diffs_apply_cleanly:
        done
 
 # Avoid :>file which doesn't propagate errors
+# Also  :>file was seen to trigger EXIT trap on cygwin
 sc_prohibit_colon_redirection:
-       @cd $(srcdir)/tests && GIT_PAGER= git grep -En ': *>.*\|\|'     \
-         && { echo '$(ME): '"The leading colon in :> will hide errors" >&2; \
+       @cd $(srcdir)/tests && GIT_PAGER= git grep -En ': *>[^>]'       \
+         && { echo '$(ME): '":> will hide errors or may trigger EXIT" >&2; \
               exit 1; }  \
          || :
 
index 1f80ccbe1c6b74c2dc9f2e8a81efce510b0ab780..4986f01444eb2c7025f05b0a08772231f3ee1daa 100755 (executable)
@@ -78,7 +78,7 @@ if echo '' > 'backslash\is\not\dir\sep'; then
   t='  '
   rm check.md5
   for i in 'a\b' 'a\' '\a' "a${nl}b" "a${t}b"; do
-    : > "$i"
+    rm -f "$i" && touch "$i"
     md5sum --tag "$i" >> check.md5 || fail=1
   done
   md5sum --strict -c check.md5 > out || fail=1