-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
Component
tee --output-error, tee -p
Description
GNU tee ignores SIGPIPE when --output-error is set (or -p), allowing broken-pipe writes to return EPIPE for in-process handling. uutils only resets SIGPIPE to default when no output_error mode is selected; there is no SIGPIPE ignore path for warn/exit modes.
// src/uu/tee/src/tee.rs:162-166
if options.ignore_interrupts {
ignore_interrupts().map_err(|_| Error::from(ErrorKind::Other))?;
}
if options.output_error.is_none() {
enable_pipe_errors().map_err(|_| Error::from(ErrorKind::Other))?;
// No SIG_IGN for output_error modesGNU explicitly calls signal(SIGPIPE, SIG_IGN) when output_error != output_error_sigpipe.
Test / Reproduction Steps
# Terminal 1:
mkfifo /tmp/testpipe
yes | tee --output-error=warn /tmp/testpipe /tmp/out.txt &
TEE_PID=$!
# Terminal 2:
cat /tmp/testpipe | head -1
# Close the pipe
# Check tee status
wait $TEE_PID; echo $?
# GNU: continues writing to /tmp/out.txt, prints warning, exits normally
# uutils: killed by SIGPIPE (exit 141), /tmp/out.txt truncatedImpact
In pipelines where outputs close early, uutils tee is terminated by SIGPIPE even when the user explicitly requested warn/exit behavior. This skips writes to remaining outputs and yields signal-driven exit status instead of the configured --output-error behavior.
Reactions are currently unavailable