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