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