Subject: bug#11380: emacs compilation fails in call to oblookup() with len=-1

From: Dov Grobgeld <[email-masked]>
Date: Sun, 29 Apr 2012 21:41:06 +0300

All I know is that this happened by the following steps:

1. git clone from  git://repo.or.cz/emacs.git commit e3e392d
2. Apply the following patch, (a compilation in debug mode workaround that
I reported in a different bug report):

diff --git a/lib-src/etags.c b/lib-src/etags.c
index c88473a..8e8fd8b 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -229,7 +229,7 @@ If you want regular expression support, you should
delete this notice and
  * SYNOPSIS:   Type *xnew (int n, Type);
  *             void xrnew (OldPointer, int n, Type);
  */
-#if DEBUG
+#if 0
 # include "chkmalloc.h"
 # define xnew(n,Type)    ((Type *) trace_malloc (__FILE__, __LINE__, \
                                                  (n) * sizeof (Type)))

3. configure and make by the following steps:

./autogen.sh
./configure --prefix=/usr/local/public-dev/ CPPFLAGS=-DDEBUG CFLAGS="-g
-O0"

which output:

Configured for `i686-pc-linux-gnu'.

  Where should the build process find the source code?
/space/pub-repos/emacs.git
  What operating system and machine description files should Emacs use?
        `s/gnu-linux.h'
  What compiler should emacs be built with?               gcc -std=gnu99 -g
-O0
  Should Emacs use the GNU version of malloc?             yes
      (Using Doug Lea's new malloc from the GNU C Library.)
  Should Emacs use a relocating allocator for buffers?    no
  Should Emacs use mmap(2) for buffer allocation?         no
  What window system should Emacs use?                    x11
  What toolkit should Emacs use?                          GTK
  Where do we find X Windows header files?                Standard dirs
  Where do we find X Windows libraries?                   Standard dirs
  Does Emacs use -lXaw3d?                                 no
  Does Emacs use -lXpm?                                   yes
  Does Emacs use -ljpeg?                                  yes
  Does Emacs use -ltiff?                                  yes
  Does Emacs use a gif library?                           yes -lgif
  Does Emacs use -lpng?                                   yes
  Does Emacs use -lrsvg-2?                                yes
  Does Emacs use imagemagick?                             yes
  Does Emacs use -lgpm?                                   yes
  Does Emacs use -ldbus?                                  yes
  Does Emacs use -lgconf?                                 yes
  Does Emacs use GSettings?                               yes
  Does Emacs use -lselinux?                               yes
  Does Emacs use -lgnutls?                                yes
  Does Emacs use -lxml2?                                  yes
  Does Emacs use -lfreetype?                              yes
  Does Emacs use -lm17n-flt?                              yes
  Does Emacs use -lotf?                                   yes
  Does Emacs use -lxft?                                   yes
  Does Emacs use toolkit scroll bars?                     yes

make
:
Loading vc/ediff-hook...
Loading tooltip...
Finding pointers to doc strings...
/bin/sh: line 8:  5927 Segmentation fault      (core dumped) LC_ALL=C
`/bin/pwd`/temacs -batch -l loadup dump
make[1]: *** [emacs] Error 1
make[1]: Leaving directory `/space/pub-repos/emacs.git/src'
make: *** [src] Error 2

Here is a stacktrace of the crash:

#0  0x08200062 in hash_string (ptr=0xbfffe8db "(defalias
'save-selected-window '(macro . #[(&rest body)\037Fwindow-right\nReturn
WINDOW's right sibling.\nReturn nil if WINDOW is the root window of its
frame.  WINDOW can\nbe any window.\037Fwindow-left\nRetu"..., len=-1) at
fns.c:4116
#1  0x0821b647 in oblookup (obarray=139216261, ptr=0xbfffe8db "(defalias
'save-selected-window '(macro . #[(&rest body)\037Fwindow-right\nReturn
WINDOW's right sibling.\nReturn nil if WINDOW is the root window of its
frame.  WINDOW can\nbe any window.\037Fwindow-left\nRetu"..., size=0,
size_byte=-1) at lread.c:3906
#2  0x081e1b9e in Fsnarf_documentation (filename=139966033) at doc.c:658
#3  0x081f2779 in eval_sub (form=142566062) at eval.c:2283
#4  0x081ef753 in Fprogn (args=142562518) at eval.c:364
#5  0x081f08f9 in Flet (args=142574270) at eval.c:1053
#6  0x081f252c in eval_sub (form=142574310) at eval.c:2231
#7  0x081ef692 in Fif (args=142574342) at eval.c:314
#8  0x081f252c in eval_sub (form=142576646) at eval.c:2231
#9  0x08217a32 in readevalloop (readcharfun=139290210, stream=0x84edfb0,
sourcename=139299913, printflag=0, unibyte=139222370, readfun=139222370,
start=139222370, end=139222370) at lread.c:1837
#10 0x08216a15 in Fload (file=139299785, noerror=139222370,
nomessage=139222370, nosuffix=139222370, must_suffix=139222370) at
lread.c:1315
#11 0x081f284d in eval_sub (form=139201958) at eval.c:2297
#12 0x081f227d in Feval (form=139201958, lexical=139222370) at eval.c:2137
#13 0x0816dd7c in top_level_2 () at keyboard.c:1169
#14 0x081f1122 in internal_condition_case (bfun=0x816dd5f <top_level_2>,
handlers=139253426, hfun=0x816d9b9 <cmd_error>) at eval.c:1448
#15 0x0816ddb0 in top_level_1 (ignore=139222370) at keyboard.c:1177
#16 0x081f0bf4 in internal_catch (tag=139251378, func=0x816dd7e
<top_level_1>, arg=139222370) at eval.c:1205
#17 0x0816dce6 in command_loop () at keyboard.c:1132
#18 0x0816d5f2 in recursive_edit_1 () at keyboard.c:759
#19 0x0816d743 in Frecursive_edit () at keyboard.c:823
#20 0x0816bbc9 in main (argc=5, argv=0xbffff8e4) at emacs.c:1711

Lisp Backtrace:
"Snarf-documentation" (0xbfffebb4)
"let" (0xbfffedcc)
"if" (0xbfffeeec)
"load" (0xbffff164)

Regards,
Dov

On Sun, Apr 29, 2012 at 21:13, Andreas Schwab <[email-masked]> wrote:

> Dov Grobgeld <[email-masked]> writes:
>
> > building emacs crashes in src/doc.c::oblookup() with len=-1.
>
> That cannot happen unless make-docfile is broken.
>
> Andreas.
>
> --
> Andreas Schwab, [email-masked]
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>