From 5cb0cca3b863e7aa5978f725c227c323a4a0d58f Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?=
Date: Sat, 11 Apr 2026 22:33:50 +0100 Subject: [PATCH] tests: fix false failure under some shells Verified with: make -j4 PREFERABLY_POSIX_SHELL=/bin/ksh SUBDIRS=. check * tests/fold/fold-zero-width.sh: Don't timeout $SHELL -c ... as the ulimit induces a failure in the subshell depending on the order of the allocations it does. The main issue is disparity between the probed ulimit and that needed by $SHELL -c. Such subshells load the often very large locale archive, thus if there are any allocations done after the now too low ulimit is set, then the $SHELL command fails. Note we timeout fold rather than the whole pipeline so any 124 exit status is propagated. --- tests/fold/fold-zero-width.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/fold/fold-zero-width.sh b/tests/fold/fold-zero-width.sh index 402b2b55ee..933d09ca13 100755 --- a/tests/fold/fold-zero-width.sh +++ b/tests/fold/fold-zero-width.sh @@ -54,13 +54,12 @@ test $(wc -l < out) -eq $(($IO_BUFSIZE_TIMES2 / 80)) || fail=1 # Ensure bounded memory operation. test -w /dev/full && test -c /dev/full && -vm=$(get_min_ulimit_v_ fold /dev/null) && { +vm=$(get_min_ulimit_v_ timeout 10 fold /dev/null) && { # \303 results in EILSEQ on input for c in '\n' '\0' '\303'; do - tr '\0' "$c" < /dev/zero | timeout 10 $SHELL -c \ - "(ulimit -v $(($vm+12000)) && fold 2>err >/dev/full)" + tr '\0' "$c" < /dev/zero | + (ulimit -v $(($vm+12000)) && timeout 10 fold 2>err >/dev/full) ret=$? - test -f err || skip_ 'shell ulimit failure' { test $ret = 124 || ! grep "$ENOSPC" err >/dev/null; } && { fail=1; cat err; echo "fold didn't diagnose ENOSPC" >&2; } done -- 2.47.3