Uh oh!
There was an error while loading. Please reload this page.
ci: stop the clang-format report dying on SIGPIPE for large diffs - #161
Open
balbasty wants to merge 1 commit into
Open
ci: stop the clang-format report dying on SIGPIPE for large diffs#161balbasty wants to merge 1 commit into
balbasty wants to merge 1 commit into
Conversation
The informational clang-format job still went red on any PR whose diff exceeded the 64 KiB pipe buffer. Under `set -euo pipefail`, `printf ... | head -n 400` makes printf take SIGPIPE once head closes, pipefail propagates 141, and set -e kills the step before its `exit 0`. Reproduced: a 40,000-line payload exits 141; 5,000 lines (under the pipe buffer) exits 0 -- which is why the one-file verification PR passed and PR #147, with 12 files, did not. This is the same shape as #89: a set -e interaction with a pipeline that was never exercised at scale. sed reads all of its input, so it cannot signal printf.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The informational clang-format job introduced in #156 still goes red on any PR whose diff exceeds the 64 KiB pipe buffer — which is most real PRs. #147 hit it with 12 files.
Cause
The step runs under
set -euo pipefailand builds its capped step-summary diff with:shown=$(printf '%s\n'"$out"| head -n "$max")Once
headhas taken its 400 lines it closes the pipe. If$outis larger than the 64 KiB pipe buffer,printfhas not finished writing, takesSIGPIPE, and the pipeline reports 141.pipefailpropagates it,set -ekills the step — before theexit 0at the end that makes this job informational.So the job printed its findings, emitted
::notice::clang-format … this job does not fail, and then failed anyway.Reproduced
5,000 short lines is ~25 KiB and fits the pipe buffer, so it passes. That is exactly why #156's verification PR — a single added file — came back green while a real PR does not: the bug is invisible below 64 KiB.
Fix
sed -n "1,${max}p"reads all of its input rather than closing the pipe early, soprintfis never signalled. Verified at 40,000 lines: exits 0 and captures exactly 400 lines.Note
This is the same shape as the bug #156 set out to fix (#89): a
set -einteraction with a pipeline whose failure path was never exercised. Worth remembering that the reporting path of a lint needs testing at realistic size, not just at all.The other
| headin this workflow — theFFMEMpeak-RSS table inbuild-cuda— is not affected: that step has nopipefail, sohead's exit status is the pipeline's andsortbeing signalled is harmless.Generated by Claude Code