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, 'signaler.pl' -- 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 signaler.pl 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, pbrew.sh, 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 'pbrew.sh'. So that the attachments show up in the web interface to nntp, I'll post them inline as well. ##### $ cat signaler.pl #!/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 pbrew.sh #!/usr/bin/env sh # Assumes you have 'perlbrew' installed export SCRIPT='/tmp/signaler.pl' for v in `perlbrew list | grep -v blead | sed -e 's/\*/ /' | sed -e 's/ perl-//'`; do THISPERL="$PERLBREW_ROOT/perls/perl-${v}/bin/perl" 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|;' done ##### Thank you very much. Jim KeenanThread Previous