Hi,
This one is crucial, aborting loops in csh is done upon receiving
SIGINT. The signal handler will eventually call longjmp() and re-enter
the input loop if all went well. The tty should therefore be restored
prior sending the SIGINT.

Strange behavior discovered by the regress suite.

Comments? OK?

Index: file.c
===================================================================
RCS file: /cvs/src/bin/csh/file.c,v
retrieving revision 1.30
diff -u -p -r1.30 file.c
--- file.c      29 Jun 2017 04:23:12 -0000      1.30
+++ file.c      7 Jul 2017 07:49:15 -0000
@@ -228,8 +228,11 @@ cl_abort(struct cmdline *cl, int c)
        cl_visc(cl, c);
 
        /* Abort while/foreach loop prematurely. */
-       if (whyles)
+       if (whyles) {
+               setup_tty(0);
                kill(getpid(), SIGINT);
+               /* NOTREACHED */
+       }
 
        cl_putc(cl, '\n');
        cl->len = cl->cursor = 0;

Reply via email to