Skip to content

01_engine-xfread flakes on a SIGPIPE race under pipefail#637

Merged
xroche merged 1 commit into
masterfrom
fix-xfread-sigpipe-flake
Jul 18, 2026
Merged

01_engine-xfread flakes on a SIGPIPE race under pipefail#637
xroche merged 1 commit into
masterfrom
fix-xfread-sigpipe-flake

Conversation

@xroche

@xroche xroche commented Jul 18, 2026

Copy link
Copy Markdown
Owner

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 of its output and the pipeline reports failure even though the pattern was found. The || { echo FAIL; exit 1; } guard then fired on a passing assertion, so the test failed intermittently depending on output size and scheduling. It showed up on the Debian buildd leg of #632, a PR that does not touch this code.

Switching the three matches to here-strings (grep -q PATTERN <<<"$out") drops the pipe, so there is no early reader to SIGPIPE the writer. A deterministic control confirms the mechanism: the old form exits 141 when grep matches the first of many lines, the here-string form exits 0. The fixed test ran 200 times with no failures.

Pre-existing flake, independent of the batch fixes, so it gets its own PR.

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) <noreply@anthropic.com>
Signed-off-by: Xavier Roche <roche@httrack.com>
@xroche
xroche merged commit eb9e353 into master Jul 18, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant