From: Dmitry V. Levin Date: Sat, 30 Jan 2010 19:21:19 +0000 (+0300) Subject: Fix exit status of signal handlers in shell scripts. X-Git-Tag: v1.11.1b~95^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dbfabdfc6521979678367ba9df3876fa2300da59;p=thirdparty%2Fautomake.git Fix exit status of signal handlers in shell scripts. The value of `$?' on entrance to signal handlers in shell scripts cannot be relied upon, so set the exit code explicitly to 128 + SIG. * lib/am/check.am (am__check_pre): Use `exit 143' in signal handler. * lib/elisp-comp: Likewise. * lib/install-sh: Likewise. * lib/ylwrap: Likewise. Also, fix script to trap signal 13, not 3. * NEWS, THANKS: Update. Bug report, analysis, and initial patch by Dmitry V. Levin. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 4a279e1bf..a6faf810b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2010-02-06 Dmitry V. Levin (tiny change) + Ralf Wildenhues + + Fix exit status of signal handlers in shell scripts. + The value of `$?' on entrance to signal handlers in shell scripts + cannot be relied upon, so set the exit code explicitly to + 128 + SIG. + * lib/am/check.am (am__check_pre): Use `exit 143' in signal handler. + * lib/elisp-comp: Likewise. + * lib/install-sh: Likewise. + * lib/ylwrap: Likewise. Also, fix script to trap signal 13, not 3. + * NEWS, THANKS: Update. + Bug report, analysis, and initial patch by Dmitry V. Levin. + 2010-02-06 Karl Berry Improve gnupload usage text. diff --git a/NEWS b/NEWS index cd427fbed..22846804b 100644 --- a/NEWS +++ b/NEWS @@ -21,6 +21,9 @@ Bugs fixed in 1.11.0a: - AM_PROG_GCJ uses AC_CHECK_TOOLS to look for `gcj' now, so that prefixed tools are preferred in a cross-compile setup. + - Several scripts as well as the parallel-tests testsuite driver now + exit with the right exit status upon receiving a signal. + New in 1.11: diff --git a/THANKS b/THANKS index d606ce2fd..57bb50145 100644 --- a/THANKS +++ b/THANKS @@ -82,6 +82,7 @@ Dieter Baron dillo@stieltjes.smc.univie.ac.at Dieter Jurzitza DJurzitza@harmanbecker.com Dilyan Palauzov Dilyan.Palauzov@aegee.org Dmitry Mikhin dmitrym@acres.com.au +Dmitry V. Levin ldv@altlinux.org Doug Evans devans@cygnus.com Duncan Gibson duncan@thermal.esa.int Ed Hartnett ed@unidata.ucar.edu diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in index 5979b977c..1401eb9fe 100644 --- a/lib/Automake/tests/Makefile.in +++ b/lib/Automake/tests/Makefile.in @@ -129,8 +129,9 @@ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ srcdir=$(srcdir); export srcdir; \ rm -f $@-t; \ -trap 'st=$$?; rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st' \ - 1 2 13 15; \ +am__trap='rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st'; \ +trap "st=129; $$am__trap" 1; trap "st=130; $$am__trap" 2; \ +trap "st=141; $$am__trap" 13; trap "st=143; $$am__trap" 15; \ am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`; \ test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ diff --git a/lib/am/check.am b/lib/am/check.am index b1d1aade4..755bf13ab 100644 --- a/lib/am/check.am +++ b/lib/am/check.am @@ -1,5 +1,5 @@ ## automake - create Makefile.in from Makefile.am -## Copyright (C) 2001, 2003, 2006, 2007, 2008, 2009 Free Software +## Copyright (C) 2001, 2003, 2006, 2007, 2008, 2009, 2010 Free Software ## Foundation, Inc. ## This program is free software; you can redistribute it and/or modify @@ -101,8 +101,9 @@ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ srcdir=$(srcdir); export srcdir; \ rm -f $@-t; \ -trap 'st=$$?; rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st' \ - 1 2 13 15; \ +am__trap='rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st'; \ +trap "st=129; $$am__trap" 1; trap "st=130; $$am__trap" 2; \ +trap "st=141; $$am__trap" 13; trap "st=143; $$am__trap" 15; \ am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`; \ test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \ diff --git a/lib/elisp-comp b/lib/elisp-comp index ce8c82c0e..ecc6b150b 100755 --- a/lib/elisp-comp +++ b/lib/elisp-comp @@ -1,8 +1,8 @@ #!/bin/sh -# Copyright (C) 1995, 2000, 2003, 2004, 2005, 2009 Free Software +# Copyright (C) 1995, 2000, 2003, 2004, 2005, 2009, 2010 Free Software # Foundation, Inc. -scriptversion=2009-04-28.21; # UTC +scriptversion=2010-02-06.18; # UTC # Franc,ois Pinard , 1995. # @@ -65,7 +65,11 @@ tempdir=elc.$$ # Cleanup the temporary directory on exit. trap 'ret=$?; rm -rf "$tempdir" && exit $ret' 0 -trap '(exit $?); exit' 1 2 13 15 +do_exit='(exit $ret); exit $ret' +trap "ret=129; $do_exit" 1 +trap "ret=130; $do_exit" 2 +trap "ret=141; $do_exit" 13 +trap "ret=143; $do_exit" 15 mkdir $tempdir cp "$@" $tempdir diff --git a/lib/install-sh b/lib/install-sh index 6781b987b..3f83ce9b5 100755 --- a/lib/install-sh +++ b/lib/install-sh @@ -1,7 +1,7 @@ #!/bin/sh # install - install a program, script, or datafile -scriptversion=2009-04-28.21; # UTC +scriptversion=2010-02-06.18; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the @@ -200,7 +200,11 @@ if test $# -eq 0; then fi if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 + do_exit='(exit $ret); exit $ret' + trap "ret=129; $do_exit" 1 + trap "ret=130; $do_exit" 2 + trap "ret=141; $do_exit" 13 + trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. diff --git a/lib/ylwrap b/lib/ylwrap index 84d563405..92b201172 100755 --- a/lib/ylwrap +++ b/lib/ylwrap @@ -1,10 +1,10 @@ #! /bin/sh # ylwrap - wrapper for lex/yacc invocations. -scriptversion=2009-04-28.21; # UTC +scriptversion=2010-02-06.18; # UTC # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005, -# 2007, 2009 Free Software Foundation, Inc. +# 2007, 2009, 2010 Free Software Foundation, Inc. # # Written by Tom Tromey . # @@ -99,7 +99,11 @@ esac # FIXME: add hostname here for parallel makes that run commands on # other machines. But that might take us over the 14-char limit. dirname=ylwrap$$ -trap "cd '`pwd`'; rm -rf $dirname > /dev/null 2>&1" 1 2 3 15 +do_exit="cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1;"' (exit $ret); exit $ret' +trap "ret=129; $do_exit" 1 +trap "ret=130; $do_exit" 2 +trap "ret=141; $do_exit" 13 +trap "ret=143; $do_exit" 15 mkdir $dirname || exit 1 cd $dirname diff --git a/tests/Makefile.in b/tests/Makefile.in index 295480382..3d7404669 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -132,8 +132,9 @@ $(am__sh_e_setup); \ $(am__vpath_adj_setup) $(am__vpath_adj) \ srcdir=$(srcdir); export srcdir; \ rm -f $@-t; \ -trap 'st=$$?; rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st' \ - 1 2 13 15; \ +am__trap='rm -f '\''$(abs_builddir)/$@-t'\''; (exit $$st); exit $$st'; \ +trap "st=129; $$am__trap" 1; trap "st=130; $$am__trap" 2; \ +trap "st=141; $$am__trap" 13; trap "st=143; $$am__trap" 15; \ am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`; \ test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?; \ if test -f "./$$f"; then dir=./; \