[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bash-bug
Subject:    Re: first trap call behaviour
From:       Chet Ramey <chet.ramey () case ! edu>
Date:       2015-07-28 17:16:44
Message-ID: 55B7B8FC.4040308 () case ! edu
[Download RAW message or body]

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/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic