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.
Component
foldDescription
GNU
foldlets the kernel kill the pipeline cleanly without any extra handling steps while UUfoldhandles the broken pipe, printsfold: broken pipeand exit with code 1.Reproduction
To simulate a broken pipe, we can use this command
yes a | fold -w1 | head -n1.yes acreates an infinite stream ofas forfold -w1whose output is piped tohead -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
141when bashset -o pipefail.Impact
A behavioral difference to GNU coreutils
Note
The handling of errors seem to be located in
uucore::errormeaning this issue may affect many other utilities.