[libfile-tee-perl] 01/06: Add patch to fix a race condition with the SIGINT handler.
gregor herrmann
gregoa at debian.org
Tue Jan 3 17:46:37 UTC 2017
This is an automated email from the git hooks/post-receive script.
gregoa pushed a commit to branch master
in repository libfile-tee-perl.
commit 9b3aeb41a943ee9fefb3bbed7eac9e5b1c946143
Author: gregor herrmann <gregoa at debian.org>
Date: Tue Jan 3 18:40:05 2017 +0100
Add patch to fix a race condition with the SIGINT handler.
Thanks: Niko Tyni for the patch.
Closes: #834912
---
...-a-race-condition-with-the-SIGINT-handler.patch | 58 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 59 insertions(+)
diff --git a/debian/patches/0002-Fix-a-race-condition-with-the-SIGINT-handler.patch b/debian/patches/0002-Fix-a-race-condition-with-the-SIGINT-handler.patch
new file mode 100644
index 0000000..8b430f3
--- /dev/null
+++ b/debian/patches/0002-Fix-a-race-condition-with-the-SIGINT-handler.patch
@@ -0,0 +1,58 @@
+From 8e896957bc0580b53f74152647265a5ea2cdbdf6 Mon Sep 17 00:00:00 2001
+From: Niko Tyni <ntyni at debian.org>
+Date: Tue, 3 Jan 2017 13:54:52 +0000
+Subject: [PATCH] Fix a race condition with the SIGINT handler
+
+The parent now waits until the child is ready before proceeding.
+
+This fixes sporadic test failures in t/File-Tee.t.
+
+Bug-Debian: https://bugs.debian.org/834912
+Bug: https://rt.cpan.org/Public/Bug/Display.html?id=101278
+---
+ lib/File/Tee.pm | 13 +++++++++++++
+ 1 file changed, 13 insertions(+)
+
+diff --git a/lib/File/Tee.pm b/lib/File/Tee.pm
+index caa4ae2..075a9f7 100644
+--- a/lib/File/Tee.pm
++++ b/lib/File/Tee.pm
+@@ -149,15 +149,23 @@ sub tee (*;@) {
+ $| = $oldstate[0];
+ select $oldsel;
+
++ my ($readp, $writep);
++ pipe ($readp, $writep)
++ or croak "Failed to make a pipe for synchronizing";
++
+ my $pid = open $fh, '|-';
+ unless ($pid) {
+ defined $pid
+ or return undef;
+
++ close $readp; # this end is not for us
++
+ $SIG{INT} = 'IGNORE';
+ undef @ARGV;
+ eval { $0 = "perl [File::Tee]" };
+
++ close $writep; # signal the parent we're ready
++
+ my $error = 0;
+
+ my $oldsel = select STDERR;
+@@ -252,6 +260,11 @@ sub tee (*;@) {
+
+ _exit($error);
+ }
++ close $writep; # this end is not for us
++
++ sysread($readp, my $buf, 256); # should block until the kid is ready
++ close $readp;
++
+ # close $teefh;
+
+ $oldsel = select($fh);
+--
+2.11.0
+
diff --git a/debian/patches/series b/debian/patches/series
index da5dfde..fca5927 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
0001-fixed-some-documentation-spelling-errors.patch
+0002-Fix-a-race-condition-with-the-SIGINT-handler.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libfile-tee-perl.git
More information about the Pkg-perl-cvs-commits
mailing list