Package: socat
Version: 1.4.3.1-1
Severity: normal
Tags: patch

I don't currently know that I'm experiencing any symptom of this, other than a
warning generated by what I'm told is an obsolete warning flag to Perl.

mart...@whitewater:~$ perl -we 0
mart...@whitewater:~$ socat - EXEC:'perl -we 0'
Can't ignore signal CHLD, forcing to default.
mart...@whitewater:~$ 

Here's a demonstration with a more recent version of socat, unpatched then
patched:

mart...@whitewater:/tmp/socat-1.7.1.0$ /tmp/socat-1.7.1.0/socat - EXEC:'perl 
-we 0'
Can't ignore signal CHLD, forcing to default.
mart...@whitewater:/tmp/socat-1.7.1.0$ patch -p0 < xio-progcall.c.patch 
patching file xio-progcall.c
mart...@whitewater:/tmp/socat-1.7.1.0$ make
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.  -I.   -c -o 
xio-progcall.o xio-progcall.c
ar r libxio.a <snipped>
ranlib libxio.a
gcc -O -D_GNU_SOURCE  -Wall -Wno-parentheses -DHAVE_CONFIG_H -I.   -o socat 
socat.o libxio.a -lutil  -lssl
mart...@whitewater:/tmp/socat-1.7.1.0$ /tmp/socat-1.7.1.0/socat - EXEC:'perl 
-we 0'
mart...@whitewater:/tmp/socat-1.7.1.0$ 

I fear there might be other symptoms, which is why I'm raising the bug.
My fears are based partly on:

In http://www.pasc.org/interps/unofficial/db/p1003.1/pasc-1003.1-132.html,
a "David Korn" (perhaps *the* Dave Korn) is quoted as having written:

 A conforming application would not set  SIGCHLD to SIG_IGN
 since the standard leaves this behavior unspecified.  An application
 that does set SIGCHLD to SIG_IGN  should set it back to SIG_DFL
 before the call to exec.

In working on terminal emulators, I've seen a number of programs revert SIGCHLD
to SIG_DFL before calling exec(), generally without convincingly specifying
the reason.  Perhaps the unspecified heritability of SIG_IGN is the reason.

I wonder why socat ignores SIGCHLD in the child.  Perhaps it's for the case
where the child will then call system().  Then the SIG_IGN will affect socat
code as well as any child that inherits it.  But system() waits for its child.
Perhaps this SIG_IGN is a relic of earlier efforts to prevent zombies.
More likely, I'm missing something.

-- System Information:
Debian Release: 4.0
  APT prefers oldstable
  APT policy: (500, 'oldstable'), (50, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-amd64
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.UTF-8)

Versions of packages socat depends on:
ii  libc6                  2.3.6.ds1-13etch9 GNU C Library: Shared libraries
ii  libreadline5           5.2-2             GNU readline and history libraries
ii  libssl0.9.8            0.9.8c-4etch5     SSL shared libraries
ii  libwrap0               7.6.dbs-13        Wietse Venema's TCP wrappers libra

socat recommends no packages.

-- no debconf information
--- xio-progcall.c.orig	2009-05-29 12:20:53.000000000 -0700
+++ xio-progcall.c	2009-05-29 12:24:43.000000000 -0700
@@ -414,8 +414,10 @@
       gid_t group;
 
       if (withfork) {
-	 if (Signal(SIGCHLD, SIG_IGN) == SIG_ERR) {
-	    Warn1("signal(SIGCHLD, SIG_IGN): %s", strerror(errno));
+	 /* The child should have default handling for SIGCHLD. */
+	 /* In particular, it's not defined whether ignoring SIGCHLD is inheritable. */
+	 if (Signal(SIGCHLD, SIG_DFL) == SIG_ERR) {
+	    Warn1("signal(SIGCHLD, SIG_DFL): %s", strerror(errno));
 	 }
 
 #if HAVE_PTY

Reply via email to