Skip to content

Commit 4fa689a

Browse files
sylvestrecakebaker
authored andcommitted
tests/cut: ignore stdin write error on fast-exit delimiter test
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.
1 parent 0002371 commit 4fa689a

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

tests/by-util/test_cut.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ fn test_single_quote_pair_as_delimiter_is_invalid() {
291291
for args in [&["-d", "''", "-f2"][..], &["--delimiter=''", "-f2"][..]] {
292292
new_ucmd!()
293293
.args(args)
294+
.ignore_stdin_write_error()
294295
.pipe_in("a''b\n")
295296
.fails()
296297
.stderr_contains("cut: the delimiter must be a single character")

0 commit comments

Comments
 (0)