develooper Front page | perl.perl5.porters | Postings from August 2005

[perl #36976] system() always returns -1 in forked child with SIG{CHLD}='IGNORE' in parent

Thread Previous | Thread Next
From:
Chris
Date:
August 22, 2005 08:42
Subject:
[perl #36976] system() always returns -1 in forked child with SIG{CHLD}='IGNORE' in parent
Message ID:
rt-3.0.11-36976-119814.15.432495000246@perl.org
# New Ticket Created by  Chris 
# Please include the string:  [perl #36976]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=36976 >


This is a bug report for perl from hutchinson.chris@gmail.com
generated with the help of perlbug 1.35 running under perl v5.8.7.


-----------------------------------------------------------------
[Please enter your report here]

Calls to system() in a forked child always return -1 if the parent has
set SIG{CHLD}='IGNORE'. I would expect/hope it to return 0.

Demonstrated by:
perl -e '$SIG{CHLD} = "IGNORE"; fork or sleep 0xbeef; print
"system:".system("true")."\n";'
prints: system:-1

Using a sub instead of "IGNORE" works as expected:
perl -e '$SIG{CHLD} = sub{}; fork or sleep 0xbeef; print
"system:".system("true")."\n";'
prints: system: 0

This result is consistent on centos4 and fedora core 2 and 3.

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=core
    severity=medium
---
Site configuration information for perl v5.8.7:

Configured by chris at Mon Aug 22 16:34:25 EST 2005.

Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
  Platform:
    osname=linux, osvers=2.6.9-11.elsmp, archname=i386-linux
    uname='linux centos.local 2.6.9-11.elsmp #1 smp wed jun 8 17:54:20
cdt 2005 i686 i686 i386 gnulinux '
    config_args='-ds -Doptimize=-O2 -pipe -m32 -march=i386
-mtune=pentium4 -Dcc=gcc -Duseshrplib -Duselargefiles -Dd_dosuid
-Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog
-Duseperlio -Ubincompat5005 -Dpager=/usr/bin/less -isr
-Dsiteprefix=/usr/local -Dinstallprefix=/usr/local -Dprefix=/usr/local
-Darchname=i386-linux -Dmyhostname=centos.local
-Dperladmin=root@localhost -Dccflags=-D_REENTRANT -D_GNU_SOURCE
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -Dcppflags=-D_REENTRANT
-D_GNU_SOURCE -fno-strict-aliasing -pipe -I/usr/local/include
-I/usr/include/gdbm'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
    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
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -I/usr/local/include
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O2 -pipe -m32 -march=i386 -mtune=pentium4',
    cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe
-I/usr/local/include -I/usr/include/gdbm -D_REENTRANT -D_GNU_SOURCE
-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -I/usr/local/include'
    ccversion='', gccversion='3.4.3 20050227 (Red Hat 3.4.3-22.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 -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.3.4.so, so=so, useshrplib=true, libperl=libperl.so
    gnulibc_version='2.3.4'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-rpath,/usr/local/lib/perl5/5.8.7/i386-linux/CORE'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:


---
@INC for perl v5.8.7:
    /usr/local/lib/perl5/5.8.7/i386-linux
    /usr/local/lib/perl5/5.8.7
    /usr/local/lib/perl5/site_perl/5.8.7/i386-linux
    /usr/local/lib/perl5/site_perl/5.8.7
    /usr/local/lib/perl5/site_perl
    .


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About