Subject: Re: bug#15364: 24.3; git emacs segfault on loading local wubi phrases

From: Eli Zaretskii <[email-masked]>
Date: Sat, 14 Sep 2013 13:05:49 +0300

> From: Eric Abrahamsen <[email-masked]>
> Cc: [email-masked]
> Date: Sat, 14 Sep 2013 16:47:48 +0800
> 
> > It would help if you report the steps necessary to reproduce the
> > problem, starting with "emacs -Q".  If that requires a non-empty
> > phrase file, please post a minimal file that can be used to reproduce
> > the crash.
> >
> > Thanks for the other info.
> 
> Yup, you'll need a file. I've done a little testing. It looks like
> everything loads fine until the file reaches 4095 lines. I'm attaching
> the txt file, of exactly 4095 lines, and a test file, to be run as emacs
> -Q -l wubi-test.el (the paths need to be changed). Running that test
> will produce the .el file, then attempt to load the phrases, and then in
> my case segfault.
> 
> Hope that's enough!
> 
> (add-to-list 'load-path "~/path/to/wubi")
> (require 'wubi)
> (setq wubi-phrases-file "my-wubi-phrases-test.txt")
> (setq wubi-phrases-file-el "my-wubi-phrases-test.el")
> (wubi-load-local-phrases)

Yes, it was enough.  The backtrace from the assertion violation
triggered by this recipe appears below; I hope someone will be able to
make sense of it.

Note that I byte-compiled the *.el files with the latest trunk, to
avoid some potential incompatibilities between 7-year old *.elc files
and the current byte-run code.

eval.c:195: Emacs fatal error: assertion failed: pdl->kind == SPECPDL_BACKTRACE

Breakpoint 1, terminate_due_to_signal (sig=22, backtrace_limit=2147483647)
    at emacs.c:342
342       signal (sig, SIG_DFL);
(gdb) bt
#0  terminate_due_to_signal (sig=22, backtrace_limit=2147483647)
    at emacs.c:342
#1  0x01155c0d in die (
    msg=0x1499014 <DEFAULT_REHASH_SIZE+92> "pdl->kind == SPECPDL_BACKTRACE",
    file=0x1498fc0 <DEFAULT_REHASH_SIZE+8> "eval.c", line=195) at alloc.c:6575
#2  0x0116e81f in set_backtrace_args (pdl=0x3705b20, args=0x105f4000)
    at eval.c:195
#3  0x01174ac6 in apply_lambda (fun=271162485, args=56849758) at eval.c:2963
#4  0x01173441 in eval_sub (form=56849806) at eval.c:2271
#5  0x011a0678 in readevalloop (readcharfun=59666949, stream=0x0,
    sourcename=61089569, printflag=false, unibyte=55945242, readfun=55945242,
    start=55945242, end=55945242) at lread.c:1876
#6  0x011a0907 in Feval_buffer (buffer=59666949, printflag=55945242,
    filename=61103489, unibyte=55945242, do_allow_print=55945266)
    at lread.c:1937
#7  0x011746dd in Ffuncall (nargs=6, args=0x82e364) at eval.c:2872
#8  0x011b807d in exec_byte_code (bytestr=19429753, vector=19429773,
    maxdepth=24, args_template=55945242, nargs=0, args=0x0) at bytecode.c:905
#9  0x0117516f in funcall_lambda (fun=19429693, nargs=4, arg_vector=0x82e544)
    at eval.c:3090
#10 0x0117482f in Ffuncall (nargs=5, args=0x82e540) at eval.c:2905
#11 0x011741a5 in call4 (fn=57660354, arg1=61103489, arg2=61103489,
    arg3=55945242, arg4=55945242) at eval.c:2704
#12 0x0119efa2 in Fload (file=61102193, noerror=55945242, nomessage=55945242,
    nosuffix=55945242, must_suffix=55945242) at lread.c:1294
#13 0x011746dd in Ffuncall (nargs=2, args=0x82eb58) at eval.c:2872
#14 0x011b807d in exec_byte_code (bytestr=19386897, vector=19525349,
    maxdepth=12, args_template=1028, nargs=1, args=0x82ed1c) at bytecode.c:905
#15 0x01174dc4 in funcall_lambda (fun=19525317, nargs=1, arg_vector=0x82ed18)
    at eval.c:3024
#16 0x0117482f in Ffuncall (nargs=2, args=0x82ed14) at eval.c:2905
#17 0x011b807d in exec_byte_code (bytestr=56278913, vector=55995341,
    maxdepth=12, args_template=55945242, nargs=0, args=0x0) at bytecode.c:905
#18 0x0117516f in funcall_lambda (fun=57135173, nargs=0, arg_vector=0x82ee80)
    at eval.c:3090
#19 0x01174af6 in apply_lambda (fun=57135173, args=55945242) at eval.c:2965
#20 0x01173441 in eval_sub (form=268894518) at eval.c:2271
#21 0x011a0678 in readevalloop (readcharfun=55975429, stream=0x0,
    sourcename=55945242, printflag=false, unibyte=55945242, readfun=55945242,
    start=55979371, end=57055123) at lread.c:1876
#22 0x011a09e4 in Feval_region (start=764, end=1572, printflag=55945242,
    read_function=55945242) at lread.c:1972
#23 0x01174693 in Ffuncall (nargs=3, args=0x82f1c0) at eval.c:2867
#24 0x0116e142 in Fcall_interactively (function=56061290,
    record_flag=58492698, keys=55992325) at callint.c:836
#25 0x01174653 in Ffuncall (nargs=4, args=0x82f3ac) at eval.c:2863
#26 0x011b807d in exec_byte_code (bytestr=19787505, vector=19787525,
    maxdepth=52, args_template=4100, nargs=2, args=0x82f5a0) at bytecode.c:905
#27 0x01174dc4 in funcall_lambda (fun=19787485, nargs=2, arg_vector=0x82f598)
    at eval.c:3024
#28 0x0117482f in Ffuncall (nargs=3, args=0x82f594) at eval.c:2905
#29 0x011b807d in exec_byte_code (bytestr=19787177, vector=19787197,
    maxdepth=60, args_template=2052, nargs=2, args=0x82f77c) at bytecode.c:905
#30 0x01174dc4 in funcall_lambda (fun=19787149, nargs=2, arg_vector=0x82f774)
    at eval.c:3024
#31 0x0117482f in Ffuncall (nargs=3, args=0x82f770) at eval.c:2905
#32 0x01173b03 in Fapply (nargs=2, args=0x82f810) at eval.c:2395
#33 0x0117408a in apply1 (fn=56130522, arg=59474310) at eval.c:2629
#34 0x0116c773 in Fcall_interactively (function=56130522,
    record_flag=55945242, keys=55992325) at callint.c:378
#35 0x01174653 in Ffuncall (nargs=4, args=0x82fa0c) at eval.c:2863
#36 0x011b807d in exec_byte_code (bytestr=19787505, vector=19787525,
    maxdepth=52, args_template=4100, nargs=1, args=0x82fbf0) at bytecode.c:905
#37 0x01174dc4 in funcall_lambda (fun=19787485, nargs=1, arg_vector=0x82fbec)
    at eval.c:3024
#38 0x0117482f in Ffuncall (nargs=2, args=0x82fbe8) at eval.c:2905
#39 0x011740e5 in call1 (fn=55991138, arg1=56130522) at eval.c:2655
#40 0x010e221c in command_loop_1 () at keyboard.c:1562
#41 0x011712ed in internal_condition_case (bfun=0x10e19cd <command_loop_1>,
    handlers=55999706, hfun=0x10e1259 <cmd_error>) at eval.c:1339
#42 0x010e169c in command_loop_2 (ignore=55945242) at keyboard.c:1163
#43 0x01170bc9 in internal_catch (tag=55989586,
    func=0x10e1679 <command_loop_2>, arg=55945242) at eval.c:1113
#44 0x010e1654 in command_loop () at keyboard.c:1142
#45 0x010e0e13 in recursive_edit_1 () at keyboard.c:781
#46 0x010e0fc3 in Frecursive_edit () at keyboard.c:845
#47 0x010df215 in main (argc=2, argv=0xa42878) at emacs.c:1570

Lisp Backtrace:
"wubi-batch-add" (0x82e1f0)
"eval-buffer" (0x82e368)
"load-with-code-conversion" (0x82e544)
"load" (0x82eb5c)
"load-library" (0x82ed18)
"wubi-load-local-phrases" (0x82ee80)
"eval-region" (0x82f1c4)
"call-interactively" (0x82f3b0)
"command-execute" (0x82f598)
"execute-extended-command" (0x82f774)
"call-interactively" (0x82fa10)
"command-execute" (0x82fbec)
(gdb) frame 2
#2  0x0116e81f in set_backtrace_args (pdl=0x3705b20, args=0x105f4000)
    at eval.c:195
195       eassert (pdl->kind == SPECPDL_BACKTRACE);
(gdb) p pdl->kind
$1 = SPECPDL_UNWIND
(gdb)