Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Dec 1998 18:21:57 +0100
From:      Martin Cracauer <cracauer@cons.org>
To:        Thomas David Rivers <rivers@dignus.com>, cracauer@cons.org, freebsd-hackers@freefall.cdrom.com
Subject:   Re: Interesting un-interruptible shell script on 3.0-RELEASE (possible sh bug?)
Message-ID:  <19981222182157.A5343@cons.org>
In-Reply-To: <199812221251.HAA22231@lakes.dignus.com>; from Thomas David Rivers on Tue, Dec 22, 1998 at 07:51:10AM -0500
References:  <19981222134641.A12019@cons.org> <199812221251.HAA22231@lakes.dignus.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In <199812221251.HAA22231@lakes.dignus.com>, Thomas David Rivers wrote: 
> > >    while true
> > >    do
> > >      sleep 2
> > >    done
>  Martin brings up an interesting 'twist' on this.  If you place the
> script in a file; the control-C works just fine (on a 3.0-RELEASE system.)

OK, that (to me :-) a known issue.

In a script (that is a non-interactive shell), sh exists itself if a
child returns with WIFSIGNALED(status). Unless you set or unset traps
yourself, that is.

For interactive shells, you can't do it that way, since you don't want
the shell to exit if the child is being killed.

What is needed here is that sh breaks the loop (instead of exiting
itself) if a child inside a loop exists with WIFSIGNALED(status). This
is not trivial to implement since you can have nested loops and want
to break the outermost. Also, I'll have to see what POSIX sais about
the issue (yes, the fat book arrived and is paid :-).

I'll give it a shot over the holidays, for now I'll file a PR to
document the issue.

Martin
-- 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@cons.org> http://www.cons.org/cracauer
  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-hackers" in the body of the message



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