Subject: bug#12242: Emacs 24.2 RC1 build fails on OpenBSD

From: [email-masked] (Jérémie Courrèges-Anglas)
Date: Mon, 20 Aug 2012 21:53:16 +0200

Hi.

Sorry for being late.  The RC1 archive fails to build on
OpenBSD/i386 -current (post 5.2) and OpenBSD/macppc -stable (5.1).
Emacs 24.1 was building and running properly.

I use
$ ./configure --without-x && gmake
[snip]
EMACSLOADPATH=/home/jca/src/emacs-24.2/leim/../lisp LC_ALL=C ../src/emacs -batch --no-site-file --no-site-lisp  -l /home/jca/src/emacs-24.2/leim/../lisp/international/qua
il \
  -f batch-byte-compile-if-not-done quail/CCDOSPY.el quail/Punct.el quail/QJ.el quail/SW.el quail/TONEPY.el quail/4Corner.el quail/ARRAY30.el quail/ECDICT.el quail/ETZY.e
l quail/Punct-b5.el quail/PY-b5.el quail/QJ-b5.el quail/ZOZY.el quail/tsang-b5.el quail/quick-b5.el quail/tsang-cns.el quail/quick-cns.el quail/PY.el quail/ZIRANMA.el qua
il/CTLau.el quail/CTLau-b5.el
if [ x`(cd /home/jca/src/emacs-24.2/leim && /bin/pwd)` = x`(/bin/pwd)` ] ; then \
  EMACSLOADPATH=/home/jca/src/emacs-24.2/leim/../lisp LC_ALL=C ../src/emacs -batch --no-site-file --no-site-lisp -l /home/jca/src/emacs-24.2/leim/../lisp/international/qu
ail \
    --eval "(update-leim-list-file \".\")" ; \
else \
  EMACSLOADPATH=/home/jca/src/emacs-24.2/leim/../lisp LC_ALL=C ../src/emacs -batch --no-site-file --no-site-lisp -l /home/jca/src/emacs-24.2/leim/../lisp/international/qu
ail \
    --eval "(update-leim-list-file \".\" \"/home/jca/src/emacs-24.2/leim\")" ; \
fi
Updating /home/jca/src/emacs-24.2/leim/leim-list.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/PY.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/quick-cns.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/tsang-cns.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/ZIRANMA.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/CTLau-b5.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/CTLau.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/quick-b5.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/tsang-b5.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/ZOZY.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/TONEPY.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/SW.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/QJ.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/QJ-b5.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/Punct.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/Punct-b5.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/PY-b5.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/ETZY.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/ECDICT.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/CCDOSPY.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/ARRAY30.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/4Corner.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/indian.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/ipa.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/latin-post.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/czech.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/japanese.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/thai.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/arabic.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/hanja3.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/latin-ltx.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/hanja-jis.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/hebrew.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/symbol-ksc.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/hangul.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/lao.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/georgian.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/croatian.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/persian.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/hanja.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/slovak.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/lrt.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/tibetan.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/pypunct-b5.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/sgml-input.el ...
Checking /home/jca/src/emacs-24.2/leim/quail/cyril-jis.el ...
Fatal error (11)Segmentation fault (core dumped) 
gmake[1]: *** [leim-list.el] Error 139
gmake[1]: Leaving directory `/home/jca/src/emacs-24.2/leim'
gmake: *** [leim] Error 2
$ 

The backtrace looks like this (slightly mangled by copy/paste), using
the default `-g -O2' CFLAGS on OpenBSD/powerpc:

opyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or 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.
This GDB was configured as "powerpc-unknown-openbsd5.1"...
Core was generated by `emacs'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libossaudio.so.3.1...done.
Loaded symbols for /usr/lib/libossaudio.so.3.1
Reading symbols from /usr/local/lib/libdbus-1.so.9.1...done.
Loaded symbols for /usr/local/lib/libdbus-1.so.9.1
Reading symbols from /usr/lib/libncurses.so.12.1...done.
Loaded symbols for /usr/lib/libncurses.so.12.1
Reading symbols from /usr/lib/libpthread.so.13.3...done.
Loaded symbols for /usr/lib/libpthread.so.13.3
Reading symbols from /usr/lib/libm.so.7.0...done.
Loaded symbols for /usr/lib/libm.so.7.0
Reading symbols from /usr/lib/libc.so.62.0...done.
Loaded symbols for /usr/lib/libc.so.62.0
Reading symbols from /usr/libexec/ld.so...done.
Loaded symbols for /usr/libexec/ld.so
#0  free_bloc (bloc=0x1b8fa80) at ralloc.c:719
719       if (heap->first_bloc == bloc)
(gdb) bt
#0  free_bloc (bloc=0x1b8fa80) at ralloc.c:719
#1  0x01968d5c in r_alloc_free (ptr=0x2381608) at ralloc.c:939
#2  0x018baf1c in Fkill_buffer (buffer_or_name=Variable "buffer_or_name" is not available.
) at buffer.c:4845
#3  0x0190a630 in Ffuncall (nargs=2, args=Variable "args" is not available.
) at eval.c:3001
#4  0x01945070 in exec_byte_code (bytestr=Variable "bytestr" is not available.
) at bytecode.c:785
#5  0x019099c8 in eval_sub (form=Variable "form" is not available.
) at eval.c:2355
#6  0x01909ccc in Fprogn (args=Variable "args" is not available.
) at eval.c:364
#7  0x0190852c in unbind_to (count=Variable "count" is not available.
) at eval.c:3433
#8  0x01944fdc in exec_byte_code (bytestr=Variable "bytestr" is not available.
) at bytecode.c:807
#9  0x01909fb8 in funcall_lambda (fun=31484933, nargs=1, arg_vector=0xffff90c8)
    at eval.c:3232
#10 0x0190a3b4 in Ffuncall (nargs=2, args=Variable "args" is not available.
) at eval.c:3062
#11 0x0190acc8 in Fapply (nargs=2, args=0xffff90c4) at eval.c:2453
#12 0x0190a6d0 in Ffuncall (nargs=3, args=Variable "args" is not available.
) at eval.c:2983
#13 0x01945070 in exec_byte_code (bytestr=Variable "bytestr" is not available.
) at bytecode.c:785
#14 0x01909fb8 in funcall_lambda (fun=27442485, nargs=1, arg_vector=0xffff91d0)
    at eval.c:3232
#15 0x0190b878 in apply_lambda (fun=27442485, args=Variable "args" is not available.
) at eval.c:3109
#16 0x01909788 in eval_sub (form=Variable "form" is not available.
) at eval.c:2413
#17 0x0190c438 in Feval (form=29386182, lexical=Variable "lexical" is not available.
) at eval.c:2203
#18 0x0190a61c in Ffuncall (nargs=2, args=Variable "args" is not available.
) at eval.c:3004
#19 0x01945070 in exec_byte_code (bytestr=Variable "bytestr" is not available.
) at bytecode.c:785
#20 0x01909dd4 in funcall_lambda (fun=27219261, nargs=1, arg_vector=0xffff9564)
    at eval.c:3166
#21 0x0190a3b4 in Ffuncall (nargs=2, args=Variable "args" is not available.
) at eval.c:3062
#22 0x01945070 in exec_byte_code (bytestr=Variable "bytestr" is not available.
) at bytecode.c:785
#23 0x01909dd4 in funcall_lambda (fun=27206509, nargs=0, arg_vector=0xffff9738)
    at eval.c:3166
#24 0x0190a3b4 in Ffuncall (nargs=1, args=Variable "args" is not available.
) at eval.c:3062
#25 0x01945070 in exec_byte_code (bytestr=Variable "bytestr" is not available.
) at bytecode.c:785
#26 0x01909dd4 in funcall_lambda (fun=27203701, nargs=0, arg_vector=0xffff9850)
    at eval.c:3166
#27 0x0190b878 in apply_lambda (fun=27203701, args=Variable "args" is not available.
) at eval.c:3109
#28 0x01909788 in eval_sub (form=Variable "form" is not available.
) at eval.c:2413
#29 0x0190c438 in Feval (form=29389358, lexical=Variable "lexical" is not available.
) at eval.c:2203
#30 0x0189cbe8 in top_level_2 () at keyboard.c:1169
#31 0x0190d6fc in internal_condition_case (bfun=0x189cbc8 <top_level_2>,
    handlers=29186386, hfun=0x18a0f74 <cmd_error>) at eval.c:1514
#32 0x018a1430 in top_level_1 (ignore=Variable "ignore" is not available.
) at keyboard.c:1177
#33 0x0190d804 in internal_catch (tag=Variable "tag" is not available.
) at eval.c:1271
#34 0x018a1260 in recursive_edit_1 () at keyboard.c:1132
#35 0x018a13d0 in Frecursive_edit () at keyboard.c:823
#36 0x01895718 in main (argc=8, argv=0x0) at emacs.c:1715

The same error happens consistently on both architectures (whether
I use `--without-x' or not).

$ ./configure --without-x REL_ALLOC=no
and
$ ./configure --without-x CFLAGS=-g

both seem to `fix' the problem, but I've only done light testing so far.

Using git bisect, I was able to track the build error up to the
573c8f870aa68b8c5937524e1a4db645026a3240 git commit id:

     Backport: Really fix bug #11519, by fixing the last change in ralloc.c.

      src/ralloc.c (r_alloc_inhibit_buffer_relocation): Fix stupid
      thinko
      in the logic of incrementing and decrementing the value of
      use_relocatable_buffers.

Sorry for not providing the hg commit id.
Reverting that commit actually makes rc1 build again, but I have not
tried to find a proper fix.

On the other hand, rc1 builds and seems to work fine so far on Debian
Squeeze (powerpc). :)
Please don't hesitate if you need further action on my part.

Regards,
-- 
Jérémie Courrèges-Anglas
GPG fingerprint: 61DB D9A0 00A4 67CF 2A90 8961 6191 8FBF 06A1 1494