]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Fix exit status of signal handlers in shell scripts.
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 30 Jan 2010 19:21:19 +0000 (22:21 +0300)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 6 Feb 2010 19:46:51 +0000 (20:46 +0100)
The value of `$?' on entrance to signal handlers in shell scripts
cannot be relied upon, so set the exit code explicitly to
128 + SIG<SIGNAL>.

* 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 <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
THANKS
lib/Automake/tests/Makefile.in
lib/am/check.am
lib/elisp-comp
lib/install-sh
lib/ylwrap
tests/Makefile.in

index 4a279e1bf59a8e990dbaa5a92f3e7923a0503dd4..a6faf810b0206e5e55192e0398e853c9af2d0356 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2010-02-06  Dmitry V. Levin  <ldv@altlinux.org>  (tiny change)
+           Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       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<SIGNAL>.
+       * 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  <karl@gnu.org>
 
        Improve gnupload usage text.
diff --git a/NEWS b/NEWS
index cd427fbed590b986ad1fc794a75c26bd386207c9..22846804bd8ab88cd70322ab83bf9949f1de6337 100644 (file)
--- 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.
+
 \f
 New in 1.11:
 
diff --git a/THANKS b/THANKS
index d606ce2fdeaac6f14619b44f4dc874e8160c0ae9..57bb501453b2776b9f64eca392ec90d4e123cd1d 100644 (file)
--- 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
index 5979b977c0cdcdb44b7fd763bc53643d80e86250..1401eb9fea5be84665b571a0efc1706858d70242 100644 (file)
@@ -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=./;                       \
index b1d1aade4d9bb749c2683890e487bee2990caa5a..755bf13ab559e4cac03ae3a1c141764f3f556939 100644 (file)
@@ -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=./;                       \
index ce8c82c0e41083ea67874fa50243c89e17947e0c..ecc6b150ba0b76138617476e636147f1c0dba49c 100755 (executable)
@@ -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 <pinard@iro.umontreal.ca>, 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
index 6781b987bdbcbc23efe6bbe1654a1e3637b9af07..3f83ce9b555a535ca90c450882953554c7e4ded5 100755 (executable)
@@ -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.
index 84d563405e6e29a64a4ffdb07da262e2e5628dba..92b201172fbf138beafbde14c14676611e911817 100755 (executable)
@@ -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 <tromey@cygnus.com>.
 #
@@ -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
index 29548038223229c187d60ec7ffec23555b57b73a..3d740466911a05f94169ec180d653cebb998dc83 100644 (file)
@@ -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=./;                       \