From 2e46bb2ae669f58c4cb326d52cbeb5dcb5abe19a Mon Sep 17 00:00:00 2001 From: Xavier Roche Date: Sat, 18 Jul 2026 07:43:59 +0200 Subject: [PATCH] Fix SIGPIPE flake in 01_engine-xfread under pipefail The test matched engine output with `echo "$out" | grep -q PATTERN`. Under `set -o pipefail`, grep -q exits the moment it matches, so echo takes a SIGPIPE writing the rest and the pipeline reports failure even though the pattern was found. The `|| { echo FAIL; exit 1; }` guard then fired on a passing case, turning it into an intermittent, output-size-dependent failure (seen on the Debian buildd leg of #632). Match with here-strings instead, dropping the pipe and the race entirely. Co-Authored-By: Claude Opus 4.8 (1M context) Signed-off-by: Xavier Roche --- tests/01_engine-xfread.test | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/01_engine-xfread.test b/tests/01_engine-xfread.test index 160d6e49..f82f8a4f 100755 --- a/tests/01_engine-xfread.test +++ b/tests/01_engine-xfread.test @@ -9,21 +9,23 @@ set -euo pipefail # drives both refusal paths and the accept path. out="$(httrack -O /dev/null -#test=xfread-limit)" +# Match with here-strings, not `echo | grep -q`: under pipefail the early grep +# exit SIGPIPEs echo and fails the pipeline even when the pattern matched. for case in bylen bygrow; do - echo "$out" | grep -q "${case}: refused=1 adr=null msg=In-memory content too large" || { + grep -q "${case}: refused=1 adr=null msg=In-memory content too large" <<<"$out" || { echo "FAIL ${case}: $out" exit 1 } done # Exactly INT32_MAX must be refused too (the reallocs add 1). -echo "$out" | grep -q 'boundary: msg=In-memory content too large' || { +grep -q 'boundary: msg=In-memory content too large' <<<"$out" || { echo "FAIL boundary: $out" exit 1 } # The guard must NOT fire for a legitimate small size. -if echo "$out" | grep -q 'accept: msg=In-memory content too large'; then +if grep -q 'accept: msg=In-memory content too large' <<<"$out"; then echo "FAIL accept (guard fired on a legit size): $out" exit 1 fi