Skip Menu |

This queue is for tickets about the IPC-Run3 CPAN distribution.

Report information
The Basics
Id: 46333
Status: open
Priority: 0/
Queue: IPC-Run3

People
Owner: Nobody in particular
Requestors: RBS [...] cpan.org
Cc: PLICEASE [...] cpan.org
AdminCc:

Bug Information
Severity: Critical
Broken in:
  • 0.005
  • 0.006
  • 0.007
  • 0.009
  • 0.01
  • 0.020
  • 0.030
  • 0.031
  • 0.032
  • 0.033
  • 0.034
  • 0.035
  • 0.036
  • 0.037
  • 0.038
  • 0.039
  • 0.040
  • 0.041
  • 0.042
Fixed in: (no value)



Subject: Croak if system() returns -1 or 0xFF00
On ActiveState perl 5.8.8[1] under Win32, system() seems to returns 0xFF00 when executing a bogus command, so this script: use IPC::Run3; print "ok\n" if run3 [ "not a valid command" ]; warn "\$?: $?\n"; prints: ok $?: 65280 The below patch (full patch attached) checks for system() returning 0xFF00 on Win32 (I assume it's platform-specific). I will apply this patch to 0.042 at some point if noone objects; however, I want to give others a chance to think about any issues this might cause before (possibly) breaking running code. The croak() part should definitely be added. The patch also uses croak() to give the user a more helpful location: - die $! if defined $r && $r == -1 && !$options->{return_if_system_error}; + if ( + defined $r + && ( $r == -1 || ( is_win32 && $r == 0xFF00 ) ) + && !$options->{return_if_system_error} + ) { + require Carp; + Carp::croak( $errno ); + } [1] perl -v: This is perl, v5.8.8 built for MSWin32-x86-multi-thread (with 18 registered patches, see perl -V for more detail) Copyright 1987-2007, Larry Wall Binary build 822 [280952] provided by ActiveState http://www.ActiveState.com Built Jul 31 2007 19:34:48 Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Subject: 0xFF00_and_croak.patch
--- c:\perl\site\lib\IPC\Run3.pm Sun May 24 16:10:58 2009 +++ lib\IPC\Run3.pm Sun May 24 16:43:24 2009 @@ -419,7 +419,14 @@ } } - die $! if defined $r && $r == -1 && !$options->{return_if_system_error}; + if ( + defined $r + && ( $r == -1 || ( is_win32 && $r == 0xFF00 ) ) + && !$options->{return_if_system_error} + ) { + require Carp; + Carp::croak( $errno ); + } 1; };
I'd like to request this being amended. I'm under ActivePerl 5.16.3 and the following system call gives me the return value 65280: perl -e "print system qw[perl -e BEGIN{die}];print qq[-$!-]" 65280-- This call is entirely valid, however $errno ends up empty. Worse, this breaks other modules by having IPC::Run3 unexpectedly die on perfectly fine calls, an example being Test::Script. A simple fix would be: - && ( $r == -1 || ( is_win32 && $r == 0xFF00 ) ) + && ( $r == -1 || ( is_win32 && $r == 0xFF00 && $errno ) )
On Wed Jul 02 16:34:53 2014, MITHALDU wrote: Show quoted text
> A simple fix would be: > > - && ( $r == -1 || ( is_win32 && $r == 0xFF00 ) ) > + && ( $r == -1 || ( is_win32 && $r == 0xFF00 && $errno ) )
I have created a PR here for this fix: https://github.com/rjbs/IPC-Run3/pull/9 Including a fix for one other edge case and a test that exercises the problem in MSWin32. Note that this was also reported as rt#95308