tests/cut: ignore stdin write error on fast-exit delimiter test#11782
Merged
cakebaker merged 1 commit intouutils:mainfrom Apr 13, 2026
Merged
tests/cut: ignore stdin write error on fast-exit delimiter test#11782cakebaker merged 1 commit intouutils:mainfrom
cakebaker merged 1 commit intouutils:mainfrom
Conversation
test_single_quote_pair_as_delimiter_is_invalid is intermittent on i686: the parent writes "a''b\n" to cut's stdin while cut validates args and exits immediately with "delimiter must be a single character". On a fast child exit, the kernel closes the pipe read-end before the parent's write() runs, so write() returns EPIPE and the pipe_in thread panics. The race is inherent: draining stdin in cut before exiting on an arg error would hang on terminals and read unbounded data from long pipes, contradicting GNU behavior. Use the test framework's ignore_stdin_write_error() flag, which exists for exactly this "parent writes to child that exits fast" pattern.
Contributor
Author
|
GNU testsuite comparison: |
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.
test_single_quote_pair_as_delimiter_is_invalid is intermittent on i686: the parent writes "a''b\n" to cut's stdin while cut validates args and exits immediately with "delimiter must be a single character". On a fast child exit, the kernel closes the pipe read-end before the parent's write() runs, so write() returns EPIPE and the pipe_in thread panics.
The race is inherent: draining stdin in cut before exiting on an arg error would hang on terminals and read unbounded data from long pipes, contradicting GNU behavior. Use the test framework's ignore_stdin_write_error() flag, which exists for exactly this "parent writes to child that exits fast" pattern.