From owner-freebsd-hackers Tue Dec 22 13:14:49 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA05448 for freebsd-hackers-outgoing; Tue, 22 Dec 1998 13:14:49 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA05384 for ; Tue, 22 Dec 1998 13:14:45 -0800 (PST) (envelope-from rivers@dignus.com) Received: from smtp1.vnet.net (smtp1.vnet.net [166.82.1.31]) by freefall.freebsd.org (8.8.8/8.8.5) with ESMTP id NAA18403 for ; Tue, 22 Dec 1998 13:14:41 -0800 (PST) Received: from dignus.com (ponds.vnet.net [166.82.177.48]) by smtp1.vnet.net (8.9.1a/8.9.1) with ESMTP id QAA08725; Tue, 22 Dec 1998 16:14:39 -0500 (EST) Received: from lakes.dignus.com (lakes.dignus.com [10.0.0.3]) by dignus.com (8.9.1/8.8.5) with ESMTP id RAA27711; Tue, 22 Dec 1998 17:02:19 -0500 (EST) Received: (from rivers@localhost) by lakes.dignus.com (8.9.1/8.6.9) id QAA23936; Tue, 22 Dec 1998 16:15:47 -0500 (EST) Date: Tue, 22 Dec 1998 16:15:47 -0500 (EST) From: Thomas David Rivers Message-Id: <199812222115.QAA23936@lakes.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?) In-Reply-To: <19981222182157.A5343@cons.org> Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > 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