1
0
mirror of https://https.git.savannah.gnu.org/git/gnulib.git synced 2026-09-01 02:34:55 +00:00

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.
This commit is contained in:
Bruno Haible
2022-11-26 15:25:44 +01:00
parent 6ec9bc7368
commit 835b3ea801
35 changed files with 101 additions and 60 deletions
+40
View File
@@ -1,3 +1,43 @@
2022-11-25 Bruno Haible <bruno@clisp.org>
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.
2022-11-20 Bruno Haible <bruno@clisp.org>
posix_spawn-internal: Avoid warning on macOS.
+7 -7
View File
@@ -3627,15 +3627,15 @@ func_all_modules ()
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
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">'
func_begin HTML
@@ -3736,8 +3736,8 @@ func_end HTML
rm -rf "$tmp"
# Undo the effect of the previous 'trap' command.
trap '' 0
trap 'func_exit $?' 1 2 3 13 15
trap '' EXIT
trap 'func_exit $?' HUP INT QUIT PIPE TERM
exit 0
+2 -2
View File
@@ -540,7 +540,7 @@ prepare_GNULIB_SRCDIR ()
elif [ ! -d "$gnulib_path" ]; then
echo "$0: getting gnulib files..."
trap cleanup_gnulib 1 2 13 15
trap cleanup_gnulib HUP INT PIPE TERM
shallow=
if test -z "$GNULIB_REVISION"; then
@@ -570,7 +570,7 @@ prepare_GNULIB_SRCDIR ()
git -C "$gnulib_path" reset --hard FETCH_HEAD
fi
trap - 1 2 13 15
trap - HUP INT PIPE TERM
fi
fi
GNULIB_SRCDIR=$gnulib_path
+1 -1
View File
@@ -127,7 +127,7 @@ if test -n "@HAVE_MCS@"; then
/^Compilation succeeded/d
}'
func_tmpdir
trap 'rm -rf "$tmp"' 1 2 3 15
trap 'rm -rf "$tmp"' HUP INT QUIT TERM
test -z "$CSHARP_VERBOSE" || echo mcs $options_mcs $sources
mcs $options_mcs $sources > "$tmp"/mcs.err
result=$?
+2 -2
View File
@@ -153,8 +153,8 @@ cleanup()
$GIT branch -d $tmp_branch
exit $__st
}
trap cleanup 0
trap 'exit $?' 1 2 13 15
trap cleanup EXIT
trap 'exit $?' HUP INT PIPE TERM
# We must build using sources for which --version reports the
# just-released version number, not some string like 7.6.18-20761.
+12 -11
View File
@@ -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
+2 -2
View File
@@ -4,8 +4,8 @@
pwd=`pwd`
t0=`echo "$0"|sed 's,.*/,,'`.tmp; tmp=$t0/$$
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' 0
trap '(exit $?); exit $?' 1 2 13 15
trap 'status=$?; cd "$pwd" && chmod -R u+rwx $t0 && rm -rf $t0 && exit $status' EXIT
trap '(exit $?); exit $?' HUP INT PIPE TERM
srcdir=../..
framework_failure=0
+5 -5
View File
@@ -263,15 +263,15 @@ done
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
(
# Get the header modules.
+1 -1
View File
@@ -1,7 +1,7 @@
# Common portion of all rpath-1* tests.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
builddir=`pwd`
global_top_auxdir=`cd "$top_srcdir"/build-aux && pwd`
+1 -1
View File
@@ -1,7 +1,7 @@
# Common portion of all rpath-2?a? tests.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
builddir=`pwd`
global_top_auxdir=`cd "$top_srcdir"/build-aux && pwd`
+1 -1
View File
@@ -1,7 +1,7 @@
# Common portion of all rpath-2?b? tests.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
builddir=`pwd`
global_top_auxdir=`cd "$top_srcdir"/build-aux && pwd`
+1 -1
View File
@@ -1,7 +1,7 @@
# Common portion of all rpath-3?a? tests.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
builddir=`pwd`
global_top_auxdir=`cd "$top_srcdir"/build-aux && pwd`
+1 -1
View File
@@ -1,7 +1,7 @@
# Common portion of all rpath-3?b? tests.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
builddir=`pwd`
global_top_auxdir=`cd "$top_srcdir"/build-aux && pwd`
+1 -1
View File
@@ -702,4 +702,4 @@ test -f "$srcdir/init.cfg" \
setup_ "$@"
# This trap is here, rather than in the setup_ function, because some
# shells run the exit trap at shell function exit, rather than script exit.
trap remove_tmp_ 0
trap remove_tmp_ EXIT
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles t-bin-out0.tmp t-bin-out1.tmp"
${CHECKER} ./test-binary-io${EXEEXT} 1 > t-bin-out1.tmp || exit 1
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="t-c-stack.tmp"
${CHECKER} ./test-c-stack${EXEEXT} 2> t-c-stack.tmp
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="t-c-stack2.tmp"
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles t-dprintf-posix.tmp t-dprintf-posix.out"
${CHECKER} ./test-dprintf-posix${EXEEXT} > t-dprintf-posix.tmp || exit 1
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfile=
trap 'rm -fr $tmpfile' 1 2 3 15
trap 'rm -fr $tmpfile' HUP INT QUIT TERM
tmpfile=test-fpending.t
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles t-fprintf-posix.tmp t-fprintf-posix.out"
${CHECKER} ./test-fprintf-posix${EXEEXT} > t-fprintf-posix.tmp || exit 1
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles=t-lseek.tmp
# seekable files
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles t-printf-posix.tmp t-printf-posix.out"
${CHECKER} ./test-printf-posix${EXEEXT} > t-printf-posix.tmp || exit 1
+1 -1
View File
@@ -5,7 +5,7 @@
# of /dev/null.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles t-select-in.tmp"
+1 -1
View File
@@ -2,7 +2,7 @@
# Test select() on file descriptors opened for writing.
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles t-select-out.out t-select-out.tmp"
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
# Test signal's default behaviour.
tmpfiles="$tmpfiles t-sigpipeA.tmp"
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles t-tsearch.out"
${CHECKER} ./test-tsearch${EXEEXT} > t-tsearch.out 2>&1
+1 -1
View File
@@ -28,7 +28,7 @@ PATH=$abs_aux_dir:$PATH
export PATH
TMP_BASE=update-copyright.test
trap 'rm -f $TMP_BASE*' 0 1 2 3 15
trap 'rm -f $TMP_BASE*' EXIT HUP INT QUIT TERM
## --------------------------------- ##
## Skip if user does not have perl. ##
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles t-vdprintf-posix.tmp t-vdprintf-posix.out"
${CHECKER} ./test-vdprintf-posix${EXEEXT} > t-vdprintf-posix.tmp || exit 1
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles t-vfprintf-posix.tmp t-vfprintf-posix.out"
${CHECKER} ./test-vfprintf-posix${EXEEXT} > t-vfprintf-posix.tmp || exit 1
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles t-vprintf-posix.tmp t-vprintf-posix.out"
${CHECKER} ./test-vprintf-posix${EXEEXT} > t-vprintf-posix.tmp || exit 1
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles t-xprintf-posix.tmp t-xprintf-posix.out"
${CHECKER} ./test-xprintf-posix${EXEEXT} > t-xprintf-posix.tmp || exit 1
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15
trap 'rm -fr $tmpfiles' HUP INT QUIT TERM
tmpfiles="$tmpfiles uc_width.out"
${CHECKER} ./test-uc_width2${EXEEXT} | LC_ALL=C tr -d '\r' > uc_width.out
+2 -2
View File
@@ -305,7 +305,7 @@ grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
if test $with_gettext = yes || test $use_libtool = 1; then
tempbase=.bootstrap$$
trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15
trap "rm -f $tempbase.0 $tempbase.1" HUP INT PIPE TERM
> $tempbase.0 > $tempbase.1 &&
find . ! -type d -print | sort > $tempbase.0 || exit
@@ -348,7 +348,7 @@ if test $with_gettext = yes || test $use_libtool = 1; then
IFS=$old_IFS
rm -f $tempbase.0 $tempbase.1
trap - 1 2 13 15
trap - HUP INT PIPE TERM
fi
# Import from gnulib.
+2 -2
View File
@@ -501,7 +501,7 @@ prepare_GNULIB_SRCDIR ()
elif [ ! -d "$gnulib_path" ]; then
echo "$0: getting gnulib files..."
trap cleanup_gnulib 1 2 13 15
trap cleanup_gnulib HUP INT PIPE TERM
shallow=
if test -z "$GNULIB_REVISION"; then
@@ -531,7 +531,7 @@ prepare_GNULIB_SRCDIR ()
git -C "$gnulib_path" reset --hard FETCH_HEAD
fi
trap - 1 2 13 15
trap - HUP INT PIPE TERM
fi
fi
GNULIB_SRCDIR=$gnulib_path
+2 -2
View File
@@ -354,9 +354,9 @@ func_pull ()
fi
else
# The subdir does not yet exist. Create a plain checkout.
trap func_cleanup_current_git_clone 1 2 13 15
trap func_cleanup_current_git_clone HUP INT PIPE TERM
git clone $2 "$url" "$path" || func_cleanup_current_git_clone
trap - 1 2 13 15
trap - HUP INT PIPE TERM
fi
;;
esac