Repository navigation
tee: replace the pipe a failed output used - #15132
Merged
Merged
Conversation
oech3
reviewed
Oct 6, 2026
oech3
reviewed
Oct 6, 2026
oech3
reviewed
Oct 6, 2026
sylvestre
reviewed
Oct 6, 2026
sylvestre
reviewed
Oct 6, 2026
oech3
reviewed
Oct 6, 2026
abendrothj
force-pushed
the
tee-replace-failed-pipe
branch
from
October 6, 2026 09:32
fa83021 to
95228ac
Compare
Contributor
|
Seems that it makes coverage sad: |
tee duplicates its input through two pipes on Linux. When splicing from one of them to an output failed part-way, for example with ENOSPC or EFBIG, the bytes the output did not take stayed in the pipe, and the remaining outputs got them in front of their next chunk. Replace the pipe with an empty one after a failed output. The old pipe is closed first, so that this also works at the open file limit. A new pipe gets the larger size only if the 2nd pipe got it at the start, so that the 2nd is never smaller than the 1st. If no new pipe can be made, tee fails with the error.
abendrothj
force-pushed
the
tee-replace-failed-pipe
branch
from
October 6, 2026 23:23
95228ac to
b2c51e5
Compare
Contributor
Author
|
thanks, that's the coverage build writing its profile under the same size limit. both tests now check exit code 1 and use |
oech3
reviewed
Oct 7, 2026
This comment was marked as resolved.
This comment was marked as resolved.
Contributor
|
Thanks for your PR |
This was referenced Oct 7, 2026
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 free
to 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.
On Linux, tee copies its input to the outputs through two pipes. When splicing to one output failed part-way (EFBIG, ENOSPC), the bytes it didn't take stayed in the pipe. The other outputs would get them in front of their next chunk, and with the 2nd pipe left part-full tee panicked on its
2nd pipe should have enough spareassertion.After a failed output, the old pipe is now closed and replaced with an empty one. A new pipe gets the larger size only if the 2nd pipe got it at startup, so the 2nd is never smaller than the 1st. The old pipe is closed first, so this also works at the open file limit. If no new pipe can be made, tee fails with the error.
test_tee_failed_output_does_not_spill_into_othersandtest_tee_failed_output_at_open_file_limitfail on main and pass here.Split out of #15086.
Closes #15119