automake-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[automake-commit] 01/02: Improve test for blocked signals


From: Paul Eggert
Subject: [automake-commit] 01/02: Improve test for blocked signals
Date: Wed, 29 Mar 2023 15:50:00 -0400

eggert pushed a commit to branch master
in repository automake.

View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=62b3ff7b2c41b4a7e15f4677d7a9fb9c9f1d8360

commit 62b3ff7b2c41b4a7e15f4677d7a9fb9c9f1d8360
Author: Jacob Bachmeyer <jcb@gnu.org>
AuthorDate: Wed Feb 8 23:07:26 2023 -0600

    Improve test for blocked signals
    
    This fixes ERRORs reported by:
     * t/parallel-tests-interrupt.tap
     * t/self-check-exit.tap
     * t/self-check-is-blocked-signal.tap
     * t/tap-signal.tap
    
     * t/ax/am-test-lib.sh (is_blocked_signal): Revise Perl code
       to more closely follow documented interfaces where
       available.  This also works around bugs and limitations
       of the POSIX module in Perl 5.6.
    
    Copyright-paperwork-exempt: yes
---
 t/ax/am-test-lib.sh | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/t/ax/am-test-lib.sh b/t/ax/am-test-lib.sh
index bdf699889..bfa1d84b2 100644
--- a/t/ax/am-test-lib.sh
+++ b/t/ax/am-test-lib.sh
@@ -103,13 +103,14 @@ is_blocked_signal ()
   # Use perl, since trying to do this portably in the shell can be
   # very tricky, if not downright impossible.  For reference, see:
   # <https://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);
+  if $PERL -Mstrict -Mwarnings=FATAL,all -MPOSIX -Mconstant=SN,"$1" -e '
+    my $new = POSIX::SigAction->new(sub {});
+    my $old = POSIX::SigAction->new();
+    { no warnings q[uninitialized]; sigaction(SN, $new, $old) }
+    my $oldhandler;
+    if ($old->can(q[handler])) { $oldhandler = $old->handler }
+    else { $oldhandler = $old->{HANDLER} }
+    exit ($oldhandler eq "IGNORE" ? 0 : 77);
   '; then
     return 0
   elif test $? -eq 77; then



reply via email to

[Prev in Thread] Current Thread [Next in Thread]