develooper Front page | perl.perl5.porters | Postings from January 2020

Re: 'system' anomaly in perl-5.8.9

Thread Previous
James E Keenan
January 26, 2020 03:42
Re: 'system' anomaly in perl-5.8.9
Message ID:
On 1/25/20 10:23 PM, James E Keenan wrote:
> I am trying to understand an anomaly in a usage of 'system' observed in 
> perl-5.8.9 -- but not in (most? all?) other production releases of perl.
> Given: the attached program, '' -- which I'll place in '/tmp' 
> for convenience but which derives from CPAN distribution 
> IPC-System-Simple's test suite;
> Given: a variety of different installed perl executables, including at 
> least 5.8.9 -- for convenience I'll use my executables installed via 
> 'perlbrew';
> Then, running via a 'system' call from each of the 
> executables results in a value of '$?' of '134' for all versions except 
> 5.8.9, where the value of '$?' is '6'.
> I know that this is so on Linux, but I can't rule out its happening on 
> other OSes.
> The attached shell script,, can be used to demonstrate the 
> problem (assuming you have 'perlbrew' installed and have installed 
> several versions of perl thereby).  When I run this script, these are my 
> results:

Attaching a cleaner version of ''.

So that the attachments show up in the web interface to nntp, I'll post 
them inline as well.

$ cat
#!/usr/bin/perl -w
use strict;
use warnings;

# This program always zaps itself with the signal specified.  Perfect
# for testing.  ;)

my $signal_number = shift(@ARGV) || 0;

kill($signal_number, $$);

exit(1);	# Exit failure if the signal wasn't very scary.
$ cat
#!/usr/bin/env sh
# Assumes you have 'perlbrew' installed
export SCRIPT='/tmp/'
for v in `perlbrew list | grep -v blead | sed -e 's/\*/ /' | sed -e 's/ 
        export V=${v}
        $THISPERL -MConfig -e '$command = $^X; @args = ( $ENV{SCRIPT}, 6 
); CORE::system $command, @args; printf qq|%-16s%-10s:  %3d\n| => 
qq|perl-$ENV{V}|, qq|$ENV{SCRIPT}|, qq|$?\n|;'

Thank you very much.
Jim Keenan

Thread Previous Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About