scripts: fix catching failures
author"Yann E. MORIN" <yann.morin.1998@free.fr>
Tue May 08 18:31:10 2012 +0200 (2012-05-08)
changeset 2964d48c03998dc1
parent 2963 59cd7c65c347
child 2966 dc2943c98775
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>
scripts/crosstool-NG.sh.in
     1.1 --- a/scripts/crosstool-NG.sh.in	Sun May 06 15:11:24 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