Front page | perl.perl5.porters |
Postings from November 2003
[perl #24423] ignoring SIGCHLD corrupts system() return value
Thread Next
From:
perlbug-followup
Date:
November 5, 2003 21:46
Subject:
[perl #24423] ignoring SIGCHLD corrupts system() return value
Message ID:
rt-24423-67093.1.78304553529948@rt.perl.org
# New Ticket Created by dbarmann@brick.net
# Please include the string: [perl #24423]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt2/Ticket/Display.html?id=24423 >
This is a bug report for perl from dbarmann@brick.net,
generated with the help of perlbug 1.34 running under perl v5.8.0.
-----------------------------------------------------------------
[Please enter your report here]
It seems that in some environments (but not all), ignoring SIGCHLD
corrputs the return value of system().
For a discussion on PerlMonks, see this thread:
http://www.perlmonks.org/index.pl?node_id=304587
With assistance from those at PerlMonks, here are two programs that
illustrate the effect:
> ./prog1.pl
prog2.pl exited normally, returning 5
> ./prog1.pl ignore
prog2.pl was terminated with signal 127
--------- prog1.pl ----------
#!/usr/bin/perl
use POSIX;
if(@ARGV){ $SIG{'CHLD'} = 'IGNORE'; }
system('./prog2.pl');
$status=$?;
if(WIFEXITED($status)){
print "prog2.pl exited normally, returning ",
WEXITSTATUS($status), "\n";
}elsif(WIFSIGNALED($status)){
print "prog2.pl was terminated with signal ",
WTERMSIG($status), "\n";
}elsif(WIFSTOPPED($status)){
print "prog2.pl is stopped for signal ",
WSTOPSIG($status), "\n";
}else{
print "can't understand what happened to prog2.pl; ",
"status is ",$status,"\n";
}
--------- prog2.pl ----------
#!/usr/bin/perl
exit 5;
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
Site configuration information for perl v5.8.0:
Configured by bhcompile at Tue Feb 18 22:17:47 EST 2003.
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
Platform:
osname=linux, osvers=2.4.20-2.48smp, archname=i386-linux-thread-multi
uname='linux stripples.devel.redhat.com 2.4.20-2.48smp #1 smp thu feb 13 11:44:55 est 2003 i686 i686 i386 gnulinux '
config_args='-des -Doptimize=-O2 -march=i386 -mcpu=i686 -g -Dmyhostname=localhost -Dperladmin=root@localhost -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Dotherlibdirs=/usr/lib/perl5/5.8.0 -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
optimize='-O2 -march=i386 -mcpu=i686 -g',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm'
ccversion='', gccversion='3.2.2 20030213 (Red Hat Linux 8.0 3.2.2-1)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil
perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil
libc=/lib/libc-2.3.1.so, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.3.1'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
MAINT18379
---
@INC for perl v5.8.0:
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
.
---
Environment for perl v5.8.0:
HOME=/home/dbarmann
LANG=en_US
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/dbarmann/bin:/bin:/opt/java/j2sdk1.4.1_01/bin:/usr/bin:/sbin:/usr/sbin:/usr/X11R6/bin:/usr/games:/usr/local/bin:/opt/bin
PERLDOC_PAGER=less -R
PERL_BADLANG (unset)
SHELL=/bin/bash
Thread Next
-
[perl #24423] ignoring SIGCHLD corrupts system() return value
by perlbug-followup