bug-bash
[Top][All Lists]
Advanced

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

Re: Debian bug #822605: SIGPIPE not handled in "echo >", terminates shel


From: Gioele Barabucci
Subject: Re: Debian bug #822605: SIGPIPE not handled in "echo >", terminates shell
Date: Fri, 22 Mar 2024 07:02:59 +0100
User-agent: Mozilla Thunderbird

On 21/03/24 22:54, Chet Ramey wrote:
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.

Dear Chet, thanks you for your reply. Do you have a link or two to these discussions that I can add to the Debian bug reports to explain why they will be marked as "wontfix"?

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.

I'd argue (but I assume it has already been done in the aforementioned discussions) that the SIGPIPE comes from a command being run in a pipeline provided by the user, while these other signals come from an "external" source (the user? other programs?). So in this regard it makes sense to handle SIGPIPE differently (i.e., catching it).

Regards,

--
Gioele Barabucci




reply via email to

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