[perl-Tk] Fix t/fileevent2.t failure with /dev/null on stdin

Petr Pisar ppisar at fedoraproject.org
Mon Sep 15 08:27:37 UTC 2014


commit 191d83c0a2d1e82727b8b56f1518533e097b54bd
Author: Petr Písař <ppisar at redhat.com>
Date:   Mon Sep 15 10:20:27 2014 +0200

    Fix t/fileevent2.t failure with /dev/null on stdin

 ...e-pipe-instead-of-stdin-in-t-fileevent2.t.patch |   47 ++++++++++++++++++++
 perl-Tk.spec                                       |    6 +++
 2 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/Tk-804.032-Use-pipe-instead-of-stdin-in-t-fileevent2.t.patch b/Tk-804.032-Use-pipe-instead-of-stdin-in-t-fileevent2.t.patch
new file mode 100644
index 0000000..d729df7
--- /dev/null
+++ b/Tk-804.032-Use-pipe-instead-of-stdin-in-t-fileevent2.t.patch
@@ -0,0 +1,47 @@
+From 2ac8da8459e36d0a5479d9a86855ab3925ce8789 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Mon, 15 Sep 2014 10:14:11 +0200
+Subject: [PATCH] Use pipe instead of stdin in t/fileevent2.t
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+t/fileevent2.t fails if standard input is not a blocking descriptor
+without read events. E.g. /dev/null. This patch uses a private pipe
+instead of relying on stdin which can be anything.
+
+CPAN RT#98891
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ t/fileevent2.t | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/t/fileevent2.t b/t/fileevent2.t
+index 825ec31..ad22198 100755
+--- a/t/fileevent2.t
++++ b/t/fileevent2.t
+@@ -21,7 +21,7 @@ BEGIN {
+     }
+ }
+ 
+-plan tests => 1;
++plan tests => 2;
+ 
+ my @fh;
+ my $callback_called = 0;
+@@ -35,8 +35,10 @@ $mw->idletasks;
+ #
+ # tclUnixNotify.c used to do bit-handling for the select() mask
+ # itself, but this was broken for 64bit machines.
++my ($rpipe, $wpipe);
++ok(pipe($rpipe, $wpipe), 'create blocking descriptors');
+ for (1..100) {
+-    open my $dup, "<&", \*STDIN or die "Can't dup STDIN: $!";
++    open my $dup, "<&", $rpipe or die "Can't dup rpipe: $!";
+     push @fh, $dup;
+     $mw->fileevent($dup, "readable", sub { $callback_called++ });
+ }
+-- 
+1.9.3
+
diff --git a/perl-Tk.spec b/perl-Tk.spec
index 5c48b6f..081a226 100644
--- a/perl-Tk.spec
+++ b/perl-Tk.spec
@@ -28,6 +28,9 @@ Patch5:         Tk-804.032-test-case-for-Tk-MainWindow-Create-without-args.patch
 Patch6:         Tk-804.032-update-comment-about-freetype.h-location.patch
 # Fix race in tests
 Patch7:         Tk-804.032-fix-race-condition-in-errordialog.t.patch
+# Fix t/fileevent2.t failure with /dev/null on stdin, bug #1141117,
+# CPAN RT#98891
+Patch8:         Tk-804.032-Use-pipe-instead-of-stdin-in-t-fileevent2.t.patch
 
 
 # Versions before this have Unicode issues
@@ -150,6 +153,8 @@ chmod -x pod/Popup.pod Tixish/lib/Tk/balArrow.xbm
 %patch6 -p1
 # test race
 %patch7 -p1
+# t/fileevent2.t failure
+%patch8 -p1
 
 %build
 %{__perl} Makefile.PL INSTALLDIRS=vendor X11LIB=%{_libdir} XFT=1
@@ -202,6 +207,7 @@ find __demos/ -type f -exec chmod -x {} \;
 - Fix creating a window with perl 5.20 (bug #1141117)
 - Enable X11 tests
 - Specify all dependencies
+- Fix t/fileevent2.t failure with /dev/null on stdin (bug #1141117)
 
 * Tue Aug 26 2014 Jitka Plesnikova <jplesnik at redhat.com> - 804.032-3
 - Perl 5.20 rebuild



More information about the perl-devel mailing list