Bug 177242

Summary: Bash is not ignoring SIGPIPE
Product: [Fedora] Fedora Reporter: Brian Gerst <brgerst>
Component: bashAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhide   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-01-10 14:27:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Brian Gerst 2006-01-08 05:05:35 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8) Gecko/20060103 Fedora/1.5-4 Firefox/1.5

Description of problem:
According to the bash FAQ:
As of bash-3.1, bash will not report SIGPIPE errors by default.  You
can build a version of bash that will report such errors.

But it is still displaying errors:
cg-log: line 210: echo: write error: Broken pipe


Version-Release number of selected component (if applicable):
bash-3.1-2

How reproducible:
Always

Steps to Reproduce:
1. Use the cogito command, cg-log, which invokes less
2. The error shows when you exit less.
  

Actual Results:  cg-log: line 210: echo: write error: Broken pipe


Expected Results:  No error.

Additional info:

Comment 1 Tim Waugh 2006-01-09 14:46:23 UTC
Please provide a smaller, self-contained test case.  I haven't been able to
reproduce this.

while :; do echo foo; done | head -n1

..generates a SIGPIPE, and does not give out a warning.  What does that line do
when you run it?

Comment 2 Brian Gerst 2006-01-09 15:11:29 UTC
I found the culprit.  cg-log does "trap exit SIGPIPE".  Commenting out this line
silences the error.  Since older bashes didn't give the error message with this
trap in place, is it a bash regression, or should the script just not use the trap?

Comment 3 Tim Waugh 2006-01-09 15:48:29 UTC
Reported upstream.  Thanks for the smaller test case:

bash -c 'trap exit SIGPIPE; echo foo' | :

Comment 4 Tim Waugh 2006-01-10 14:27:52 UTC
Intentional behaviour change.