summaryrefslogtreecommitdiff
path: root/gnulib-tool
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-11-26 15:25:44 +0100
committerBruno Haible <bruno@clisp.org>2022-11-26 15:25:44 +0100
commit835b3ea801782fcf72ef1f9397bb112cac0e2f50 (patch)
tree45803fd125a3005f4054232c3cb43ded1bc93347 /gnulib-tool
parent6ec9bc73686fd42d0a1a82c914d89176745cddbd (diff)
downloadgnulib-835b3ea801782fcf72ef1f9397bb112cac0e2f50.tar.gz
In 'trap' commands, prefer symbolic to numeric signal names.
Reported by Mike Fulton <fultonm@ca.ibm.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2022-11/msg00130.html>. * gnulib-tool: Use symbolic signal names. * posix-modules: Likewise. * MODULES.html.sh: Likewise. * build-aux/bootstrap (prepare_GNULIB_SRCDIR): Likewise. * build-aux/csharpcomp.sh.in: Likewise. * build-aux/gnu-web-doc-update: Likewise. * top/autogen.sh: Likewise. * top/bootstrap-funclib.sh: Likewise. * top/gitsub.sh: Likewise. * lib/t-idcache: Likewise. * tests/havelib/rpath-1: Likewise. * tests/havelib/rpath-2_a: Likewise. * tests/havelib/rpath-2_b: Likewise. * tests/havelib/rpath-3_a: Likewise. * tests/havelib/rpath-3_b: Likewise. * tests/init.sh: Likewise. * tests/test-binary-io.sh: Likewise. * tests/test-c-stack.sh: Likewise. * tests/test-c-stack2.sh: Likewise. * tests/test-dprintf-posix.sh: Likewise. * tests/test-fpending.sh: Likewise. * tests/test-fprintf-posix.sh: Likewise. * tests/test-lseek.sh: Likewise. * tests/test-printf-posix.sh: Likewise. * tests/test-select-in.sh: Likewise. * tests/test-select-out.sh: Likewise. * tests/test-sigpipe.sh: Likewise. * tests/test-tsearch.sh: Likewise. * tests/test-update-copyright.sh: Likewise. * tests/test-vdprintf-posix.sh: Likewise. * tests/test-vfprintf-posix.sh: Likewise. * tests/test-vprintf-posix.sh: Likewise. * tests/test-xprintf-posix.sh: Likewise. * tests/uniwidth/test-uc_width2.sh: Likewise.
Diffstat (limited to 'gnulib-tool')
-rwxr-xr-xgnulib-tool23
1 files changed, 12 insertions, 11 deletions
diff --git a/gnulib-tool b/gnulib-tool
index 028bcf36ad..b0126e711a 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -1693,15 +1693,15 @@ func_determine_path_separator
func_gnulib_dir
func_tmpdir
trap 'exit_status=$?
- if test "$signal" != 0; then
- echo "caught signal $signal" >&2
+ if test "$signal" != EXIT; then
+ echo "caught signal SIG$signal" >&2
fi
rm -rf "$tmp"
- exit $exit_status' 0
-for signal in 1 2 3 13 15; do
+ exit $exit_status' EXIT
+for signal in HUP INT QUIT PIPE TERM; do
trap '{ signal='$signal'; func_exit 1; }' $signal
done
-signal=0
+signal=EXIT
# Note: The 'eval' silences stderr output in dash.
if (declare -A x && { x[f/2]='foo'; x[f/3]='bar'; eval test '${x[f/2]}' = foo; }) 2>/dev/null; then
@@ -7676,12 +7676,13 @@ fi
rm -rf "$tmp"
# Undo the effect of the previous 'trap' command. Some shellology:
-# We cannot use "trap - 0 1 2 3 13 15", because Solaris sh would attempt to
-# execute the command "-". "trap '' ..." is fine only for signal 0 (= normal
-# exit); for the others we need to call 'exit' explicitly. The value of $? is
-# 128 + signal number and is set before the trap-registered command is run.
-trap '' 0
-trap 'func_exit $?' 1 2 3 13 15
+# We cannot use "trap - EXIT HUP INT QUIT PIPE TERM", because Solaris sh would
+# attempt to execute the command "-". "trap '' ..." is fine only for signal EXIT
+# (= normal exit); for the others we need to call 'exit' explicitly. The value
+# of $? is 128 + signal number and is set before the trap-registered command is
+# run.
+trap '' EXIT
+trap 'func_exit $?' HUP INT QUIT PIPE TERM
exit 0