From owner-freebsd-current Wed Apr 22 01:12:30 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id BAA23159 for freebsd-current-outgoing; Wed, 22 Apr 1998 01:12:30 -0700 (PDT) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from cons.org (knight.cons.org [194.233.237.86]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id IAA23152 for ; Wed, 22 Apr 1998 08:12:25 GMT (envelope-from cracauer@cons.org) Received: (from cracauer@localhost) by cons.org (8.8.8/8.7.3) id KAA22525; Wed, 22 Apr 1998 10:12:03 +0200 (CEST) Message-ID: <19980422101203.65361@cons.org> Date: Wed, 22 Apr 1998 10:12:03 +0200 From: Martin Cracauer To: Bruce Evans , cracauer@cons.org Cc: freebsd-current@FreeBSD.ORG Subject: Re: make/SIGINT (Re: cvs commit: src/bin/sh jobs.c) Mail-Followup-To: Bruce Evans , cracauer@cons.org, freebsd-current@FreeBSD.ORG References: <199804191143.VAA00099@godzilla.zeta.org.au> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89i In-Reply-To: <199804191143.VAA00099@godzilla.zeta.org.au>; from Bruce Evans on Sun, Apr 19, 1998 at 09:43:30PM +1000 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I thought that this bunch of changes (at least to shell and make) was > ready to commit until a few minutes ago when I tried to kill a `make > depend' in src/lib. It didn't work - some sub-make[s] kept running. It's mkdep(1)'s fault: trap 'rm -f $TMP ; exit 1' 1 2 3 13 15 But our sh is broken so it can't be fixed. When a trap handler sets SIGINT to default (means exit with signal status) a `kill -INT $$` apparently doesn't work. Consider this script: #! /bin/sh foo() { echo In handler trap 1 2 3 13 15 kill -TERM $$ echo 'survived!' } trap 'foo' 1 2 3 13 15 cat cat When sending SIGTERM to ourself in the signal handler, the script is immedeatly terminated with signal exit status. However, when sending SIGINT to ourself, the kill to ourself is ignored. The scripts exits when an second SIGINT is received from the terminal (but its doesn't return a signal exit status, so it isn't useful even if we accept to force the user to hit C-c twice). Although SIGTERM works as expected, it can't be used to solve the problem, because a calling shell doesn't cancel a shellscript when a child returns with SIGTERM exit status :-( bash2 treats SIGINT and SIGTERM equally, the trap handler works as expected. On the positive side, the script I had a problem with called rsync(1), which doesn't exit with signal status. There wasn't a difference between bash and our fixed sh. Martin -- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Martin Cracauer http://www.cons.org/cracauer cracauer@wavehh.hanse.de (batched, preferred for large mails) Tel.: (daytime) +4940 41478712 Fax.: (daytime) +4940 41478715 Tel.: (private) +4940 5221829 Fax.: (private) +4940 5228536 Paper: (private) Waldstrasse 200, 22846 Norderstedt, Germany To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message