🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #88078

Re: emacs-19.25 SparcSunOs4.1.3 C-z kills emacs - bugfix?

#88078
From: "Mike Rudin"
Date: Mon, 08 Aug 1994 23:14
105 lines
3969 bytes
OK, my turn to answer this, as I was also interested in the fix.

Robert D. Houk (rdh@sli.com) posted this fix a while back:

Having not heard anything (like "known bug, here's the fix") regarding
the 19.25 bug with emacs dieing rather than suspending on ^Z from tty
mode, I have poked around some more and think [Ha!] I have identified
the basic problem.

The following code in emacs.c line 412:

      if (! noninteractive1)
        {
    #ifdef BSD_PGRPS
          if (initialized)
            {
              inherited_pgroup = EMACS_GETPGRP (0);
              setpgrp (0, getpid ());
            }
    #else
    #if defined (USG5) && defined (INTERRUPT_INPUT)
          setpgrp ();
    #endif
    #endif
        }

seems to be the problem. Specifically, the "noninteractive1" flag is
still set from the initial load/dump of emacs, so this code is *never*
executed  -- in particular the setpgrp for Sun3/SunOS4.1 doesn't get
executed [leastways this is my understanding...but I'm not an emacs
internals wizard!].

I don't understand all the ramifications of the two flags/variables
"noninteractive1" vs "noninteractive" (since it doesn't appear to be
used in other source modules, I assume it is for the sole use of the
setpgrp() call, but ???), but I *think* this block of code should move
to after the -batch set/clear of "noninteractive" (and use "noninter-
active" instead of "noninteractive1").

I have tried this patch, and it seems to work for the trivial test
case (emacs -nw, ^Z, fg, ^Z, fg ...) and doesn't seem to adversely
affect X-mode operation.

Following is my diff:
========================================================================
*** emacs.c-orig        Sat May 28 00:44:47 1994
--- emacs.c     Wed Jul  6 13:27:07 1994
***************
*** 409,429 ****
      clearerr (stdin);
  -   if (! noninteractive1)
-     {
- #ifdef BSD_PGRPS
-       if (initialized)
-       {
-         inherited_pgroup = EMACS_GETPGRP (0);
-         setpgrp (0, getpid ());
-       }
- #else
- #if defined (USG5) && defined (INTERRUPT_INPUT)
-       setpgrp ();
- #endif
- #endif
-     }
-   #ifdef APOLLO
  #ifndef APOLLO_SR10
    /* If USE_DOMAIN_ACLS environment variable exists,
--- 409,414 ----
***************
*** 506,511 ****
--- 491,518 ----
        skip_args += 1;
        noninteractive = 1;
      }
+ + /*[RDH]*/
+ /* Fix emacs 19.25 ^Z/suspend death in tty ("emacs -nw") mode.
+ +    Move the setpgrp() *after* the determination of "noninteractive" 
for this
+    invocation of emacs -- otherwise it will use the initial emacs 
load/dump
+    saved copy! Also, just use "noninteractive", ignore 
"noninteractive1". */
+   if (! noninteractive)
+     {
+ #ifdef BSD_PGRPS
+       if (initialized)
+       {
+         inherited_pgroup = EMACS_GETPGRP (0);
+         setpgrp (0, getpid ());
+       }
+ #else
+ #if defined (USG5) && defined (INTERRUPT_INPUT)
+       setpgrp ();
+ #endif
+ #endif
+     }
+ /*[RDH]*/
    #ifdef POSIX_SIGNALS
    init_signals ();
========================================================================

(End of Robert Houk's text)


Mike.
Technical Details
Message-ID: <Cu8D1s.D30@cix.compulink.co.uk>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!sundog.tiac.net!usenet.elf.com!news2.near.net!MathWorks.Com!news.cic.net!magnus.acs.ohio-state.edu!cis.ohio-state.edu!cix.compulink.co.uk!mrudin
References: <pjs1.776030362@mssly1.mssl.ucl.ac.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,ded3bd6784b68862
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-08-08 17:14:29 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!sundog.tiac.net!usenet.elf.com!news2.near.net!MathWorks.Com!news.cic.net!magnus.acs.ohio-state.edu!cis.ohio-state.edu!cix.compulink.co.uk!mrudin
From: mrudin@cix.compulink.co.uk ("Mike Rudin")
Newsgroups: gnu.emacs.bug
Subject: Re: emacs-19.25 SparcSunOs4.1.3 C-z kills emacs - bugfix?
Date: 8 Aug 1994 19:14:30 -0400
Organization: Compulink Information eXchange
Lines: 106
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <Cu8D1s.D30@cix.compulink.co.uk>
References: <pjs1.776030362@mssly1.mssl.ucl.ac.uk>