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

 
 

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

Submitter:  None
Submitted:  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
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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 $? )

and

( 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

Anonymous

 

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

Attach Files:
   
   
Comment:
   

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)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    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.13-f8d8.
    Corresponding source code