Date: Tue, 22 Dec 1998 16:15:47 -0500 (EST) From: Thomas David Rivers <rivers@dignus.com> To: cracauer@cons.org, freebsd-hackers@freefall.cdrom.com, rivers@dignus.com Subject: Re: Interesting un-interruptible shell script on 3.0-RELEASE (possible sh bug?) Message-ID: <199812222115.QAA23936@lakes.dignus.com> In-Reply-To: <19981222182157.A5343@cons.org>
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 > -- Sounds like you've got a good handle on it, then... I won't bother with a PR. But, just for your own information; this doesn't seem to be a problem in 2.2.x... just 3.0. So, perhaps it's something that changes in /bin/sh since then, or something that changed with signal() in the system? - Dave Rivers - 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?199812222115.QAA23936>