Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/sh It turns out that the code disabled in revision 1.30 ...



details:   https://anonhg.NetBSD.org/src/rev/ebf3d2328610
branches:  trunk
changeset: 475955:ebf3d2328610
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Tue Aug 31 08:58:47 1999 +0000

description:
It turns out that the code disabled in revision 1.30 *does* have an important
function (which nobody was able to explain): it's critical to allowing a
complex command run from an interactive shell to be terminated.  So, reinstate
it and fix it correctly.  See the comment if you really want the gory details.

diffstat:

 bin/sh/jobs.c |  29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diffs (52 lines):

diff -r ed0d94f28717 -r ebf3d2328610 bin/sh/jobs.c
--- a/bin/sh/jobs.c     Tue Aug 31 08:41:57 1999 +0000
+++ b/bin/sh/jobs.c     Tue Aug 31 08:58:47 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: jobs.c,v 1.31 1999/07/09 03:05:50 christos Exp $       */
+/*     $NetBSD: jobs.c,v 1.32 1999/08/31 08:58:47 mycroft Exp $        */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c     8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.31 1999/07/09 03:05:50 christos Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.32 1999/08/31 08:58:47 mycroft Exp $");
 #endif
 #endif /* not lint */
 
@@ -730,19 +730,22 @@
 #endif
        else
                st = WTERMSIG(status) + 128;
+#if JOBS
+       if (jp->jobctl) {
+               /*
+                * This is truly gross.
+                * If we're doing job control, then we did a TIOCSPGRP which
+                * caused us (the shell) to no longer be in the controlling
+                * session -- so we wouldn't have seen any ^C/SIGINT.  So, we
+                * intuit from the subprocess exit status whether a SIGINT
+                * occured, and if so interrupt ourselves.  Yuck.  - mycroft
+                */
+               if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT)
+                       raise(SIGINT);
+       }
+#endif
        if (! JOBS || jp->state == JOBDONE)
                freejob(jp);
-#if 0
-       /*
-        * XXXX
-        * Why was this here?  It causes us to lose SIGINTs unless the current
-        * command happens to also catch the SIGINT and exit with the right
-        * status.  I don't see how that can possibly be correct.  -- mycroft
-        */
-       CLEAR_PENDING_INT;
-       if (WIFSIGNALED(status) && WTERMSIG(status) == SIGINT)
-               raise(SIGINT);
-#endif
        INTON;
        return st;
 }



Home | Main Index | Thread Index | Old Index