bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #62840] make --version in pipe return SIGPIPE


From: Paul D. Smith
Subject: [bug #62840] make --version in pipe return SIGPIPE
Date: Sun, 31 Jul 2022 09:16:40 -0400 (EDT)

Follow-up Comment #3, bug #62840 (project make):

The reason GNU make behaves differently here is that for a normal program when
you pipe its output the system automatically sets the stdout stream to block
buffered mode (the default is line buffered mode).

This means that the entire version string is buffered in the stream, then it
will be written as a single block when you flush (or exit, or the block fills
up: but blocks are usually 1K or more so that won't happen for version info
output).  Because it goes as a single block, the entire thing will be written
to the pipe before the reader closes the pipe.

However, due to GNU make's output sync feature, make will force stdout to be
in line buffered mode (where each line is flushed as its written) at all
times.  This means that GNU make is writing its output in multiple separate
system calls, which means it might get a write failure if the reader closes
the pipe early.

Unfortunately I'm not sure there's a simple way to avoid this.  I'll have to
think about it.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?62840>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]