New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPC::Open3 Does Not Re-Throw Exceptions #9765
Comments
From @jawnsyThis is a bug report for perl from jonathan.i.yu@gmail.com, If using IPC::Open3 under taintmode, the taint exceptions thrown by Perl's To reproduce this bug, you'll first need to taint your ENV{PATH} - I'm not If you try a normal system() call, then as expected, you get an exception If you use code like this: use IPC::Open3 'open3'; my ($reader, $writer, $err); You can check the return code of the child ($?) and you will be able to If you continue, you can get the error from the STDOUT handle, rather print "Result: ", <$reader>, "\n"; Gives this message: Result: Insecure $ENV{PATH} while running with -T switch at I think it would be most helpful if an exception was thrown to the caller of I submitted this bug with medium priority because presumably other Perl Thanks for writing a great module and maintaining my favourite language's Flags: Site configuration information for perl 5.10.0: Configured by Debian Project at Sun May 3 21:50:46 UTC 2009. Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Locally applied patches: @INC for perl 5.10.0: Environment for perl 5.10.0: |
From @ikegamiOn Sat, Jun 13, 2009 at 4:23 PM, jonathan.i.yu@gmail.com (via RT) <
open3 throws an exception as a result, but it doesn't contain the message of I also uncovered another bug. The error message contains IO::Pipe as the Pardon the non-standard patch format and test format. I'm on borrowed time, Eric "ikegami" Brine |
From @ikegami |
From @ikegamipatch1_to_open3_pm.diff= unless (@errs) {
= $pid = eval { system 1, @_ }; # 1 == P_NOWAIT
- push @errs, "IO::Pipe: Can't spawn-NOWAIT: $!" if !$pid || $pid < 0;
+ push @errs, "Can't spawn-NOWAIT: $!" if !$pid || $pid < 0; # $Me will be prepended.
= }
|
From @ikegami |
From @ikegamipatch2_to_open3_pm.diff= unless (@errs) {
= $pid = eval { system 1, @_ }; # 1 == P_NOWAIT
- push @errs, "Can't spawn-NOWAIT: $!" if !$pid || $pid < 0;
+ push @errs, "Can't spawn-NOWAIT: $@" if !$pid; # $Me will be prepended.
+ push @errs, "Can't spawn-NOWAIT: $!" if $pid < 0; # $Me will be prepended.
= }
|
The RT System itself - Status changed from 'new' to 'open' |
From @jkeenanOn Mon Jun 15 09:25:53 2009, ikegami@adaelis.com wrote:
Eric, If you think these issues still merit consideration (there's been no Thank you very much. |
From @ikegamiOn Sun, Feb 24, 2013 at 5:42 PM, James E Keenan via RT <
Attached. |
From @ikegami0001-IPC-Open3-falsly-reports-some-errors-as-being-from-I.patchFrom 3e93382fadf6ae53bdd688ea6a706855b6c20a8b Mon Sep 17 00:00:00 2001
From: Eric Brine <ikegami@adaelis.com>
Date: Tue, 5 Mar 2013 15:10:48 -0500
Subject: [PATCH 1/3] IPC::Open3 falsly reports some errors as being from
IO::Pipe
---
ext/IPC-Open3/lib/IPC/Open3.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ext/IPC-Open3/lib/IPC/Open3.pm b/ext/IPC-Open3/lib/IPC/Open3.pm
index 29612af..a0df61f 100644
--- a/ext/IPC-Open3/lib/IPC/Open3.pm
+++ b/ext/IPC-Open3/lib/IPC/Open3.pm
@@ -402,7 +402,7 @@ sub spawn_with_handles {
} else {
$pid = eval { system 1, @_ }; # 1 == P_NOWAIT
}
- push @errs, "IO::Pipe: Can't spawn-NOWAIT: $!" if !$pid || $pid < 0;
+ push @errs, "Can't spawn-NOWAIT: $!" if !$pid || $pid < 0; # $Me will be prepended.
}
# Do this in reverse, so that STDERR is restored first:
--
1.7.9
|
From @ikegami0002-Removed-IPC-Open3-s-useless-dependency-on-IO-Pipe.patchFrom cbdcc6758ab3d141d3139e25b6cb0761a58f829d Mon Sep 17 00:00:00 2001
From: Eric Brine <ikegami@adaelis.com>
Date: Tue, 5 Mar 2013 15:13:35 -0500
Subject: [PATCH 2/3] Removed IPC::Open3's useless dependency on IO::Pipe
---
ext/IPC-Open3/lib/IPC/Open3.pm | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ext/IPC-Open3/lib/IPC/Open3.pm b/ext/IPC-Open3/lib/IPC/Open3.pm
index a0df61f..680345d 100644
--- a/ext/IPC-Open3/lib/IPC/Open3.pm
+++ b/ext/IPC-Open3/lib/IPC/Open3.pm
@@ -324,7 +324,6 @@ sub _open3 {
push @close, \*{$_->{parent}}, $_->{open_as};
}
}
- require IO::Pipe;
$kidpid = eval {
spawn_with_handles(\@handles, \@close, @_);
};
@@ -357,6 +356,7 @@ sub spawn_with_handles {
my $close_in_child = shift;
my ($fd, $pid, @saved_fh, $saved, %saved, @errs);
+ require IO::Handle;
foreach $fd (@$fds) {
$fd->{tmp_copy} = IO::Handle->new_from_fd($fd->{handle}, $fd->{mode});
$saved{fileno $fd->{handle}} = $fd->{tmp_copy} if $fd->{tmp_copy};
--
1.7.9
|
From @ikegami0003-IPC-Open3-s-open3-looked-for-error-messages-in-on-ex.patchFrom e833642c7645f637f609c99a8d7c79437aa45b9a Mon Sep 17 00:00:00 2001
From: Eric Brine <ikegami@adaelis.com>
Date: Tue, 5 Mar 2013 15:16:51 -0500
Subject: [PATCH 3/3] IPC::Open3's open3 looked for error messages in $! on
exception
---
ext/IPC-Open3/lib/IPC/Open3.pm | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/ext/IPC-Open3/lib/IPC/Open3.pm b/ext/IPC-Open3/lib/IPC/Open3.pm
index 680345d..de1ac06 100644
--- a/ext/IPC-Open3/lib/IPC/Open3.pm
+++ b/ext/IPC-Open3/lib/IPC/Open3.pm
@@ -402,7 +402,8 @@ sub spawn_with_handles {
} else {
$pid = eval { system 1, @_ }; # 1 == P_NOWAIT
}
- push @errs, "Can't spawn-NOWAIT: $!" if !$pid || $pid < 0; # $Me will be prepended.
+ push @errs, "Can't spawn-NOWAIT: $@" if !$pid; # $Me will be prepended.
+ push @errs, "Can't spawn-NOWAIT: $!" if $pid < 0; # $Me will be prepended.
}
# Do this in reverse, so that STDERR is restored first:
--
1.7.9
|
Migrated from rt.perl.org#66572 (status was 'open')
Searchable as RT66572$
The text was updated successfully, but these errors were encountered: