Debian Bug report logs - #20398
xemacs20-nomule: suspend (C-z) causes hang

version graph

Package: xemacs20-nomule; Maintainer for xemacs20-nomule is (unknown);

Reported by: Chris Lawrence <quango@ix.netcom.com>

Date: Sun, 29 Mar 1998 23:03:00 UTC

Severity: normal

Found in version 20.4-1

Done: James LewisMoss <jimdres@mindspring.com>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, James LewisMoss <dres@dimensional.com>:
Bug#20398; Package xemacs20-nomule. (full text, mbox, link).


Acknowledgement sent to Chris Lawrence <quango@ix.netcom.com>:
New bug report received and forwarded. Copy sent to James LewisMoss <dres@dimensional.com>. (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Chris Lawrence <quango@ix.netcom.com>
To: submit@bugs.debian.org
Subject: xemacs20-nomule: suspend (C-z) causes hang
Date: Sun, 29 Mar 1998 16:48:46 -0600
Package: xemacs20-nomule
Version: 20.4-1

When running xemacs on a virtual console, suspending it with control Z does
not actually suspend the process.  After hitting control C several times,
you are asked whether or not you want to autosave and whether to abort.

The lisp backtrace given is:

  # (unwind-protect ...)
  suspend-emacs()
  #<compiled-function (from "frame.elc") nil "...(29)" [frame-type x
iconify-frame tty console-tty-controlling-process selected-console
suspend-console suspend-emacs] 2 661449 nil>()
  call-interactively(suspend-emacs-or-iconify-frame)
  # (condition-case ... . error)
  # (catch top-level ...)
      
The backtrace on the generated core file is:

#0  0x4026d3b1 in ?? () from /lib/libc.so.6
#1  0xbfffefe0 in ?? ()
#2  0x4026e3ff in ?? () from /lib/libc.so.6
#3  0x806e2be in assert_failed (file=0x8122de3 "signal.c", line=436,
    expr=0x8122e3b "abort()") at emacs.c:2240
#4  0x80de1f5 in interrupt_signal (sig=2) at signal.c:436
#5  0xbffff2c8 in ?? ()
#6  0x4026ed65 in ?? () from /lib/libc.so.6
#7  0x401ef5f0 in ?? () from /usr/lib/libgpm.so.1
#8  0xffff in ?? ()

-- System Information
Debian Release: 2.0 (frozen)
Kernel Version: Linux mem-tn3-14.ix.netcom.com 2.0.33 #1 Sun Mar 1 15:09:06 CST 1998 i486 unknown

Versions of the packages xemacs20-nomule depends on:
xemacs20-bin	Version: 20.4-1
libc6	Version: 2.0.7pre1-4
libcompfaceg1	Version: 1989.11.11-15
libgdbmg1	Version: 1.7.3-23
libgpmg1	Version: 1.13-3
libjpegg6a	Version: 6a-11
libpng0g	Version: 0.96-5
ncurses3.4	Version: 1.9.9g-8
xlib6g	Version: 3.3.2-1
xpm4g	Version: 3.4j-0.6
zlib1g	Version: 1:1.1.1-0.1


Information forwarded to debian-bugs-dist@lists.debian.org, James LewisMoss <dres@dimensional.com>:
Bug#20398; Package xemacs20-nomule. (full text, mbox, link).


Acknowledgement sent to Peter Samuelson <psamuels@sampo.creighton.edu>:
Extra info received and forwarded to list. Copy sent to James LewisMoss <dres@dimensional.com>. (full text, mbox, link).


Message #10 received at 20398@bugs.debian.org (full text, mbox, reply):

From: Peter Samuelson <psamuels@sampo.creighton.edu>
To: 20356@bugs.debian.org, 22051@bugs.debian.org, 20398@bugs.debian.org, 23686@bugs.debian.org
Subject: (Bug#20356)(Bug#20398)(Bug#22051)(Bug#23686) libgpm SIGTSTP recursion workaround
Date: Mon, 21 Sep 1998 01:05:25 -0500 (CDT)
I guess I don't know how to submit information pertaining to multiple
bug track numbers -- anyway if this doesn't work right, I intend for
this message to reach people associated with bugs #20356, #20398,
#22051, and #23686.  They should be merged since they all refer to the
same xemacs20 ^Z hang-if-on-VC-controlled-by-gpm bug.

I'm pretty sure the bug is in libgpm, as #20356 reports.  I have had no
luck actually tracing the bug to its source, though I determined that
indeed the SIGTSTP signal handler in liblow.c is somehow managing to
get itself called recursively, presumably by someone throwing an extra
SIGTSTP in the wrong place.  Below are my patches to work around it --
a small change to libgpm and an even smaller change to xemacs20.

One problem (maybe related, maybe not) is that libgpm wants to have a
SIGTSTP (keyboard suspend) handler, so it installs one, taking care to
daisy-chain whatever existing SIGTSTP handler the app has defined.
Nice and transparent, but I think it's a bad idea, because the app
can't change its TSTP handler later on without screwing things up.  I'm
not sure if that's the problem with XEmacs or if something else is also
broken, but in any case what I did to fix XEmacs was to provide two
extra functions and a variable in libgpm.

Before calling Gpm_Open(), just set Gpm_SuspendCompat=0 to inhibit the
default TSTP handler from being installed.  Then in your own "suspend"
function (XEmacs's sys_suspend in sysdep.c) call Gpm_SuspendPre() and
Gpm_SuspendPost() just before and just after the kill(myself).

A couple notes to the maintainers of gpm and xemacs20:

- I patched xemacs20/configure.in so make sure and rerun autoconf.
- If xemacs20 is patched and rebuilt with a patched libgpm, it had
  better explicitly depend on libgpmg1 >= the patched version.
- The patched libgpmg1 will be back-compatible, so no need to recompile
  any other software.

The two udiff patches follow.


Peter Samuelson
<sampo.creighton.edu ! psamuels>

======================================================================
=== diff 1 of 2, made against gpm-1.13-5
======================================================================
diff -urN gpm-1.13-5.orig/gpm.h gpm-1.13-5/gpm.h
--- gpm-1.13-5.orig/gpm.h	Thu Sep 11 14:50:05 1997
+++ gpm-1.13-5/gpm.h	Sun Sep 20 14:21:18 1998
@@ -152,6 +152,9 @@
 #include <sys/ioctl.h>  /* to get the prototype for ioctl() */
 
 /* liblow.c */
+extern int Gpm_SuspendCompat;
+extern void Gpm_SuspendPre(void);
+extern void Gpm_SuspendPost(void);
 extern int Gpm_Open(Gpm_Connect *, int);
 extern int Gpm_Close(void);
 extern int Gpm_GetEvent(Gpm_Event *);
diff -urN gpm-1.13-5.orig/liblow.c gpm-1.13-5/liblow.c
--- gpm-1.13-5.orig/liblow.c	Thu Sep 11 14:46:23 1997
+++ gpm-1.13-5/liblow.c	Mon Sep 21 00:18:59 1998
@@ -99,29 +99,57 @@
 
 #if (defined(SIGTSTP)) 
 /* itz: support for SIGTSTP */
+/* pjs: allow app to control this */
 
 /* Old SIGTSTP handler. */
 
 static __sighandler_t gpm_saved_suspend_hook;
 
-static void gpm_suspend_hook ()
+/* gpm_suspend_hook() is somehow recursing (by reinstalling itself as
+ * signal handler and then somehow getting itself called), at least in
+ * XEmacs 20.4.  Not having any luck finding the actual problem, I
+ * worked around it by modularizing it into SuspendPre and SuspendPost
+ * which XEmacs can just call directly, and do its own suspending, not
+ * using gpm_suspend_hook() at all.  Probably a better solution would
+ * be to find and fix the actual loop, but this works.
+ *
+ * To use Gpm_Suspend{Pre,Post}, make sure you set Gpm_SuspendCompat=0
+ * before calling Gpm_Open() for the first time.  This will prevent
+ * gpm_suspend_hook() from ever being installed.
+ */
+int Gpm_SuspendCompat = 1;
+
+static int suspend_open_success = 0;
+void Gpm_SuspendPre ()
 {
 	Gpm_Connect gpm_connect;
+	gpm_connect.eventMask = 0;
+	gpm_connect.defaultMask = ~0;
+	gpm_connect.minMod = ~0;
+	gpm_connect.maxMod = 0;
+	/* cannot do this under xterm, tough */
+	suspend_open_success = (Gpm_Open (&gpm_connect, 0) >= 0);
+}
+
+void Gpm_SuspendPost ()
+{
+	/* Pop the gpm stack by closing the useless connection */
+	/* but do it only when we know we opened one.. */
+	if (suspend_open_success) {
+		Gpm_Close ();
+	}
+}
+
+static void gpm_suspend_hook ()
+{
 	sigset_t old_sigset;
 	sigset_t new_sigset;
-	int success;
 
 	sigemptyset (&new_sigset);
 	sigaddset (&new_sigset, SIGTSTP);
 	sigprocmask (SIG_BLOCK, &new_sigset, &old_sigset);
 
-	/* Open a completely transparent gpm connection */
-	gpm_connect.eventMask = 0;
-	gpm_connect.defaultMask = ~0;
-	gpm_connect.minMod = ~0;
-	gpm_connect.maxMod = 0;
-	/* cannot do this under xterm, tough */
-	success = (Gpm_Open (&gpm_connect, 0) >= 0);
+	Gpm_SuspendPre ();
 
 	/* take the default action, whatever it is (probably a stop :) */
 	sigprocmask (SIG_SETMASK, &old_sigset, 0);
@@ -131,11 +159,8 @@
 
 	/* Reincarnation. Prepare for another death early. */
 	signal (SIGTSTP, gpm_suspend_hook);
-	/* Pop the gpm stack by closing the useless connection */
-	/* but do it only when we know we opened one.. */
-	if (success) {
-		Gpm_Close ();
-	} /*if*/
+
+	Gpm_SuspendPost ();
 }
 #endif /* SIGTSTP */
 
@@ -263,7 +288,7 @@
   if (putdata(gpm_fd,conn)!=-1)
     {
 #if (defined(SIGTSTP))
-    if (gpm_flag == 1)
+    if (gpm_flag == 1 && Gpm_SuspendCompat)
       /* Install suspend hook */
       if ((gpm_saved_suspend_hook = signal (SIGTSTP, SIG_IGN)) != SIG_IGN)
 	signal (SIGTSTP, gpm_suspend_hook);
======================================================================
=== diff 2 of 2, made against xemacs20-20.4-5
======================================================================
diff -urN xemacs20-20.4-5.orig/configure.in xemacs20-20.4-5/configure.in
--- xemacs20-20.4-5.orig/configure.in	Sun Sep 20 17:17:47 1998
+++ xemacs20-20.4-5/configure.in	Sun Sep 20 23:57:24 1998
@@ -2990,6 +2990,10 @@
     AC_DEFINE(HAVE_GPM)
     XE_ADD_OBJS(gpmevent.o)
     XE_PREPEND(-lgpm, LIBS)
+    AC_CHECK_LIB(gpm, Gpm_SuspendPre, with_gpm_susp=yes, with_gpm_susp=no)
+    if test "$with_gpm_susp" = "yes"; then
+      AC_DEFINE(HAVE_GPMSUSPEND)
+    fi
   fi
 
 else dnl "$with_tty" = "no"
diff -urN xemacs20-20.4-5.orig/src/config.h.in xemacs20-20.4-5/src/config.h.in
--- xemacs20-20.4-5.orig/src/config.h.in	Tue Oct 28 05:36:08 1997
+++ xemacs20-20.4-5/src/config.h.in	Sun Sep 20 23:45:00 1998
@@ -328,6 +328,9 @@
 
 /* Compile in support for gpm (General Purpose Mouse)?  */
 #undef HAVE_GPM
+
+/* Workaround for elusive bug in gpm */
+#undef HAVE_GPMSUSPEND
 
 /* Compile in support for ncurses?  */
 #undef HAVE_NCURSES
diff -urN xemacs20-20.4-5.orig/src/gpmevent.c xemacs20-20.4-5/src/gpmevent.c
--- xemacs20-20.4-5.orig/src/gpmevent.c	Mon Oct 13 22:20:48 1997
+++ xemacs20-20.4-5/src/gpmevent.c	Sun Sep 20 14:57:20 1998
@@ -98,6 +98,10 @@
       conn.minMod = 0;
       conn.maxMod = ((1<<KG_SHIFT)|(1<<KG_ALT)|(1<<KG_CTRL));
 
+      /* We want to do our own SIGTSTP handling */
+#ifdef HAVE_GPMSUSPEND
+      Gpm_SuspendCompat = 0;
+#endif
       rval = Gpm_Open (&conn, 0);
       switch (rval) {
       case -1: /* General failure */
diff -urN xemacs20-20.4-5.orig/src/sysdep.c xemacs20-20.4-5/src/sysdep.c
--- xemacs20-20.4-5.orig/src/sysdep.c	Mon Nov 10 18:33:12 1997
+++ xemacs20-20.4-5/src/sysdep.c	Sun Sep 20 23:41:54 1998
@@ -737,7 +737,13 @@
 #elif defined (SIGTSTP) && !defined (MSDOS)
   {
     int pgrp = EMACS_GET_PROCESS_GROUP ();
+#ifdef HAVE_GPMSUSPEND
+    Gpm_SuspendPre ();
+    EMACS_KILLPG (pgrp, SIGTSTP);
+    Gpm_SuspendPost ();
+#else /* HAVE_GPMSUSPEND */
     EMACS_KILLPG (pgrp, SIGTSTP);
+#endif /* HAVE_GPMSUSPEND */
   }
 
 #elif defined (USG_JOBCTRL)


Reply sent to James LewisMoss <jimdres@mindspring.com>:
You have taken responsibility. (full text, mbox, link).


Notification sent to Chris Lawrence <quango@ix.netcom.com>:
Bug acknowledged by developer. (full text, mbox, link).


Message #15 received at 20398-done@bugs.debian.org (full text, mbox, reply):

From: James LewisMoss <jimdres@mindspring.com>
To: 13346-done@bugs.debian.org, 10966-done@bugs.debian.org, 9440-done@bugs.debian.org, 15308-done@bugs.debian.org, 20051-done@bugs.debian.org, 20232-done@bugs.debian.org, 20398-done@bugs.debian.org, 29397-done@bugs.debian.org, 20870-done@bugs.debian.org, 22051-done@bugs.debian.org, 23686-done@bugs.debian.org, 30601-done@bugs.debian.org, 30986-done@bugs.debian.org, 33513-done@bugs.debian.org, 35107-done@bugs.debian.org, 34297-done@bugs.debian.org, 35804-done@bugs.debian.org, 36255-done@bugs.debian.org, 36953-done@bugs.debian.org, 37027-done@bugs.debian.org, 37292-done@bugs.debian.org, 39593-done@bugs.debian.org, 42272-done@bugs.debian.org, 45056-done@bugs.debian.org, 48031-done@bugs.debian.org, 48488-done@bugs.debian.org, 50901-done@bugs.debian.org, 52413-done@bugs.debian.org, 53740-done@bugs.debian.org, 57307-done@bugs.debian.org
Subject: cleaning up old bugs
Date: 19 Apr 2000 21:34:16 -0400
13346: man pages in xemacs21 packages
10966: viper mode seems to work fine.
9440:  nnml with gnus didn't mess up with a dir called ~
15308: probably fixed, and so old it'll never be repeated.
20051: working as designed.
20232: fixed in latest versions or with not compiling with gpm
20398: fixed with not compiling with gpm
20870: the COPYING and COPYING.LIB will stay because they are standard
       emacs fare. completer copies are in upstream.  will not
       remove. TUTORIAL copy gone.
22051: fixed by not compiling with gpm
23686: fixed by not compiling with gpm
29397: fixed by not compiling with gpm
30601: no response from query.  assuming no longer problem
30986: fixed long ago.
33513: emacsen provided by xemacs now.
34297: pstogif gone from latest xemacs
35107: pstogif gone from latest xemacs
35804: removed nnmail-spool-file def in 00debian.el
36255: latest responds to xterm size changes
36953: working as designed and workaround provided
37027: FAQ provides answer
37292: no longer valid (emacsclient gone)
39593: fixed long ago in 00debian.el
42272: no longer compiled with gpm
45056: gpm support unconfigured
48031: check for dir before setting. return nil otherwise
48488: fixed in woody
50901: font menu in xemacs21 split
52413: permissions correct
53740: commenting out nnmail-spool-file def fixes problem
57307: problem gone. looks like bug in mandb.

-- 
@James LewisMoss <dres@ioa.com>         |  Blessed Be!
@    http://www.ioa.com/~dres           |  Linux is kewl!
@"Argue for your limitations and sure enough, they're yours." Bach


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sat Jun 1 21:47:32 2024; Machine Name: bembo

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.