683572
From 293a533c53d9c0fe939e23c439f4dfc47a5736dc Mon Sep 17 00:00:00 2001
683572
From: Tony Cook <tony@develop-help.com>
683572
Date: Tue, 25 Jun 2019 15:47:57 +1000
683572
Subject: [PATCH] (perl #122112) make sure SIGPIPE is delivered if we test it
683572
MIME-Version: 1.0
683572
Content-Type: text/plain; charset=UTF-8
683572
Content-Transfer-Encoding: 8bit
683572
683572
Signed-off-by: Petr Písař <ppisar@redhat.com>
683572
---
683572
 t/io/pipe.t | 12 ++++++++++++
683572
 1 file changed, 12 insertions(+)
683572
683572
diff --git a/t/io/pipe.t b/t/io/pipe.t
683572
index 9f5bb3bcf8..bdf743c26c 100644
683572
--- a/t/io/pipe.t
683572
+++ b/t/io/pipe.t
683572
@@ -125,6 +125,18 @@ wait;				# Collect from $pid
683572
 pipe(READER,WRITER) || die "Can't open pipe";
683572
 close READER;
683572
 
683572
+eval {
683572
+    # one platform at least appears to block SIGPIPE by default (see #122112)
683572
+    # so make sure it's unblocked.
683572
+    # The eval wrapper should ensure this does nothing if these aren't
683572
+    # implemented.
683572
+    require POSIX;
683572
+    my $mask = POSIX::SigSet->new(POSIX::SIGPIPE());
683572
+    my $old = POSIX::SigSet->new();
683572
+    POSIX::sigprocmask(POSIX::SIG_UNBLOCK(), $mask, $old);
683572
+    note "Yes, SIGPIPE was blocked" if $old->ismember(POSIX::SIGPIPE());
683572
+};
683572
+
683572
 $SIG{'PIPE'} = 'broken_pipe';
683572
 
683572
 sub broken_pipe {
683572
-- 
683572
2.20.1
683572