bug-bash
[Top][All Lists]
Advanced

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

Re: Clarification needed on signal spec EXIT


From: Chet Ramey
Subject: Re: Clarification needed on signal spec EXIT
Date: Sun, 21 Oct 2012 15:41:52 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:15.0) Gecko/20120907 Thunderbird/15.0.1

On 10/21/12 7:35 AM, Francis Moreau wrote:

>> Yes, this is a bug in bash-4.2.  The subshell doesn't properly reinitialize
>> the traps if a trap has already been set in the parent.  This was fixed in
>> late July and will be in the next version of bash.
> 
> That doesn't explain the following (taken from a previous post):
> 
>   Even weirder: if the subshell exits by calling "exit 1", then the trap
>   handler is not called at all regardless of whether or not the "trap
>   main_cleanup EXIT" is commented you.
> 
>   To make that case work, you need to use the "( ... ) &" construct
>   instead of "{ ... } &" one.

I think I understand this, but let me make sure.  Where are you putting
the `exit 1'?  If you put it as the last statement in task_in_background,
it works fine.  If you put it after the call to task_in_background in the
lambda subshell, it works fine.  (Both cases with the parent's EXIT trap
commented out and using a brace group.)

Do you mean to replace the call to task_in_background in the lambda
subshell with `exit 1'?  If so, you're right that it doesn't work in
bash-4.2.  It's the same fix from the same bug report:

http://lists.gnu.org/archive/html/bug-bash/2012-07/msg00084.html

The fixes for that report are all in the bash-20120727 snapshot, if you
want to look at that in the devel branch of the git tree on savannah.

Chet
-- 
``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]