bug-bash
[Top][All Lists]
Advanced

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

Re: trap ERR shows inconsistent behaviour


From: Chet Ramey
Subject: Re: trap ERR shows inconsistent behaviour
Date: Sat, 25 Jul 2009 14:14:08 -0400
User-agent: Thunderbird 2.0.0.22 (Macintosh/20090605)

Henning Garus wrote:
> Configuration Information [Automatically generated, do not change]:
> Machine: i686
> OS: linux-gnu
> Compiler: gcc
> Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
> -DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
> -DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL 
> -DHAVE_CONFIG_H   -I.  -I. -I./include -I./lib   -march=i686 -mtune=generic 
> -O2 -pipe
> uname output: Linux helios 2.6.30-ARCH #1 SMP PREEMPT Mon Jul 20 11:20:32 UTC 
> 2009 i686 AMD Athlon(tm) XP 2600+ AuthenticAMD GNU/Linux
> Machine Type: i686-pc-linux-gnu
> 
> Bash Version: 4.0
> Patch Level: 24
> Release Status: release
> 
> Description:
>     When set -E is active functions inherit the ERR trap, however it will not
>     be executed if the failed command is part of a comman executed in a ||
>     list.
> 
>     If the failing command is part of a function, which is called as first
>     part of ||, the ERR trap is not executed (call_func1), however if the 
> function is
>     called by eval it will be executed (call_func2).
> 
>     If trap 'return 1' ERR is set and the eval is wrapped in a list the second
>     part of || will be executed(call_func3), without the list the trap will 
> be executed
>     again.


Thanks for the report.  The behavior with the eval builtin should be the
same as without it -- being in a AND or OR list should inhibit execution
of the ERR trap.  The builtin execution code should temporarily disable
the ERR trap for the eval/source/command builtins in the same way it
temporarily disables and restores the -e option.  This fix will be in
the next version of bash.

Chet
-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer

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]