Discussion:
[perl.git] branch blead, updated. v5.21.1-8-g04e0f0c
(too old to reply)
James Keenan
2014-06-21 10:40:10 UTC
Permalink
In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/04e0f0c28a521a290f29301e7b2abe43d65a5339?hp=c5aea1955a29bc7e8ef53eb3dd271fdacff597f3>

- Log -----------------------------------------------------------------
commit 04e0f0c28a521a290f29301e7b2abe43d65a5339
Author: Dmitri Tikhonov <***@cpan.org>
Date: Sat Jun 7 00:23:50 2014 -0400

Untie STDERR in IPC::Open3.

Add Dmitri Tikhonov to Perl 5 AUTHORS.
Increment IPC/Open3.pm $VERSION.

For: RT #119843, originally reported by A.N.
-----------------------------------------------------------------------

Summary of changes:
AUTHORS | 1 +
ext/IPC-Open3/lib/IPC/Open3.pm | 3 ++-
ext/IPC-Open3/t/IPC-Open3.t | 29 ++++++++++++++++++++++++++++-
3 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 4740185..177e64d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -336,6 +336,7 @@ Devin Heitmueller <***@gmail.com>
DH <***@yahoo.com>
Diab Jerius <***@head-cfa.harvard.edu>
dLux <***@spam.sch.bme.hu>
+Dmitri Tikhonov <***@cpan.org>
Dmitry Karasik <***@tetsuo.karasik.eu.org>
Dominic Dunlop <***@computer.org>
Dominic Hargreaves <***@earth.li>
diff --git a/ext/IPC-Open3/lib/IPC/Open3.pm b/ext/IPC-Open3/lib/IPC/Open3.pm
index c8620b7..99f120b 100644
--- a/ext/IPC-Open3/lib/IPC/Open3.pm
+++ b/ext/IPC-Open3/lib/IPC/Open3.pm
@@ -9,7 +9,7 @@ require Exporter;
use Carp;
use Symbol qw(gensym qualify);

-$VERSION = '1.16';
+$VERSION = '1.17';
@ISA = qw(Exporter);
@EXPORT = qw(open3);

@@ -246,6 +246,7 @@ sub _open3 {
# A tie in the parent should not be allowed to cause problems.
untie *STDIN;
untie *STDOUT;
+ untie *STDERR;

close $stat_r;
require Fcntl;
diff --git a/ext/IPC-Open3/t/IPC-Open3.t b/ext/IPC-Open3/t/IPC-Open3.t
index 6ab519d..05aeb4a 100644
--- a/ext/IPC-Open3/t/IPC-Open3.t
+++ b/ext/IPC-Open3/t/IPC-Open3.t
@@ -14,7 +14,7 @@ BEGIN {
}

use strict;
-use Test::More tests => 38;
+use Test::More tests => 44;

use IO::Handle;
use IPC::Open3;
@@ -187,3 +187,30 @@ foreach my $handle (qw (DUMMY STDIN STDOUT STDERR)) {
}
waitpid $pid, 0;
}
+
+# Test that tied STDIN, STDOUT, and STDERR do not cause open3 any discomfort.
+# In particular, tied STDERR used to be able to prevent open3 from working
+# correctly. RT #119843.
+{
+ { # This just throws things out
+ package My::Tied::FH;
+ sub TIEHANDLE { bless \my $self }
+ sub PRINT {}
+ # Note the absence of OPEN and FILENO
+ }
+ my $message = "japh\n";
+ foreach my $handle (*STDIN, *STDOUT, *STDERR) {
+ tie $handle, 'My::Tied::FH';
+ my ($in, $out);
+ my $pid = eval {
+ open3 $in, $out, undef, $perl, '-ne', 'print';
+ };
+ is($@, '', "no errors calling open3 with tied $handle");
+ print $in $message;
+ close $in;
+ my $japh = <$out>;
+ waitpid $pid, 0;
+ is($japh, $message, "read input correctly");
+ untie $handle;
+ }
+}

--
Perl5 Master Repository
Steve Hay
2014-06-21 12:10:38 UTC
Permalink
Post by James Keenan
In perl.git, the branch blead has been updated
<http://perl5.git.perl.org/perl.git/commitdiff/04e0f0c28a521a290f29301e7b2abe43d65a5339?hp=c5aea1955a29bc7e8ef53eb3dd271fdacff597f3>
- Log -----------------------------------------------------------------
commit 04e0f0c28a521a290f29301e7b2abe43d65a5339
Date: Sat Jun 7 00:23:50 2014 -0400
Untie STDERR in IPC::Open3.
Add Dmitri Tikhonov to Perl 5 AUTHORS.
Increment IPC/Open3.pm $VERSION.
For: RT #119843, originally reported by A.N.
-----------------------------------------------------------------------
The new tests are failing (every time, not intermittently) on Windows:

[...]
ok 35 - Expected no output with localised STDOUT
ok 36 - No errors with localised STDERR
ok 37 - Got a pid with localised STDERR
ok 38 - Expected output with localised STDERR

not ok 39 - no errors calling open3 with tied *main::STDIN# Failed
test 'no errors calling open3 with tied *main::STDIN'

# at t/IPC-Open3.t line 208.
# got: 'open3: Can't locate object method "FILENO" via
package "My::Tied::FH" at ../../lib/IPC/Open3.pm line 369.
# '
# expected: ''
Use of uninitialized value $pid in waitpid at t/IPC-Open3.t line 212.
# Looks like you planned 44 tests but ran 39.
# Looks like you failed 1 test of 39 run.
# Looks like your test exited with 255 just after 39.
Dubious, test returned 255 (wstat 65280, 0xff00)
Failed 6/44 subtests
(less 1 skipped subtest: 37 okay)

Loading...