-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
Description
Component
fold
Description
GNU fold lets the kernel kill the pipeline cleanly without any extra handling steps while UU fold handles the broken pipe, prints fold: broken pipe and exit with code 1.
Reproduction
To simulate a broken pipe, we can use this command
yes a | fold -w1 | head -n1. yes a creates an infinite stream of as for fold -w1 whose output is piped to head -n1, which terminate after the first line of output, thus create a broken pipe where reader is terminated unexpectedly.
Using the GNU implementation, nothing happens beside code 141 when bash set -o pipefail.
$ yes a | fold -w1 | head -n1
a
$ echo $?
141
$ yes a | uu fold -w1 | head -n1
a
fold: Broken pipe
$ echo $?
1
Impact
A behavioral difference to GNU coreutils
Note
The handling of errors seem to be located in uucore::error meaning this issue may affect many other utilities.
Reactions are currently unavailable