scripts: fix catching failures 1.15
author"Yann E. MORIN" <yann.morin.1998@free.fr>
Tue May 08 18:31:10 2012 +0200 (2012-05-08)
branch1.15
changeset 296511b93b849695
parent 2962 073a24df8852
child 2968 595a11dcaa1a
scripts: fix catching failures

POSIX 1003.1-2008 does not say whether "set -e" should catch a sub-shell
that exits with !0 (it has a list of conditions to catch, but no list of
conditions not to catch, and this situation is not listed).

bash-3 does not catch such a failure, but bash-4 does. That why, on my
Squeeze system I did not see the issue, while Thomas did on is Lenny chroot.

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
(transplanted from d48c03998dc1c25a3b29b2c0af425631baee3abe)
scripts/crosstool-NG.sh.in
     1.1 --- a/scripts/crosstool-NG.sh.in	Sat May 05 23:04:21 2012 +0200
     1.2 +++ b/scripts/crosstool-NG.sh.in	Tue May 08 18:31:10 2012 +0200
     1.3 @@ -596,6 +596,10 @@
     1.4          fi
     1.5          if [ ${do_it} -eq 1 ]; then
     1.6              ( do_${step} )
     1.7 +            # POSIX 1003.1-2008 does not say if "set -e" should catch a
     1.8 +            # sub-shell ending with !0. bash-3 does not, while bash-4 does,
     1.9 +            # so the following line is for bash-3; bash-4 would choke above.
    1.10 +            [ $? -ne 0 ]
    1.11              if [ "${CT_STOP}" = "${step}" ]; then
    1.12                  do_stop=1
    1.13              fi