Subject: Re: shell blocking ^C
To: None <current-users@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: current-users
Date: 10/23/2002 14:00:49
On Tue, Oct 22, 2002 at 05:36:56PM +0100, David Laight wrote:
> I think this might have been introduced by the recent vfork
> changes to /sbin/sh
> 
> $ ^C
> $ /fred
> /fred: not found
> $ ^C
> 
> At this point I don't get a new prompt.

Ok the extra INTOFF is the one in exverror().
In almost all cases this doesn't matter because the longjmp()s
all end up in main() and the FORCEINTON call sorts it out
for the next command.
(There are a significant number of INTON/OFF mismatches through
the error paths...)

In any case the above failure can be 'fixed' by changing 2 (I think
they are both needed) INTON calls to FORCEINTON within evalcommand.
The following patch seems to work:

	David

Index: eval.c
===================================================================
RCS file: /cvsroot/basesrc/bin/sh/eval.c,v
retrieving revision 1.65
diff -u -r1.65 eval.c
--- eval.c	2002/09/28 01:25:01	1.65
+++ eval.c	2002/10/23 12:49:38
@@ -805,7 +819,7 @@
 #endif
 			if (forkshell(jp, cmd, mode) != 0)
 				goto parent;	/* at end of routine */
-			INTON;
+			FORCEINTON;
 #ifdef DO_SHAREDVFORK
 		}
 #endif
@@ -946,14 +971,14 @@
 	goto out;
 
 parent:	/* parent process gets here (if we forked) */
 	if (mode == 0) {	/* argument to fork */
 		exitstatus = waitforjob(jp);
 	} else if (mode == 2) {
 		backcmd->fd = pip[0];
 		close(pip[1]);
 		backcmd->jp = jp;
 	}
-	INTON;
+	FORCEINTON;
 
 out:
 	if (lastarg)

-- 
David Laight: david@l8s.co.uk