helpThe GNU Bourne-Again SHell - Support: sr #109526, sigpipe kills entire subshell and...


sr #109526: sigpipe kills entire subshell and not just the builtin running

Submitted by:  None
Submitted on:  Tue 10 Jul 2018 08:26:33 PM UTC  
Category:  None Priority:  5 - Normal
Severity:  3 - Normal Status:  Invalid
Privacy:  Public Assigned to:  None
Originator Email:  -email is unavailable- Open/Closed:  Open
Operating System:  None

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Fri 17 Aug 2018 01:39:50 PM UTC, comment #1: 

SIGPIPE is a fatal signal. The default disposition is to exit the signaled process. This happens in all the cases below; in the first one, the signaled process is the shell, so it doesn't run the right side of the || list.

Chet Ramey <chet>
Project Administrator
Tue 10 Jul 2018 08:26:33 PM UTC, original submission:  

Not entirely sure this is a bug, but it seems like one

( set -o pipefail; { sleep 1; echo || true; } | true; echo $? )

prints 141, whereas

( set -o pipefail; { sleep 1; /bin/echo || true; } | true; echo $? )


( set -o pipefail; { sleep 1; ( echo ) || true; } | true; echo $? )

both print 0.  That is, it seems like sigpipe kills the entire subshell and not just the whatever builtin is currently running.

I've tried this on a variety of systems.  The current one I'm using is Debian unstable with

GNU bash, version 4.4.12(1)-release (x86_64-pc-linux-gnu).

Thanks!  -Tyson



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by chet (Posted a comment)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-08-17 chet StatusNone => Invalid

    Back to the top

    Powered by Savane 3.5