Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Apr 2000 11:04:05 -0400 (EDT)
From:      Vivek Khera <khera@kciLink.com>
To:        stable@freebsd.org
Subject:   Cron setting SIGCHLD to SIG_IGN
Message-ID:  <14601.43109.419114.997113@onceler.kcilink.com>

next in thread | raw e-mail | index | archive | help

--F8jIq+Bmm/
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit

There was a nice little bug found in Cron over on the BSDI users
mailing list.  Apparently SIGCHLD is ignored when the child command is
run, and perl 5.6.0 complains about it.  The fix is to cron.

This seems to be applicable for FreeBSD 3.4-STABLE and 4.0-STABLE
according to the sources as of today, as well.

Attached is the patch from Paul Vixie.


--F8jIq+Bmm/
Content-Type: message/rfc822
Content-Description: forwarded message
Content-Transfer-Encoding: 7bit

Return-Path: <bsdi-users-return-2689-khera=kci.kcilink.com@mailinglists.org>
Delivered-To: khera@kcilink.com
Received: from mailinglists.org (server1.mailinglists.org [63.160.175.18])
	by kci.kciLink.com (Postfix) with SMTP id B6D39E895
	for <khera@kci.kcilink.com>; Thu, 27 Apr 2000 17:47:18 -0400 (EDT)
Received: (qmail 6669 invoked by alias); 27 Apr 2000 21:47:11 -0000
Mailing-List: contact bsdi-users-help@mailinglists.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
list-help: <mailto:bsdi-users-help@mailinglists.org>
list-unsubscribe: <mailto:bsdi-users-unsubscribe@mailinglists.org>
list-post: <mailto:bsdi-users@mailinglists.org>
Delivered-To: mailing list bsdi-users@mailinglists.org
Received: (qmail 6658 invoked from network); 27 Apr 2000 21:47:11 -0000
Message-Id: <200004272147.OAA45395@redpaul.mibh.net>
References: <200004271826.OAA23896@iridium.mv.net>
In-Reply-To: mem@mv.mv.com's message of "27 Apr 2000 11:22:33 -0700"
X-UIDL: 4a81c6fe911aa9ad0d37a67c4361ec54
From: Paul A Vixie <vixie@mibh.net>
Sender: bsdi-users-return-2689-khera=kci.kcilink.com@mailinglists.org
To: bsdi-users@bsdi.com
Subject: Re: Cron setting SIGCHLD to SIG_IGN
Date: Thu, 27 Apr 2000 14:47:02 -0700

mem@mv.mv.com ("Mark E. Mallett") writes:

> Looking at the cron source code, I do see that cron is forcing
> SIGCHLD to SIG_IGN for the children that it spawns.  I'm afraid that
> the reasoning behind this move escapes me.

It's because cron (then called crond) was the first program I ever wrote
that used signals or called fork or exec.  This was in 1986, just after
4.3BSD came out, and well before signals had been posixified.  signal(2)
says, quite clearly:

     When a process which has installed signal handlers forks, the child pro-
     cess inherits the signals.  All caught signals may be reset to their de-
     fault action by a call to the execve(2) function; ignored signals remain
     ignored.

This means that having set SIGCHLD to SIG_IGN for my own purposes, I really
needed (and apparently still need) to set it back to SIG_DFL before fork()'ing
to run each command found in a crontab.  Ouch!  Sorry, all.  Here's a patch
against cron 4.0 (see ftp://ftp.isc.org/isc/cron/, since this is more recent
than what ships with BSD/OS).  The patch ought to apply, with some fuzz, to
the shipping version.

Index: do_command.c
===================================================================
RCS file: /proj/src/isc/cvs-1/cron/do_command.c,v
retrieving revision 1.4
diff -u -r1.4 do_command.c
--- do_command.c	2000/01/02 20:53:41	1.4
+++ do_command.c	2000/04/27 18:45:37
@@ -222,6 +222,13 @@
 		chdir(env_get("HOME", e->envp));
 
 		/*
+		 * Since ignored signals remain ignored after fork()/exec(),
+		 * we need to unignore our ignored signals before letting
+		 * some unsuspecting user level command inherit them.
+		 */
+		(void) signal(SIGCHLD, SIG_DFL);
+
+		/*
 		 * Exec the command.
 		 */
 		{

---------------------------------------------------------------------
Searchable Archive: http://www.nexial.com/cgi-bin/bsdibody
To unsubscribe, e-mail: bsdi-users-unsubscribe@mailinglists.org
For additional commands, e-mail: bsdi-users-help@mailinglists.org



--F8jIq+Bmm/--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?14601.43109.419114.997113>