* tests/defs (is_blocked_signal): Use perl to determine whether a signal is trapped, since trying to do it portably within the shell means opening a nasty can of worms.
For more information and background, see: <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html> <http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/004121.html> <http://www.cons.org/cracauer/sigint.html> --- ChangeLog | 11 +++++++++++ tests/defs | 18 +++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9b98bfd..cbc6693 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-09-13 Stefano Lattarini <stefano.lattar...@gmail.com> + + test defs: work around weird ksh behaviour w.r.t. signal handling + * tests/defs (is_blocked_signal): Use perl to determine whether a + signal is trapped, since trying to do it portably within the shell + means opening a nasty can of worms. + For more information and background, see: + <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html> + <http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/004121.html> + <http://www.cons.org/cracauer/sigint.html> + 2011-09-12 Stefano Lattarini <stefano.lattar...@gmail.com> tests: remove redundant line from a test script diff --git a/tests/defs b/tests/defs index cbeccb9..9fed42e 100644 --- a/tests/defs +++ b/tests/defs @@ -247,7 +247,23 @@ is_newest () # return a non-zero exit status and print a proper diagnostic otherwise. is_blocked_signal () { - $SHELL -c "kill -$1 \$\$; echo '$me: signal $1 seems blocked'" + # Use perl, since trying to do this portably in the shell can be + # very tricky, if not downright impossible. For reference, see: + # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html> + if $PERL -w -e ' + use strict; + use warnings FATAL => "all"; + use POSIX; + my %oldsigaction = (); + sigaction('"$1"', 0, \%oldsigaction); + exit ($oldsigaction{"HANDLER"} eq "IGNORE" ? 0 : 77); + '; then + return 0 + elif test $? -eq 77; then + return 1 + else + fatal_ "couldn't determine whether signal $1 is blocked" + fi } # AUTOMAKE_run [-e STATUS] [-d DESCRIPTION] [--] [AUTOMAKE-ARGS...] -- 1.7.2.3