bug-bash
[Top][All Lists]
Advanced

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

Re: triggering of ERR trap differs between bash 3.2.39 & 4.0.28


From: Amit Dor-Shifer
Subject: Re: triggering of ERR trap differs between bash 3.2.39 & 4.0.28
Date: Tue, 10 Nov 2009 09:14:05 +0200
User-agent: Thunderbird 2.0.0.22 (X11/20090605)

Seems like I've erroneously switched between bash versions exhibiting the difference. It's 3.2.39 that evaluates 'on_error' when catching the trap.

From the start:

# bash-4.0_p28/image/bin/bash --version
GNU bash, version 4.0.28(2)-release (x86_64-pc-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
# bash-4.0_p28/image/bin/bash -xc 'set -eE;on_error() { echo ERROR ERROR; };trap on_error ERR;if [ -n "$(echo $0 |grep a)" ];then echo "input contains 'a'";fi' b
+ set -eE
+ trap on_error ERR
++ echo b
++ grep a
+ '[' -n '' ']'
# bash-3.2_p39/image/bin/bash --version
GNU bash, version 3.2.39(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.
# bash-3.2_p39/image/bin/bash -xc 'set -eE;on_error() { echo ERROR ERROR; };trap on_error ERR;if [ -n "$(echo $0 |grep a)" ];then echo "input contains 'a'";fi' b
+ set -eE
+ trap on_error ERR
++ echo b
++ grep a
+++ on_error
+++ echo ERROR ERROR
+ '[' -n 'ERROR ERROR' ']'
+ echo 'input contains a'
input contains a

Amit

Chet Ramey wrote:
Ok. Same here. (4.0.35 is not yet stable on my distro, gentoo, hence I quoted results with 4.0.28).

But I can't reproduce it with bash-4.0.28, either:

$ ./bash --version
GNU bash, version 4.0.28(2)-release (i386-apple-darwin9.8.0)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ ./bash -xc 'set -eE;on_error() { echo ERROR ERROR; };trap on_error ERR;if [ -n "$(echo $0 
|grep a)" ];then echo "input contains 'a'";fi' a
+ set -eE
+ trap on_error ERR
++ echo a
++ grep a
+ '[' -n a ']'
+ echo 'input contains a'
input contains a
$ ./bash -xc 'set -eE;on_error() { echo ERROR ERROR; };trap on_error ERR;if [ -n "$(echo $0 
|grep a)" ];then echo "input contains 'a'";fi' b
+ set -eE
+ trap on_error ERR
++ echo b
++ grep a
+ '[' -n '' ']'




Chet Ramey wrote:
Ok. Same here. (4.0.35 is not yet stable on my distro, gentoo, hence I quoted results with 4.0.28).

But I can't reproduce it with bash-4.0.28, either:

$ ./bash --version
GNU bash, version 4.0.28(2)-release (i386-apple-darwin9.8.0)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ ./bash -xc 'set -eE;on_error() { echo ERROR ERROR; };trap on_error ERR;if [ -n "$(echo $0 
|grep a)" ];then echo "input contains 'a'";fi' a
+ set -eE
+ trap on_error ERR
++ echo a
++ grep a
+ '[' -n a ']'
+ echo 'input contains a'
input contains a
$ ./bash -xc 'set -eE;on_error() { echo ERROR ERROR; };trap on_error ERR;if [ -n "$(echo $0 
|grep a)" ];then echo "input contains 'a'";fi' b
+ set -eE
+ trap on_error ERR
++ echo b
++ grep a
+ '[' -n '' ']'






reply via email to

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