[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SIGPIPE not properly reset with 'trap - PIPE'
From: |
Ralf Wildenhues |
Subject: |
SIGPIPE not properly reset with 'trap - PIPE' |
Date: |
Thu, 11 Dec 2008 07:18:28 +0100 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
Hello bug-bash readers,
I noticed the following bash bug when using gnulib-tool. The script
below outputs
foo: line 20: echo: write error: Broken pipe
foo: line 21: echo: write error: Broken pipe
with bash 3.2.48(5)-release on GNU/Linux, whereas I think it should be
silent. Please note that the script assumes that GNU coreutils seq is
installed.
Please also note that the above errors occur also when
trap '' PIPE
is used instead of 'trap - PIPE'.
I believe this might be a rather recent regression, as I don't recall
this happening when the code was introduced into gnulib-tool a few
months ago.
Thanks for maintaining bash!
Cheers,
Ralf
#! /bin/sh
func_exit ()
{
(exit $1); exit $1
}
trap 'exit_status=$?
if test "$signal" != 0; then
echo "caught signal $signal" >&2
fi
exit $exit_status' 0
for signal in 13; do
trap '{ signal='$signal'; func_exit 1; }' $signal
done
signal=0
foo=`seq 10000 30000`
( trap - PIPE; echo "$foo" ) | join -v 2 - /dev/null
trap - PIPE; echo "$foo" | join -v 2 - /dev/null
- SIGPIPE not properly reset with 'trap - PIPE',
Ralf Wildenhues <=