Red Hat Bugzilla – Bug 177242
Bash is not ignoring SIGPIPE
Last modified: 2007-11-30 17:11:20 EST
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):
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.
Please provide a smaller, self-contained test case. I haven't been able to
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?
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?
Reported upstream. Thanks for the smaller test case:
bash -c 'trap exit SIGPIPE; echo foo' | :
Intentional behaviour change.