On Sat, 30 Jul 2022 13:26:46 -0400 (EDT)
Martin Dorey <invalid.nore...@gnu.org> wrote:
> Follow-up Comment #2, bug #62840 (project make):
> 
> Just for completeness or academic interest, then, this makes it happen
> reliably for me:
> 
> 
> set -o pipefail; { ruby -we '$stdout.write("x" * 4096)'; make --version; } |
> head -n1; echo $?

It was not a reliable way to reproduce the "bug" here:

-8<-----------------------
bash-4.3$ set -o pipefail; { ruby -we '$stdout.write("x" * 4096)'; make
--version; } | head -n1; echo $?
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  
...
xxxxxxxxxxxxxxxxGNU Make 4.1
0
-8<-----------------------

But I would agree that it is not a bug. A program writing to a pipe is
expected to get a SIGPIPE and possibly return an error code if the pipe closes
before the program is finished.

However, the program is not guaranteed to get a SIGPIPE, there are also
buffers which the program might be able to write to even though those buffers
might not be emptied by the receiving process.

regards Henrik

Reply via email to