Subject: lib/7869: 1.4 libc (> 12.31) breaks binary compatibility for XEmacs
To: None <gnats-bugs@gnats.netbsd.org>
From: None <hauke@Espresso.Rhein-Neckar.DE>
List: netbsd-bugs
Date: 06/27/1999 14:36:04
>Number:         7869
>Category:       lib
>Synopsis:       1.4 libc (> 12.31) breaks binary compatibility for XEmacs
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 27 14:35:01 1999
>Last-Modified:
>Originator:     Hauke Fath
>Organization:
Einzeln auftretender Radfahrer
>Release:        1.4Beta kernel, pre-1.4 userland
>Environment:
System: NetBSD q700.hf.org 1.4 NetBSD 1.4 (FG54) #32: Fri May 7
23:56:47 CEST 1999
hauke@q700.hf.org:/usr/src/sys/arch/mac68k/compile/FG54 mac68k


>Description:

Starting with libc.so.12.33, XEmacs 19.15, 20.4 and 21.1.2 binaries
sigsev during startup on mac68k. This site is mac68k only with the
exception of a Sun IPX that is not yet set up, so I cannot say if this
happens on other machines, too.

The following ktraces are with libc.so.12.33, but the 1.4 release
12.40 gives identical results.

(Further experiments showed that XEmacs 21.1-p2 binaries built on a
mac68k 1.4 machine crash the same way.)

This seems vaguely similar to lib/7863 which encouraged me to do
thorough tests.

Excerpts from the ktraces of "xemacs-XXX -vanilla" (full ktraces
available upon request):

   410 xemacs-19.15 RET   pread 4096/0x1000
   410 xemacs-19.15 CALL  close(0x6)
   410 xemacs-19.15 RET   close 0
   410 xemacs-19.15 PSIG  SIGSEGV caught handler=0x22500 mask=0x0 code=0x0
   410 xemacs-19.15 CALL  sigaction(0xb,0x1b455c,0x1b456c)
   410 xemacs-19.15 RET   sigaction 0
   410 xemacs-19.15 CALL  sigprocmask(0x2,0x400)
   410 xemacs-19.15 RET   sigprocmask 1024/0x400
   410 xemacs-19.15 CALL  write(0x2,0xffffb0a0,0x13)
   410 xemacs-19.15 GIO   fd 2 wrote 19 bytes
       "
        Fatal error (11).
       "


   383 xemacs-20.4 RET   read 32/0x20
   383 xemacs-20.4 CALL  write(0x6,0x316800,0x18)
   383 xemacs-20.4 GIO   fd 6 wrote 24 bytes
       "\^P\0\0\^F\0\^P\0%CHARSET_ENCODING"
   383 xemacs-20.4 PSIG  SIGIO caught handler=0x9c514 mask=0x0 code=0x0
   383 xemacs-20.4 RET   write 24/0x18
   383 xemacs-20.4 CALL  [295](0xffffb858)
   383 xemacs-20.4 RET   [295] JUSTRETURN
   383 xemacs-20.4 CALL  read(0x6,0xffffb944,0x20)
   383 xemacs-20.4 GIO   fd 6 read 32 bytes
       "\^A\^\\0)\0\0\0\0\0\0\0_\0+\^B\0\M^?\M^?\M-K\M-x\M^?\M^?\M-K\M-x\0\^\\
        \M-Y\^D\0(\M^X@"
   383 xemacs-20.4 RET   read 32/0x20
   383 xemacs-20.4 PSIG  SIGSEGV caught handler=0x23370 mask=0x0 code=0x0
   383 xemacs-20.4 CALL  sigaction(0xb,0x1cc69c,0x1cc6ac)
   383 xemacs-20.4 RET   sigaction 0
   383 xemacs-20.4 CALL  sigprocmask(0x2,0x400)
   383 xemacs-20.4 RET   sigprocmask 1024/0x400
   383 xemacs-20.4 CALL  fcntl(0x6,0x4,0x6)
   383 xemacs-20.4 RET   fcntl 0
   383 xemacs-20.4 CALL  fcntl(0x6,0x6,0)
   383 xemacs-20.4 RET   fcntl 0
   383 xemacs-20.4 CALL  write(0x2,0xffff9b58,0x13)
   383 xemacs-20.4 GIO   fd 2 wrote 19 bytes
       "
        Fatal error (11).
       "


   419 xemacs-21.1-p2 NAMI  "/home/hauke/.xemacs"
   419 xemacs-21.1-p2 RET   __stat13 -1 errno 2 No such file or directory
   419 xemacs-21.1-p2 CALL  __stat13(0x2ec4ac,0xffffa45a)
   419 xemacs-21.1-p2 NAMI  "/usr/contrib/lib/xemacs-21.1-p2/site-packages"
   419 xemacs-21.1-p2 RET   __stat13 -1 errno 2 No such file or directory
   419 xemacs-21.1-p2 PSIG  SIGSEGV caught handler=0x26604 mask=0x0 code=0x0
   419 xemacs-21.1-p2 CALL  sigaction(0xb,0x1d7814,0x1d7824)
   419 xemacs-21.1-p2 RET   sigaction 0
   419 xemacs-21.1-p2 CALL  sigprocmask(0x2,0x400)
   419 xemacs-21.1-p2 RET   sigprocmask 1024/0x400
   419 xemacs-21.1-p2 CALL  write(0x2,0xffffa036,0x13)
   419 xemacs-21.1-p2 GIO   fd 2 wrote 19 bytes
       "
        Fatal error (11).
       "

[hauke@q700] ~/xemacs-test > ktrace -t+ -f xemacs-21.1-p2-2-ktrace.out /usr/src/contrib/xemacs-21.1/xemacs-21.1.2/src/xemacs  -vanilla
Fatal error (11).
Your files have been auto-saved.
Use `M-x recover-session' to recover them.

Please report this bug by running the send-pr script included
with XEmacs, or selecting `Send Bug Report' from the help menu.
As a last resort send ordinary email to `crashes@xemacs.org'.
*MAKE SURE* to include the information in the command
M-x describe-installation.

If at all possible, *please* try to obtain a C stack backtrace;
it will help us immensely in determining what went wrong.
To do this, locate the core file that was produced as a result
of this crash (it's usually called `core' and is located in the
directory in which you started the editor, or maybe in your home
directory), and type

  gdb /usr/src/contrib/xemacs-21.1/xemacs-21.1.2/src/xemacs core

then type `where' when the debugger prompt comes up.
(If you don't have GDB on your system, you might have DBX,
or XDB, or SDB.  A similar procedure should work for all of
these.  Ask your system administrator if you need more help.)

Lisp backtrace follows:

  # bind (keep-suffix default envvar base suffix roots)
  paths-find-emacs-directory(("/usr/src/contrib/xemacs-21.1/xemacs-21.1.2/" "/usr/contrib/") "lib/xemacs-21.1-p2/" "site-packages" nil nil t)
  # bind (enforce-version default envvar base roots)
  paths-find-version-directory(("/usr/src/contrib/xemacs-21.1/xemacs-21.1.2/" "/usr/contrib/") "site-packages" nil nil t)
  # bind (base roots)
  packages-find-package-directories(("/usr/src/contrib/xemacs-21.1/xemacs-21.1.2/" "/usr/contrib/") "site-packages")
  # bind (name roots)
  packages-find-packages-by-name(("/usr/src/contrib/xemacs-21.1/xemacs-21.1.2/" "/usr/contrib/") "site-packages")
  # bind (thunk a-time name)
  #<compiled-function (name a-time thunk) "...(19)" [time a-time thunk packages packages-find-packages-by-name roots name] 4>("site-packages" late #<compiled-function nil "...(2)" [t] 1>)
  apply(#<compiled-function (name a-time thunk) "...(19)" [time a-time thunk packages packages-find-packages-by-name roots name] 4> ("site-packages" late #<compiled-function nil "...(2)" [t] 1>))
  # bind (consumer list)
  packages-deconstruct(("site-packages" late #<compiled-function nil "...(2)" [t] 1>) #<compiled-function (name a-time thunk) "...(19)" [time a-time thunk packages packages-find-packages-by-name roots name] 4>)
  # bind (packages default time package-locations roots)
  packages-find-packages-at-time(("/usr/src/contrib/xemacs-21.1/xemacs-21.1.2/" "/usr/contrib/") (("~/.xemacs" early #<compiled-function nil "...(2)" ... 1>) ("site-packages" late #<compiled-function nil "...(2)" ... 1>) ("infodock-packages" late #<compiled-function nil "...(4)" ... 2>) ("mule-packages" late #<compiled-function nil "...(4)" ... 2>) ("xemacs-packages" late #<compiled-function nil "...(2)" ... 1>) ("packages" late #<compiled-function nil "...(2)" ... 1>)) late nil)
  # bind (configure-last-packages configure-late-packages configure-early-packages)
  #<compiled-function (configure-early-packages configure-late-packages configure-last-packages) "...(22)" [packages-find-packages-at-time roots package-locations early configure-early-packages late configure-late-packages last configure-last-packages] 7>How-To-Repeat:
Build any recent XEmacs on a pre-1.4 system, then update your libc.
Start xemacs.
Watch it crash in flames.
Curse the powers that be for leaving you out in the rain without the
editor that is dear to you.

 
>Fix:
No clue at all...
>Audit-Trail:
>Unformatted:
>(nil nil nil)
  apply(#<compiled-function (configure-early-packages configure-late-packages configure-last-packages) "...(22)" [packages-find-packages-at-time roots package-locations early configure-early-packages late configure-late-packages last configure-last-packages] 7> (nil nil nil))
  # bind (consumer list)
  packages-deconstruct((nil nil nil) #<compiled-function (configure-early-packages configure-late-packages configure-last-packages) "...(22)" [packages-find-packages-at-time roots package-locations early configure-early-packages late configure-late-packages last configure-last-packages] 7>)
  # bind (envvar-value roots)
  packages-find-packages(("/usr/src/contrib/xemacs-21.1/xemacs-21.1.2/" "/usr/contrib/"))
  # bind (debug-paths inhibit-site-lisp inhibit-early-packages roots)
  startup-setup-paths(("/usr/src/contrib/xemacs-21.1/xemacs-21.1.2/" "/usr/contrib/") t t nil)
  # bind (debug-paths)
  normal-top-level()
  # (condition-case ... . error)
  # (catch top-level ...)
Segmentation fault (core dumped)


From running an unstripped xemacs-21.1-p2...

[hauke@q700] ~/xemacs-test > gdb /usr/src/contrib/xemacs-21.1/xemacs-21.1.2/src/xemacs xemacs.core
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (m68k-netbsd), Copyright 1996 Free Software Foundation, Inc...
Core was generated by `xemacs'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/libexec/ld.so...done.
Reading symbols from /usr/X11R6/lib/libXaw.so.6.1...done.
Reading symbols from /usr/pkg/lib/libtiff.so.3.4...done.
Reading symbols from /usr/pkg/lib/libpng.so.1.1...done.
Reading symbols from /usr/pkg/lib/libjpeg.so.62.0...done.
Reading symbols from /usr/lib/libz.so.0.1...done.
Reading symbols from /usr/X11R6/lib/libXpm.so.4.8...done.
Reading symbols from /usr/X11R6/lib/libXmu.so.6.0...done.
Reading symbols from /usr/X11R6/lib/libXt.so.6.0...done.
Reading symbols from /usr/X11R6/lib/libXext.so.6.3...done.
Reading symbols from /usr/X11R6/lib/libX11.so.6.1...done.
Reading symbols from /usr/X11R6/lib/libSM.so.6.0...done.
Reading symbols from /usr/X11R6/lib/libICE.so.6.3...done.
Reading symbols from /usr/lib/libkvm.so.5.0...done.
Reading symbols from /usr/lib/libm.so.0.1...done.
Reading symbols from /usr/lib/libc.so.12.33...done.
#0  0x434dae2 in kill ()
(gdb) where
#0  0x434dae2 in kill ()
#1  0x266b4 in fatal_error_signal (sig=11) at emacs.c:263
(gdb)

-----------------------------------------------------------------------
/* Signal code for the fatal signal that was received */
static int fatal_error_code;

/* Nonzero if handling a fatal error already */
static int fatal_error_in_progress;

static void shut_down_emacs (int sig, Lisp_Object stuff);

/* Handle bus errors, illegal instruction, etc. */
SIGTYPE
fatal_error_signal (int sig)
{
  fatal_error_code = sig;
  signal (sig, SIG_DFL);
  /* Unblock the signal so that if the same signal gets sent in the
     code below, we avoid a deadlock. */
  EMACS_UNBLOCK_SIGNAL (fatal_error_code);

  /* If fatal error occurs in code below, avoid infinite recursion.  */
  if (! fatal_error_in_progress)
    {
      fatal_error_in_progress = dont_check_for_quit = 1;
      shut_down_emacs (sig, Qnil);
      stderr_out ("\nLisp backtrace follows:\n\n");
      Fbacktrace (Qexternal_debugging_output, Qt);
# if 0	/* This is evil, rarely useful, and causes grief in some cases. */
      /* Check for Sun-style stack printing via /proc */
      {
        CONST char *pstack = "/usr/proc/bin/pstack";
        if (access (pstack, X_OK) == 0)
          {
            char buf[100];
            stderr_out ("\nC backtrace follows:\n"
                       "(A real debugger may provide better information)\n\n");
            sprintf (buf, "%s %d >&2", pstack, (int)getpid());
            system (buf);
          }
      }
# endif
    }
  /* Signal the same code; this time it will really be fatal. */
  kill (getpid (), fatal_error_code);		<<<<<<<<<<<< Line 263
  SIGRETURN;
}
-----------------------------------------------------------------------