[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fatal bug with redirection
From: |
Stephane Chazelas |
Subject: |
Re: Fatal bug with redirection |
Date: |
Wed, 4 Oct 2006 22:41:22 +0100 |
User-agent: |
Mutt/1.5.6i |
On Wed, Oct 04, 2006 at 03:38:12PM -0400, Yang wrote:
> On my FC5 box, when I try certain things in bash 3.1.7(1)-release
> involving redirection, such as the following, bash crashes
> (immediately exits):
>
> { echo a >&3 ; } 3> >( echo b )
>
> I've only tried this from an interactive shell. Unfortunately I don't
> have bashbug or bashversion, as I'm using the FC5 RPM version, but
> here is some info:
[...]
All the shells I could try that where echo is builtin behave the
same in that case (die).
Above,
echo is writing to a pipe whose other end is closed (echo b has
terminated already by the time "echo a" starts to write on its
standard output), so echo will get a SIGPIPE signal. The problem
is that, echo being builtin, it's the shell that is doing the
write to the dead pipe, and so it's the shell that is getting
the SIGPIPE. SIGPIPE is a fatal signal.
However, it's true that a builtin echo is not meant to behave
differently than an external echo command. So bash (and other
shells) should try and work around that by only causing the echo
command to terminate with a 141 exit status.
The problem is not only for echo.
test \( ! 2> >(:)
read % 2> >(:)
--
Stéphane