maint: avoid :> pattern in tests

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.
This commit is contained in:
Pádraig Brady
2025-07-26 20:06:42 +01:00
parent 93304acc10
commit 798a35a7b3
2 changed files with 4 additions and 3 deletions

5
cfg.mk
View File

@@ -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; } \
|| :

View File

@@ -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