[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fix exit status of signal handlers in shell scripts
From: |
Dmitry V. Levin |
Subject: |
[PATCH] Fix exit status of signal handlers in shell scripts |
Date: |
Sat, 30 Jan 2010 22:21:19 +0300 |
The value of `$?' on entrance to signal handlers in shell scripts
cannot be relied upon, so set the exit code explicitly to
128 + SIGTERM == 143.
* lib/am/check.am (am__check_pre): Use `exit 143' in signal handler.
* lib/elisp-comp: Likewise.
* lib/install-sh: Likewise.
* lib/ylwrap: Likewise.
---
See also
http://lists.gnu.org/archive/html/bug-gnulib/2010-01/msg00361.html
lib/am/check.am | 2 +-
lib/elisp-comp | 2 +-
lib/install-sh | 2 +-
lib/ylwrap | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/am/check.am b/lib/am/check.am
index b1d1aad..56fc732 100644
--- a/lib/am/check.am
+++ b/lib/am/check.am
@@ -101,7 +101,7 @@ $(am__sh_e_setup); \
$(am__vpath_adj_setup) $(am__vpath_adj) \
srcdir=$(srcdir); export srcdir; \
rm -f address@hidden; \
-trap 'st=$$?; rm -f '\''$(abs_builddir)/address@hidden'\''; (exit $$st); exit
$$st' \
+trap 'rm -f '\''$(abs_builddir)/address@hidden'\''; (exit 143); exit 143' \
1 2 13 15; \
am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`; \
test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?; \
diff --git a/lib/elisp-comp b/lib/elisp-comp
index ce8c82c..99026de 100755
--- a/lib/elisp-comp
+++ b/lib/elisp-comp
@@ -65,7 +65,7 @@ tempdir=elc.$$
# Cleanup the temporary directory on exit.
trap 'ret=$?; rm -rf "$tempdir" && exit $ret' 0
-trap '(exit $?); exit' 1 2 13 15
+trap '(exit 143); exit 143' 1 2 13 15
mkdir $tempdir
cp "$@" $tempdir
diff --git a/lib/install-sh b/lib/install-sh
index 6781b98..565e4c7 100755
--- a/lib/install-sh
+++ b/lib/install-sh
@@ -200,7 +200,7 @@ if test $# -eq 0; then
fi
if test -z "$dir_arg"; then
- trap '(exit $?); exit' 1 2 13 15
+ trap '(exit 143); exit 143' 1 2 13 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 84d5634..8fbade6 100755
--- a/lib/ylwrap
+++ b/lib/ylwrap
@@ -99,7 +99,7 @@ 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
+trap "cd '`pwd`' && rm -rf $dirname > /dev/null 2>&1; (exit 143); exit 143" 1
2 3 15
mkdir $dirname || exit 1
cd $dirname
--
ldv
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] Fix exit status of signal handlers in shell scripts,
Dmitry V. Levin <=