[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trap output piped to another program gives incomplete results

From: Chet Ramey
Subject: Re: trap output piped to another program gives incomplete results
Date: Sun, 11 Apr 2010 22:40:09 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20100111 Lightning/1.0b1 Thunderbird/3.0.1

On 4/10/10 12:18 AM, Siddhesh Poyarekar wrote:
> On Sat, Apr 10, 2010 at 8:51 AM, Chet Ramey <address@hidden> wrote:
>> On 3/31/10 1:45 AM, Siddhesh Poyarekar wrote:
>>> Bash Version: 4.1
>>> Patch Level: 2
>>> Release Status: release
>>> Description:
>>>               When output of trap is piped to another command, say, less or
>>>               cat -, it shows only ignored signals.
>> As the standard is currently written, this is the correct behavior.
>> The standard considers traps in subshells in two places: where it talks
>> about "subshell environments" and where it describes the behavior of trap.
>> The former says only that all commands in a pipeline are run in a subshell
>> environment, and that in a subshell environment traps "are set to the
>> default values."  The latter says that "when a subshell is entered, traps
>> that are not being ignored are set to the default actions."  This is an
>> obvious contradiction, and most shells implement the latter.
>> Bash and some other shells special-case command substitution, because the
>> standard includes an example illustrating the use of command substitution
>> to save and restore traps.  This is not univeral -- dash, for instance,
>> does not do it.
> Thanks, will you consider fixing this or accept a patch to fix this? A
> fix along the lines of the standards change Eric pointed out ought to
> work I think. I'm not sure at what point the change becomes
> effective/enforceable.

I'll implement whatever the standard eventually ends up saying in bash-4.2.
I've already asked for a clarification of the points above.


``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]