coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

cat: Suppress Broken Pipe errors.

Open fnordahl opened this issue 7 months ago • 4 comments

At present, the cat command unexpectedly prints an error message when it receives a broken pipe error.

As an example, there are many workflows that make use of cat and head together to process only part of the data. The head command will stop reading after a configured number of bytes or lines, subsequently exposing cat to a broken pipe condition.

Said workflows may fail when they unexpectedly get error messages in their output.

Suppress broken pipe errors.

fnordahl avatar May 12 '25 04:05 fnordahl

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)

github-actions[bot] avatar May 12 '25 05:05 github-actions[bot]

GNU testsuite comparison:

Skipping an intermittent issue tests/misc/tee (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/timeout/timeout (passes in this run but fails in the 'main' branch)

github-actions[bot] avatar May 13 '25 09:05 github-actions[bot]

The Android / Test builds (ubuntu-latest, 4, 4096, 28, google_apis_playstore, x check appears to have failed intermittently during initialization and might be unrelated to the change at hand?

fnordahl avatar May 13 '25 12:05 fnordahl

@fnordahl yes, it looks unrelated. Anyway, I restarted it.

cakebaker avatar May 13 '25 12:05 cakebaker

This was superseded by #8336 I believe sand is no longer needed

julian-klode avatar Aug 05 '25 14:08 julian-klode

Awesome, great that it was eventually fixed @julian-klode.

Curious about the choice of messing with std::io signal handling as opposed to just checking error return of std::io functions, which already handles the signal, but as long as I don't get broken pipes in cat output I'm happy!

fnordahl avatar Aug 29 '25 08:08 fnordahl