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