Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Apr 1998 10:12:03 +0200
From:      Martin Cracauer <cracauer@cons.org>
To:        Bruce Evans <bde@zeta.org.au>, cracauer@cons.org
Cc:        freebsd-current@FreeBSD.ORG
Subject:   Re: make/SIGINT (Re: cvs commit: src/bin/sh jobs.c)
Message-ID:  <19980422101203.65361@cons.org>
In-Reply-To: <199804191143.VAA00099@godzilla.zeta.org.au>; from Bruce Evans on Sun, Apr 19, 1998 at 09:43:30PM %2B1000
References:  <199804191143.VAA00099@godzilla.zeta.org.au>

next in thread | previous in thread | raw e-mail | index | archive | help
> 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 <cracauer@cons.org> 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



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