Re: "echo: write error: Broken pipe" even when DONT_REPORT_SIGPIPE set
From:
Tim Waugh
Subject:
Re: "echo: write error: Broken pipe" even when DONT_REPORT_SIGPIPE set
Date:
Tue, 10 Jan 2006 09:54:13 +0000
User-agent:
Mutt/1.4.2.1i
On Mon, Jan 09, 2006 at 02:22:11PM -0500, Chet Ramey wrote:
> > bash-3.1:
> >
> > $ bash -c 'trap exit SIGPIPE; echo foo' | :
> > bash: line 0: echo: write error: Broken pipe
> > $
> >
> > Is this change in behaviour intentional, or a regression?
>
> It's intentional, and doesn't have anything to do with job control
> or processes dying from SIGPIPE in general. There were several bug
> reports filed against bash-3.0 complaining that the only way to
> check whether or not echo failed to write requested data was to use
> the exit status. (Mostly in connection with redirected output on a
> full or unavailable file system.) `echo' now displays an error
> message on write errors. `printf' does the same thing.
If there is no trap set it doesn't report an error. So is this
special behaviour only triggered when there is a trap for SIGPIPE in
place?
GNU bash, version 3.1.1(1)-release (i386-redhat-linux-gnu)
$ bash -c 'echo foo' | :
$
Tim.
*/