[prev in list] [next in list] [prev in thread] [next in thread]
List: bash-bug
Subject: Re: trap output piped to another program gives incomplete results
From: Eric Blake <eblake () redhat ! com>
Date: 2010-03-31 13:50:26
Message-ID: 4BB35322.4000303 () redhat ! com
[Download RAW message or body]
On 03/30/2010 11:45 PM, Siddhesh Poyarekar wrote:
> Fix:
>
> I've not looked at how this can be fixed yet, but it looks
> like bash is forking for the trap builtin, which inherits the
> ignored signals, hence showing only them as active traps
> into the pipe. The other signals are not inherited and hence
> do not show up at all.
See also this Austin Group report:
http://austingroupbugs.net/view.php?id=53
which states this about running trap in a subshell:
Change
"When a subshell is entered, traps that are not being ignored are
set to the default actions."
to
"When a subshell is entered, traps that are not being ignored shall
be set to the default actions, except in the case of a command
substitution containing only a single trap command, when the traps
need not be altered. Implementations may check for this case
using only lexical analysis; for example if `trap` and $( trap -- )
do not alter the traps in the subshell, cases such as assigning
var=trap and then using $($var) may still alter them."
Change
"The trap command with no arguments shall write to standard output
a list of commands associated with each condition."
to
"The trap command with no operands shall write to standard output
a list of commands associated with each condition. If the command
is executed in a subshell, the implementation does not perform
the optional check described above for a command substitution
containing only a single trap command, and no trap commands with
operands have been executed since entry to the subshell, the list
shall contain the commands that were associated with each
condition immediately before the subshell environment was entered.
Otherwise, the list shall contain the commands currently
associated with each condition."
--
Eric Blake eblake@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic