Re: Change in behaviour regarding subshell handling?

2009-09-24 Thread Martin Michlmayr
* Chet Ramey  [2009-09-24 08:29]:
> >   l.  Changed behavior of shell when -e option is in effect to reflect 
> > consensus
> >   of Posix shell standardization working group.
> 
> This behavior is one of the consequences of the Austin Group's interpretation.
> Failures of user-specified subshells cause the shell to exit when set -e is
> in effect.  The key piece of the interpretation was to widen the scope of
> commands that cause the shell to exit without an explicit exception from
> simple commands to all commands.

Thanks for the confirmation.  Maybe CHANGES can be updated to list all
the changes that were made as a consequence of the Austin Group's
interpretation.

-- 
Martin Michlmayr
http://www.cyrius.com/




Change in behaviour regarding subshell handling?

2009-09-23 Thread Martin Michlmayr
I noticed that bash has changed behaviour regarding subshell handling,
breaking a script of mine.  Now a script with -e fails when a subshell
fails whereas it didn't before.  I looked at the CHANGES file and
couldn't find anything about this, so I wanted to ask if this change
was intentional or if this is a bug.

In fact, there's something in CHANGES that might be relevant but the
description isn't really clear at all:
  l.  Changed behavior of shell when -e option is in effect to reflect consensus
  of Posix shell standardization working group.

Anyway, the test program and output is below.

Take this script:

set -e
set -x

echo "1"
(echo "x" | grep -v "x")
echo "2"


On Debian lenny with 3.2.39(1)-release:

foobar:~# bash t
+ echo 1
1
+ grep -v x
+ echo x
+ echo 2
2

On Debian testing with 4.0.28(1)-release:

foobar:~# bash t
+ echo 1
1
+ echo x
+ grep -v x

With dash (same output for lenny and testing):

foobar:~# dash t
+ echo 1
1
+ echo x
+ grep -v x
+ echo 2
2

-- 
Martin Michlmayr
http://www.cyrius.com/