Prevent tests from dying on SIGPIPE

Tests randomly fail with bad plan because TCP server receives SIGPIPE.
Reported in
<https://rt.cpan.org/Public/Bug/Display.html?id=126899#txn-1810152>,
I can reproduce it with "while (prove -l); do :; done". Koschei also
spotted it <https://apps.fedoraproject.org/koschei/build/5430532>.
Upstream fix is applied.
This commit is contained in:
Petr Písař 2018-09-24 13:30:26 +02:00
parent 948f20ded6
commit 4f1fe6009e
2 changed files with 131 additions and 1 deletions

View File

@ -0,0 +1,121 @@
From e96b1c9e394011de4ee181cfa42b8021796bf7d4 Mon Sep 17 00:00:00 2001
From: Steffen Ullrich <Steffen_Ullrich@genua.de>
Date: Mon, 17 Sep 2018 14:09:48 +0200
Subject: [PATCH] make all tests which use fork also ignore signal PIPE
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
t/nonblock.t | 4 +---
t/protocol_version.t | 2 --
t/session_ticket.t | 2 --
t/signal-readline.t | 1 -
t/sni.t | 2 --
t/sni_verify.t | 2 --
t/testlib.pl | 2 ++
7 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/t/nonblock.t b/t/nonblock.t
index 6c1bc38..ad62799 100644
--- a/t/nonblock.t
+++ b/t/nonblock.t
@@ -9,7 +9,7 @@ use Net::SSLeay;
use Socket;
use IO::Socket::SSL;
use IO::Select;
-use Errno qw( EWOULDBLOCK EAGAIN EINPROGRESS EPIPE ECONNRESET );
+use Errno qw( EWOULDBLOCK EAGAIN EINPROGRESS);
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";
if ( ! eval "use 5.006; use IO::Select; return 1" ) {
@@ -17,8 +17,6 @@ if ( ! eval "use 5.006; use IO::Select; return 1" ) {
exit;
}
-$SIG{PIPE} = 'IGNORE'; # use EPIPE not signal handler
-
$|=1;
print "1..27\n";
diff --git a/t/protocol_version.t b/t/protocol_version.t
index 2e5cc6f..3577720 100644
--- a/t/protocol_version.t
+++ b/t/protocol_version.t
@@ -7,8 +7,6 @@ use Socket;
use IO::Socket::SSL;
do './testlib.pl' || do './t/testlib.pl' || die "no testlib";
-$SIG{PIPE} = 'IGNORE';
-
plan skip_all => "Test::More has no done_testing"
if !defined &done_testing;
diff --git a/t/session_ticket.t b/t/session_ticket.t
index ca70b80..4071b8a 100644
--- a/t/session_ticket.t
+++ b/t/session_ticket.t
@@ -27,8 +27,6 @@ my ($server_cert,$server_key) = CERT_create(
purpose => { server => 1 }
);
-$SIG{PIPE} = 'IGNORE';
-
# create two servers with the same session ticket callback
my (@server,@saddr);
for (1,2) {
diff --git a/t/signal-readline.t b/t/signal-readline.t
index 6dcd4ae..3e226c0 100644
--- a/t/signal-readline.t
+++ b/t/signal-readline.t
@@ -50,7 +50,6 @@ if ( $pid == 0 ) {
my $csock = $server->accept;
ok("accept");
-$SIG{PIPE} = 'IGNORE';
syswrite($csock,"foo") or print "not ";
ok("wrote foo");
diff --git a/t/sni.t b/t/sni.t
index c6e6510..de0f06e 100644
--- a/t/sni.t
+++ b/t/sni.t
@@ -17,8 +17,6 @@ if ( ! IO::Socket::SSL->can_client_sni() ) {
exit;
}
-$SIG{PIPE} = 'IGNORE';
-
print "1..17\n";
my $server = IO::Socket::SSL->new(
LocalAddr => '127.0.0.1',
diff --git a/t/sni_verify.t b/t/sni_verify.t
index 86b5dca..b3b299b 100644
--- a/t/sni_verify.t
+++ b/t/sni_verify.t
@@ -17,8 +17,6 @@ if ( ! IO::Socket::SSL->can_client_sni() ) {
exit;
}
-$SIG{PIPE} = 'IGNORE';
-
print "1..17\n";
my $server = IO::Socket::SSL->new(
LocalAddr => '127.0.0.1',
diff --git a/t/testlib.pl b/t/testlib.pl
index 5a99e49..b3f342c 100644
--- a/t/testlib.pl
+++ b/t/testlib.pl
@@ -19,6 +19,8 @@ unless ( $Config::Config{d_fork} || $Config::Config{d_pseudofork} ||
exit
}
+# let IO errors result in EPIPE instead of crashing the test
+$SIG{PIPE} = 'IGNORE';
# small implementations if not used from Test::More (09_fdleak.t)
if ( ! defined &ok ) {
--
2.17.1

View File

@ -1,12 +1,15 @@
Name: perl-IO-Socket-SSL Name: perl-IO-Socket-SSL
Version: 2.060 Version: 2.060
Release: 1%{?dist} Release: 2%{?dist}
Summary: Perl library for transparent SSL Summary: Perl library for transparent SSL
License: GPL+ or Artistic License: GPL+ or Artistic
URL: https://metacpan.org/release/IO-Socket-SSL URL: https://metacpan.org/release/IO-Socket-SSL
Source0: https://cpan.metacpan.org/modules/by-module/IO/IO-Socket-SSL-%{version}.tar.gz Source0: https://cpan.metacpan.org/modules/by-module/IO/IO-Socket-SSL-%{version}.tar.gz
Patch0: IO-Socket-SSL-2.060-use-system-default-cipher-list.patch Patch0: IO-Socket-SSL-2.060-use-system-default-cipher-list.patch
Patch1: IO-Socket-SSL-2.060-use-system-default-SSL-version.patch Patch1: IO-Socket-SSL-2.060-use-system-default-SSL-version.patch
# Prevent tests from dying on SIGPIPE, CPAN RT#126899,
# in upstream after 2.060
Patch2: IO-Socket-SSL-2.060-make-all-tests-which-use-fork-also-ignore-signal-PIP.patch
BuildArch: noarch BuildArch: noarch
# Module Build # Module Build
BuildRequires: coreutils BuildRequires: coreutils
@ -86,6 +89,9 @@ mod_perl.
# Use system-default SSL version too # Use system-default SSL version too
%patch1 %patch1
# Prevent tests from dying on SIGPIPE (CPAN RT#126899)
%patch2 -p1
%build %build
NO_NETWORK_TESTING=1 perl Makefile.PL INSTALLDIRS=vendor NO_NETWORK_TESTING=1 perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags} make %{?_smp_mflags}
@ -111,6 +117,9 @@ make test
%{_mandir}/man3/IO::Socket::SSL::Utils.3* %{_mandir}/man3/IO::Socket::SSL::Utils.3*
%changelog %changelog
* Mon Sep 24 2018 Petr Pisar <ppisar@redhat.com> - 2.060-2
- Prevent tests from dying on SIGPIPE (CPAN RT#126899)
* Mon Sep 17 2018 Paul Howarth <paul@city-fan.org> - 2.060-1 * Mon Sep 17 2018 Paul Howarth <paul@city-fan.org> - 2.060-1
- Update to 2.060 - Update to 2.060
- Support for TLS 1.3 with OpenSSL 1.1.1 (needs support in Net::SSLeay too); - Support for TLS 1.3 with OpenSSL 1.1.1 (needs support in Net::SSLeay too);