bug-bash
[Top][All Lists]
Advanced

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

Re: first trap call behaviour


From: Chet Ramey
Subject: Re: first trap call behaviour
Date: Tue, 28 Jul 2015 13:16:44 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.0.1

On 7/28/15 6:34 AM, David Waddell wrote:
> Hi
> 
>     Just a quick query re. the a behavior of trap when called from
> function, not sure if it’s a bug or inconsistency or intentional.
> 
>  
> 
>     Basically it seems (without set –o errtrace)
> 
> -          an ERR trap can be set from within a function when no ERR trap
> is currently defined.
> 
> -          ERR trap can then not be changed or cleared unless cleared from
> global scope (ie cannot be cleared within a function).
> 
> -          With set –o errtrace, the subsequent calls do succeed in
> changing the trap, as might be expected.

This is the same phenomenon as

http://lists.gnu.org/archive/html/bug-bash/2015-04/msg00051.html
and
http://lists.gnu.org/archive/html/help-bash/2015-04/msg00058.html

with the same change to the ERR trap handling as to the DEBUG trap to
fix it.

It's interesting that after all the years this has been this way, there
have been several questions about it within the past three months.

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



reply via email to

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