Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Dec 1998 21:43:24 -0500 (EST)
From:      Thomas David Rivers <rivers@dignus.com>
To:        freebsd-hackers@freefall.cdrom.com
Subject:   Interesting un-interruptible shell script on 3.0-RELEASE (possible sh bug?)
Message-ID:  <199812220243.VAA21066@lakes.dignus.com>

next in thread | raw e-mail | index | archive | help

Try the following on a 3.0-RELEASE system, under the bourne shell:

   while true
   do
     sleep 2
   done

You'll quickly discover there's no way to interrupt it (i.e. control-C
if that's your intr character.)

But, individually, the two ideas (the while loop and the sleep) are
quite interruptable.

That is, you can interrupt this:

   while true
   do
   done

And, you can interrupt this:

   sleep 10

But, I can't interrupt the combination; even when I hold down control-C
(which, should eventually be in the 'right place at the right time' to
interrupt the sleep followed by another control-C to interrupt the while
loop.   Even a ^\ (my quit character) won't stop the loop;  it does get 
sleep to dump core.. but the loop quickly (too quickly apparently) starts
up another sleep.

I'd have to guess it to be a shell bug... seems like it could affect
trap behaviour as well.

This "interesting" phenomenon doesn't seem to be present on a 2.2.X system.

Could some other people with 3.0 (RELEASE or later) try it out... if it's 
a consistent problem; I'll submit a pr on it.

	- 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?199812220243.VAA21066>