[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix exit status of signal handlers in shell scripts
From: |
Bruno Haible |
Subject: |
Re: [PATCH] Fix exit status of signal handlers in shell scripts |
Date: |
Sun, 31 Jan 2010 01:22:34 +0100 |
User-agent: |
KMail/1.9.9 |
Here is part 2 of the proposed fixes.
2010-01-30 Bruno Haible <address@hidden>
Don't continue executing a test after catching a fatal signal.
* tests/test-atexit.sh (trap 1-15): After removing the temporary files,
exit with code 77.
* tests/test-binary-io.sh (trap 1-15): Likewise.
* tests/test-c-stack.sh (trap 1-15): Likewise.
* tests/test-c-stack2.sh (trap 1-15): Likewise.
* tests/test-closein.sh (trap 1-15): Likewise.
* tests/test-dprintf-posix.sh (trap 1-15): Likewise.
* tests/test-fpending.sh (trap 1-15): Likewise.
* tests/test-fprintf-posix.sh (trap 1-15): Likewise.
* tests/test-lseek.sh (trap 1-15): Likewise.
* tests/test-perror.sh (trap 1-15): Likewise.
* tests/test-printf-posix.sh (trap 1-15): Likewise.
* tests/test-select-in.sh (trap 1-15): Likewise.
* tests/test-select-out.sh (trap 1-15): Likewise.
* tests/test-sigpipe.sh (trap 1-15): Likewise.
* tests/test-tsearch.sh (trap 1-15): Likewise.
* tests/test-vdprintf-posix.sh (trap 1-15): Likewise.
* tests/test-vfprintf-posix.sh (trap 1-15): Likewise.
* tests/test-vprintf-posix.sh (trap 1-15): Likewise.
* tests/test-xprintf-posix.sh (trap 1-15): Likewise.
* tests/test-xstrtoimax.sh (trap 1-15): Likewise.
* tests/test-xstrtol.sh (trap 1-15): Likewise.
* tests/test-xstrtoumax.sh (trap 1-15): Likewise.
* tests/test-yesno.sh (trap 1-15): Likewise.
* tests/uniwidth/test-uc_width2.sh (trap 1-15): Likewise.
Reported by Dmitry V. Levin <address@hidden>.
--- tests/test-atexit.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-atexit.sh Sun Jan 31 01:11:00 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="$tmpfiles t-atexit.tmp"
# Check that an atexit handler is called when main() returns normally.
--- tests/test-binary-io.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-binary-io.sh Sun Jan 31 01:11:00 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="$tmpfiles t-bin-out1.tmp t-bin-out2.tmp"
./test-binary-io${EXEEXT} > t-bin-out1.tmp || exit 1
--- tests/test-c-stack.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-c-stack.sh Sun Jan 31 01:10:58 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="t-c-stack.tmp"
./test-c-stack${EXEEXT} 2> t-c-stack.tmp
--- tests/test-c-stack2.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-c-stack2.sh Sun Jan 31 01:11:00 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="t-c-stack2.tmp"
--- tests/test-closein.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-closein.sh Sun Jan 31 01:11:00 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
p=t-closein-
tmpfiles="${p}in.tmp ${p}xout.tmp ${p}out1.tmp ${p}out2.tmp"
--- tests/test-dprintf-posix.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-dprintf-posix.sh Sun Jan 31 01:10:59 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="$tmpfiles t-dprintf-posix.tmp t-dprintf-posix.out"
./test-dprintf-posix${EXEEXT} > t-dprintf-posix.tmp || exit 1
--- tests/test-fpending.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-fpending.sh Sun Jan 31 01:11:00 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfile=
-trap 'rm -fr $tmpfile' 1 2 3 15
+trap 'rm -fr $tmpfile; exit 77' 1 2 3 15
tmpfile=test-fpending.t
--- tests/test-fprintf-posix.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-fprintf-posix.sh Sun Jan 31 01:10:59 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="$tmpfiles t-fprintf-posix.tmp t-fprintf-posix.out"
./test-fprintf-posix${EXEEXT} > t-fprintf-posix.tmp || exit 1
--- tests/test-lseek.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-lseek.sh Sun Jan 31 01:11:00 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles=t-lseek.tmp
# seekable files
--- tests/test-perror.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-perror.sh Sun Jan 31 01:11:00 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
# Test NULL prefix. Result should not contain a number.
tmpfiles="$tmpfiles t-perror.tmp"
--- tests/test-printf-posix.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-printf-posix.sh Sun Jan 31 01:10:59 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="$tmpfiles t-printf-posix.tmp t-printf-posix.out"
./test-printf-posix${EXEEXT} > t-printf-posix.tmp || exit 1
--- tests/test-select-in.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-select-in.sh Sun Jan 31 01:10:58 2010
@@ -5,7 +5,7 @@
# of /dev/null.
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="$tmpfiles t-select-in.tmp"
--- tests/test-select-out.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-select-out.sh Sun Jan 31 01:11:00 2010
@@ -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; exit 77' 1 2 3 15
tmpfiles="$tmpfiles t-select-out.out t-select-out.tmp"
--- tests/test-sigpipe.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-sigpipe.sh Sun Jan 31 01:10:58 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
# Test signal's default behaviour.
tmpfiles="$tmpfiles t-sigpipeA.tmp"
--- tests/test-tsearch.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-tsearch.sh Sun Jan 31 01:11:00 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="$tmpfiles t-tsearch.out"
./test-tsearch${EXEEXT} > t-tsearch.out 2>&1
--- tests/test-vdprintf-posix.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-vdprintf-posix.sh Sun Jan 31 01:10:59 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="$tmpfiles t-vdprintf-posix.tmp t-vdprintf-posix.out"
./test-vdprintf-posix${EXEEXT} > t-vdprintf-posix.tmp || exit 1
--- tests/test-vfprintf-posix.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-vfprintf-posix.sh Sun Jan 31 01:11:00 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="$tmpfiles t-vfprintf-posix.tmp t-vfprintf-posix.out"
./test-vfprintf-posix${EXEEXT} > t-vfprintf-posix.tmp || exit 1
--- tests/test-vprintf-posix.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-vprintf-posix.sh Sun Jan 31 01:10:59 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="$tmpfiles t-vprintf-posix.tmp t-vprintf-posix.out"
./test-vprintf-posix${EXEEXT} > t-vprintf-posix.tmp || exit 1
--- tests/test-xprintf-posix.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-xprintf-posix.sh Sun Jan 31 01:10:59 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="$tmpfiles t-xprintf-posix.tmp t-xprintf-posix.out"
./test-xprintf-posix${EXEEXT} > t-xprintf-posix.tmp || exit 1
--- tests/test-xstrtoimax.sh.orig Sun Jan 31 01:16:22 2010
+++ tests/test-xstrtoimax.sh Sun Jan 31 01:10:59 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="t-xstrtoimax.tmp t-xstrtoimax.xo"
: > t-xstrtoimax.tmp
--- tests/test-xstrtol.sh.orig Sun Jan 31 01:16:23 2010
+++ tests/test-xstrtol.sh Sun Jan 31 01:10:59 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="t-xstrtol.tmp t-xstrtol.xo"
: > t-xstrtol.tmp
--- tests/test-xstrtoumax.sh.orig Sun Jan 31 01:16:23 2010
+++ tests/test-xstrtoumax.sh Sun Jan 31 01:10:59 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="t-xstrtoumax.tmp t-xstrtoumax.xo"
: > t-xstrtoumax.tmp
--- tests/test-yesno.sh.orig Sun Jan 31 01:16:23 2010
+++ tests/test-yesno.sh Sun Jan 31 01:10:59 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
p=t-yesno-
tmpfiles="${p}in.tmp ${p}xout.tmp ${p}out1.tmp ${p}out.tmp ${p}err.tmp"
--- tests/uniwidth/test-uc_width2.sh.orig Sun Jan 31 01:16:23 2010
+++ tests/uniwidth/test-uc_width2.sh Sun Jan 31 01:10:59 2010
@@ -1,7 +1,7 @@
#!/bin/sh
tmpfiles=""
-trap 'rm -fr $tmpfiles' 1 2 3 15
+trap 'rm -fr $tmpfiles; exit 77' 1 2 3 15
tmpfiles="$tmpfiles uc_width.out"
./test-uc_width2${EXEEXT} | LC_ALL=C tr -d '\r' > uc_width.out