On 3/21/24 1:43 PM, Gioele Barabucci wrote:
On 21/03/24 18:08, Oğuz wrote:
On Thu, Mar 21, 2024 at 7:13 PM Gioele Barabucci <gioele@svario.it>
wrote:
Regardless of the reason for the SIGPIPE, the reporter expects the loop
to carry on indefinitely (`while true; ...`).
Then he should do `trap '' PIPE' before the loop.
it is incorrect that > SIGPIPE terminates the subshell.
Why?
For various reasons. First of all, because it confuses users (there
are various bug reports in Debian for this specific issue).
More technically, because non-builtin commands are treated
differently, for example /bin/echo (from
<https://bugs.debian.org/423207>):
There's been a fair amount of (inconclusive) discussion on the POSIX
mailing list about this issue at various points, but not enough reason
to change the way bash has always behaved.
For example, there is plenty of code that expects the shell to exit when
you hit it with, say, a SIGHUP while it's executing a builtin, or if you
hit a non-interactive shell with a SIGTERM during a builtin, because that's
how shells have always behaved.