From xemacs-m  Wed Jan 29 22:52:25 1997
Received: from dres.elam.org (dres@cola81.scsn.net [206.25.247.81])
          by xemacs.org (8.8.4/8.8.4) with ESMTP
	  id WAA09592 for <xemacs-beta@xemacs.org>; Wed, 29 Jan 1997 22:52:21 -0600 (CST)
Received: (from dres@localhost)
	by dres.elam.org (8.8.5/8.8.5) id XAA09977;
	Wed, 29 Jan 1997 23:48:45 -0500
To: xemacs-beta@xemacs.org
Subject: failure xemacs 20.0b93 linux 2.0.28
Mime-Version: 1.0 (generated by tm-edit 7.100)
Content-Type: text/plain; charset=US-ASCII
From: James LewisMoss <dres@scsn.net>
Date: 29 Jan 1997 23:48:44 -0500
Message-ID: <hhsp3jwyxf.fsf@dres.elam.org>
Lines: 114
X-Mailer: Gnus v5.2.40/XEmacs 20.0

libc 5.4.20 gcc 2.7.2.1

Configured for `i586-unknown-linux2.0.28'.

  Where should the build process find the source code?    /usr/local/src/apps/editors/emacs/xemacs-20.0-b91
  What installation prefix should install use?            /usr/local
  What operating system and machine description files should XEmacs use?
        `s/linux.h' and `m/intel386.h'
  What compiler should XEmacs be built with?              gcc -g -O -pipe -Wall
  Should XEmacs use the GNU version of malloc?            yes
  Should XEmacs use the relocating allocator for buffers? yes
  What window system should XEmacs use?                   x11
  Where do we find X Windows header files?                /usr/X11R6/include
  Where do we find X Windows libraries?                   /usr/X11R6/lib
  Additional header files:                                /usr/include/db
  Compiling in support for XAUTH.
  Compiling in support for XPM.
  Compiling in support for X-Face headers.
  Compiling in support for GIF image conversion.
  Compiling in support for PNG image conversion.
  Compiling in extra Epoch compatibility.
  Compiling in both network and native sound support.
  Compiling in support for Berkeley DB.
  Compiling in support for GNU DBM.
  Using the Lucid menubar.
  Using the Lucid scrollbar.
  Using the Athena dialog boxes.
  Compiling in extra code for debugging.
  Compiling in code for checking XEmacs memory usage.

Configured with:
  ./configure --verbose \
   --cflags="-g -O -Wall -pipe" \
   --with-menubars=lucid \
   --with-scrollbars=lucid \
   --with-dialogs=athena \
   --with-sound=both \
   --with-database=berkdb,gnudbm \
   --with-epoch \
   --with-xmu \
   --extra-verbose \
   --site-includes='/usr/include/db' \
   --debug

crashed with this backtrace:
Program received signal SIGSEGV, Segmentation fault.
0x81a3e07 in _free_internal (ptr=0x82f73e0) at gmalloc.c:886
886               prev->prev->next = next;
(gdb) print prev
$1 = (struct list *) 0x82f8000
(gdb) print prev->prev
$2 = (struct list *) 0xc
(gdb) bt
#0  0x81a3e07 in _free_internal (ptr=0x82f73e0) at gmalloc.c:886
#1  0x81a3f66 in free (ptr=0x82f73e0) at gmalloc.c:954
#2  0x40269270 in closedir ()
#3  0x40225e9b in getwd ()
#4  0x8087f3d in main_1 (argc=2, argv=0xbffff55c, envp=0xbffff568)
    at emacs.c:1372
#5  0x80887b6 in main (argc=2, argv=0xbffff55c, envp=0xbffff568)
    at emacs.c:1803
#6  0x804ef0b in _start ()

This patch fixes it (reverses gmalloc patch and makes
__malloc_initialized static again).  I assume that mallopt in libc
5.4.20 makes some assumptions about __malloc_initialized as well and
doesn't set things up properly if it is already set to 1.  Maybe a
better solution would be to change the name in the gmalloc included
with xemacs.

--- ./gmalloc.c.old	Wed Jan 29 23:42:40 1997
+++ ./gmalloc.c	Wed Jan 29 23:43:08 1997
@@ -258,7 +258,7 @@
 extern void (*__after_morecore_hook) __P ((void));
 
 /* Nonzero if `malloc' has been called and done its initialization.  */
-extern int __malloc_initialized;
+    /* extern int __malloc_initialized; */
 
 /* Hooks for debugging versions.  */
 extern void (*__free_hook) __P ((__ptr_t __ptr));
@@ -431,7 +431,7 @@
 __malloc_size_t _bytes_free;
 
 /* Are you experienced?  */
-int __malloc_initialized;
+static int __malloc_initialized;
 
 void (*__after_morecore_hook) __P ((void));
 
@@ -556,12 +556,12 @@
     return NULL;
 #endif
 
+  if (__malloc_hook != NULL)
+    return (*__malloc_hook) (size);
+
   if (!__malloc_initialized)
     if (!initialize ())
       return NULL;
-
-  if (__malloc_hook != NULL)
-    return (*__malloc_hook) (size);
 
 #ifdef SUNOS_LOCALTIME_BUG
   /* Workaround for localtime() allocating 8 bytes and writing 9 bug... */


Jim

-- 
@James LewisMoss                 | moss@cs.sc.edu | Blessed Be!
@    http://www.cs.sc.edu/~moss  | dres@scsn.net  | Linux is cool!
@"Argue for your limitations and sure enough, they're yours." Bach

