Skip Menu |

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

Report information
The Basics
Id: 45263
Status: resolved
Priority: 0/
Queue: IPC-Exe

People
Owner: glai [...] cpan.org
Requestors: sergstesh [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.005
Fixed in: 1.006



Subject: wrong constant intermediate exit code
I have trivially modified an example from http://search.cpan.org/~glai/IPC-Exe-1.005/lib/IPC/Exe.pm , the one under " Here is an elaborate example to pipe STDOUT of one process to the STDIN of another, consecutively: ". The command line was: /mnt/sdb8/sergei/QEMU/portable_perl/try_ipc_exe.pl -ltr and its screen output was: " Show quoted text
last_pipe> sort -nk1
in-between exit value: 16777215 8 read_in> -rwxr-xr-x 1 sergei users 517 2009-04-15 23:22 processor.pl 111 read_in> prw-r--r-- 1 sergei users 0 2009-04-15 23:22 my_fifo 443 read_in> -rw------- 1 sergei users 518 2009-04-15 23:22 processor.pl.bck 859 read_in> total 8 $exitval=0 at /mnt/sdb8/sergei/QEMU/portable_perl/try_ipc_exe.pl line 60, <STDIN> line 4. ". The problem is this: in-between exit value: 16777215 line. I believe the line should reflect the value supplied to 'exit' in this line of my script: exe qw(perl -we), 'while(<STDIN>){my $t = int(rand(1000));print "$t Show quoted text
read_in> $_"} exit(123)',
, however, the 16777215 value is the same regardless of what I supply to 'exit'. It stays the same even if 'exit(0)' is used. Perl is self-built 5.10.0, built with self-built gcc-4.3.3. The OS is 32 bits PC linux (SUSE 10.3): Linux amdam2 2.6.22.19-0.2-default #1 SMP 2008-12-18 10:17:03 +0100 i686 athlon i386 GNU/Linux . I have used this Perl executable for a number a weeks and haven't noticed anything unusual, so I do not think the problem is related to my build actions. My modifications are: 1) use strict; 2) giving a value to $program (/bin/ls); 3) a number of 'warn' statements here and there; 4) indentation.
Subject: try_ipc_exe.pl
#!/home/sergei/PERL-5.10.0/bin/perl -w use IPC::Exe qw(exe bg); use strict; $| = 1; my $program = '/bin/ls'; my @pids = &{ # redirect STDERR to STDOUT exe sub { "2>&1" }, $program, @ARGV, # 'perl' receives STDOUT of $program via STDIN exe sub { my ($pid) = &{ exe qw(perl -we), 'while(<STDIN>){my $t = int(rand(1000));print "$t read_in> $_"} exit(123)', }; # check if exe() was successful defined($pid) or die("Failed to fork process"); # handle exit value here warn "in-between exit value: " . ($? >> 8) . "\n"; # this is executed in child process # no need to return }, # 'sort' receives STDOUT of 'perl' exe qw(sort -nk1), # [perlsub] receives STDOUT of 'sort' exe sub { # find out command of previous pipe process # if @_ is empty list, previous process was a [perlsub] my ($prog, @args) = @_; print STDERR "last_pipe> $prog @args\n"; # output: "last_pipe> sort -n" # print sorted, 'perl' filtered, output of $program print while <STDIN>; # find out exit value of previous 'sort' pipe process close($IPC::Exe::PIPE); warn("Bad exit for: @_\n") if $?; return $?; }, }; # check if exe()'s were successful defined($pids[0]) && defined($pids[1]) && defined($pids[2]) or die("Failed to fork processes"); # obtain exit value of last process on pipeline my $exitval = pop(@pids) >> 8; warn "\$exitval=$exitval";
Subject: Re: [rt.cpan.org #45263] AutoReply: wrong constant intermediate exit code
Date: Thu, 23 Apr 2009 21:06:55 -0700 (PDT)
To: bug-IPC-Exe [...] rt.cpan.org
From: Sergei Steshenko <sergstesh [...] yahoo.com>
Actually, $? before shift is simply -1 - I have just checked this. --- On Thu, 4/23/09, Bugs in IPC-Exe via RT <bug-IPC-Exe@rt.cpan.org> wrote: Show quoted text
> From: Bugs in IPC-Exe via RT <bug-IPC-Exe@rt.cpan.org> > Subject: [rt.cpan.org #45263] AutoReply: wrong constant intermediate exit code > To: sergstesh@yahoo.com > Date: Thursday, April 23, 2009, 9:00 PM > > Greetings, > > This message has been automatically generated in response > to the > creation of a trouble ticket regarding: >     "wrong constant intermediate exit code", > > a summary of which appears below. > > There is no need to reply to this message right now.  > Your ticket has been > assigned an ID of [rt.cpan.org #45263].  Your ticket > is accessible > on the web at: > >     https://rt.cpan.org/Ticket/Display.html?id=45263 > > Please include the string: > >          [rt.cpan.org > #45263] > > in the subject line of all future correspondence about this > issue. To do so, > you may reply to this message. > >                 >         Thank you, >                 >         bug-IPC-Exe@rt.cpan.org > > ------------------------------------------------------------------------- > I have trivially modified an example from > > http://search.cpan.org/~glai/IPC-Exe-1.005/lib/IPC/Exe.pm > > , the one under > > " > Here is an elaborate example to pipe STDOUT of one process > to the STDIN > of another, consecutively: > ". > > The command line was: > > /mnt/sdb8/sergei/QEMU/portable_perl/try_ipc_exe.pl -ltr > > and its screen output was: > > "
> last_pipe> sort -nk1
> in-between exit value: 16777215 > 8 read_in> -rwxr-xr-x 1 sergei users 517 2009-04-15 > 23:22 processor.pl > 111 read_in> prw-r--r-- 1 sergei > users   0 2009-04-15 23:22 my_fifo > 443 read_in> -rw------- 1 sergei users 518 2009-04-15 > 23:22 processor.pl.bck > 859 read_in> total 8 > $exitval=0 at > /mnt/sdb8/sergei/QEMU/portable_perl/try_ipc_exe.pl line > 60, <STDIN> line 4. > ". > > The problem is this: > > in-between exit value: 16777215 > > line. > > I believe the line should reflect the value supplied to > 'exit' in this > line of my script: > > exe qw(perl -we), 'while(<STDIN>){my $t = > int(rand(1000));print "$t
> read_in> $_"} exit(123)',
> > , however, the 16777215 value is the same regardless of > what I supply to > 'exit'. It stays the same even if 'exit(0)' is used. > > Perl is self-built 5.10.0, built with self-built gcc-4.3.3. > The OS is 32 > bits PC linux (SUSE 10.3): > > Linux amdam2 2.6.22.19-0.2-default #1 SMP 2008-12-18 > 10:17:03 +0100 i686 > athlon i386 GNU/Linux > . > > I have used this Perl executable for a number a weeks and > haven't > noticed anything unusual, so I do not think the problem is > related to my > build actions. > > My modifications are: > > 1) use strict; > 2) giving a value to $program (/bin/ls); > 3) a number of 'warn' statements here and there; > 4) indentation. > >
I see the problem. Thanks for reporting the bug and trying IPC::Exe! I'll have it fixed in version 1.006. Stay tuned. -- Gerald On Fri Apr 24 00:00:05 2009, sergstesh wrote: Show quoted text
> I have trivially modified an example from > > http://search.cpan.org/~glai/IPC-Exe-1.005/lib/IPC/Exe.pm > > , the one under > > " > Here is an elaborate example to pipe STDOUT of one process to the STDIN > of another, consecutively: > ". > > The command line was: > > /mnt/sdb8/sergei/QEMU/portable_perl/try_ipc_exe.pl -ltr > > and its screen output was: > > "
> last_pipe> sort -nk1
> in-between exit value: 16777215 > 8 read_in> -rwxr-xr-x 1 sergei users 517 2009-04-15 23:22 processor.pl > 111 read_in> prw-r--r-- 1 sergei users 0 2009-04-15 23:22 my_fifo > 443 read_in> -rw------- 1 sergei users 518 2009-04-15 23:22
processor.pl.bck Show quoted text
> 859 read_in> total 8 > $exitval=0 at /mnt/sdb8/sergei/QEMU/portable_perl/try_ipc_exe.pl line > 60, <STDIN> line 4. > ". > > The problem is this: > > in-between exit value: 16777215 > > line. > > I believe the line should reflect the value supplied to 'exit' in this > line of my script: > > exe qw(perl -we), 'while(<STDIN>){my $t = int(rand(1000));print "$t
> read_in> $_"} exit(123)',
> > , however, the 16777215 value is the same regardless of what I supply to > 'exit'. It stays the same even if 'exit(0)' is used. > > Perl is self-built 5.10.0, built with self-built gcc-4.3.3. The OS is 32 > bits PC linux (SUSE 10.3): > > Linux amdam2 2.6.22.19-0.2-default #1 SMP 2008-12-18 10:17:03 +0100 i686 > athlon i386 GNU/Linux > . > > I have used this Perl executable for a number a weeks and haven't > noticed anything unusual, so I do not think the problem is related to my > build actions. > > My modifications are: > > 1) use strict; > 2) giving a value to $program (/bin/ls); > 3) a number of 'warn' statements here and there; > 4) indentation.
This is fixed in v1.006