Package: python2.6 Version: 2.6.6-5 Severity: minor According to POSIX, “If the SIGCHLD signal is set to be ignored by the calling process image, it is unspecified whether [after an exec*() call] the SIGCHLD signal is set to be ignored or to the default action in the new process image.”[0] In fact, SIGCHLD->SIG_IGN is inherited by child processes on Linuxand Hurd systems (though, apparently, not on kFreeBSD). However, the subprocess module and (possibly) other process spawning functions are broken if SIGCHLD is set to SIG_IGN. Therefore, the interpreter should reset SIGCHLD to a sane value (i.e. SIG_DFL) at start.
I attach a simple program to expose the current buggy behavior:
$ python test-sigchld.py SIG_DFL
Hello world!
$ python test-sigchld.py SIG_IGN
Hello world!
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.6/subprocess.py", line 470, in call
return Popen(*popenargs, **kwargs).wait()
File "/usr/lib/python2.6/subprocess.py", line 1182, in wait
pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
File "/usr/lib/python2.6/subprocess.py", line 455, in _eintr_retry_call
return func(*args)
OSError: [Errno 10] No child processes
[0] http://www.opengroup.org/onlinepubs/009695399/functions/exec.html
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (990, 'unstable'), (500, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-5-686 (SMP w/1 CPU core)
Locale: LANG=C, LC_CTYPE=pl_PL.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages python2.6 depends on:
ii libbz2-1.0 1.0.5-6 high-quality block-sorting file co
ii libc6 2.11.2-6 Embedded GNU C Library: Shared lib
ii libdb4.8 4.8.30-2 Berkeley v4.8 Database Libraries [
ii libexpat1 2.0.1-7 XML parsing C library - runtime li
ii libncursesw5 5.7+20100313-4 shared libraries for terminal hand
ii libreadline6 6.1-3 GNU readline and history libraries
ii libsqlite3-0 3.7.2-1 SQLite 3 shared library
ii mime-support 3.48-1 MIME files 'mime.types' & 'mailcap
ii python2.6-minimal 2.6.6-5 A minimal subset of the Python lan
--
Jakub Wilk
#!/usr/bin/python
import os
import sys
import signal
actions = 'SIG_DFL', 'SIG_IGN'
if len(sys.argv) != 2 or sys.argv[1] not in actions:
print >>sys.stderr, '%s {%s}' % (sys.argv[0], '|'.join(actions))
sys.exit(1)
action = sys.argv[1]
signal.signal(signal.SIGCHLD, getattr(signal, action))
os.execv('/usr/bin/python', [
'python', '-c',
"import subprocess; subprocess.call('echo Hello world!', shell=True)"
])
# vim:ts=4 sw=4 et
signature.asc
Description: Digital signature

