Subject: Re: bug#27668: 26.0.50; Crash with display-line-numbers t

From: Robert Pluim <[email-masked]>
Date: Fri, 14 Jul 2017 10:59:17 +0200

Eli Zaretskii <[email-masked]> writes:

>> From: Robert Pluim <[email-masked]>
>> (gdb) pgrowx it->glyph_row
>> TEXT: 66 glyphs
>>   0    0: CHAR[ ] pos=-1 blev=2,btyp=EN w=16 a+d=25+6 face=51 MB AVOID
>>   1   16: CHAR[1] pos=-1 blev=2,btyp=EN w=16 a+d=25+6 face=51 MB AVOID
>>   2   32: CHAR[2] pos=-1 blev=2,btyp=EN w=16 a+d=25+6 face=51 MB AVOID
>>   3   48: CHAR[6] pos=-1 blev=2,btyp=EN w=16 a+d=25+6 face=51 MB AVOID
>>   4   64: CHAR[1] pos=-1 blev=2,btyp=EN w=16 a+d=25+6 face=51 MB AVOID
>>   5   80: CHAR[ ] pos=-1 blev=2,btyp=EN w=16 a+d=25+6 face=51 MB AVOID
>>   6   96: CHAR[ ] pos=37180 blev=0,btyp=L w=16 a+d=25+6 MB
>
> Hmm...  I'm not sure how this happened, but I have a theory.  I've now
> made a change in master based on that theory, and also added an
> assertion where you previously had to set a breakpoint.  Please see if
> the current master fixes the problem and doesn't hit the assertion in
> maybe_produce_line_number.

git describe  HEAD
emacs-24.5-rc3-fixed-13053-g60d24e1681

(gdb) run
Starting program: /home/rpluim/repos/emacs-master/src/emacs 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffe4de5700 (LWP 6631)]
[New Thread 0x7fffdffff700 (LWP 6632)]
[New Thread 0x7fffdf5f1700 (LWP 6633)]

xdisp.c:21012: Emacs fatal error: assertion failed: it->glyph_row == NULL || it->glyph_row->used[TEXT_AREA] == 0

Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=sig@entry=6, 
    backtrace_limit=backtrace_limit@entry=2147483647) at emacs.c:363
363	{
(gdb) bt
#0  terminate_due_to_signal (sig=sig@entry=6, backtrace_limit=backtrace_limit@entry=2147483647) at emacs.c:363
#1  0x00000000005a4ed4 in die (msg=msg@entry=0x67aec0 "it->glyph_row == NULL || it->glyph_row->used[TEXT_AREA] == 0", 
    file=file@entry=0x678e68 "xdisp.c", line=line@entry=21012) at alloc.c:7348
#2  0x000000000045befb in maybe_produce_line_number (it=it@entry=0x7fffffff8130) at xdisp.c:21012
#3  0x0000000000465335 in display_line (it=it@entry=0x7fffffff8130, cursor_vpos=cursor_vpos@entry=9) at xdisp.c:21227
#4  0x000000000046728d in try_window (window=..., window@entry=XIL(0x146e6c5), pos=..., flags=flags@entry=1)
    at xdisp.c:17544
#5  0x000000000047f8fb in redisplay_window (window=XIL(0x146e6c5), just_this_one_p=just_this_one_p@entry=false)
    at xdisp.c:16991
#6  0x000000000048314b in redisplay_window_0 (window=..., window@entry=XIL(0x146e6c5)) at xdisp.c:14751
#7  0x00000000005c7b44 in internal_condition_case_1 (bfun=bfun@entry=0x483120 <redisplay_window_0>, arg=..., 
    handlers=..., hfun=hfun@entry=0x435900 <redisplay_window_error>) at eval.c:1350
#8  0x000000000043d100 in redisplay_windows (window=...) at xdisp.c:14731
#9  0x000000000043d0c9 in redisplay_windows (window=...) at xdisp.c:14725
#10 0x000000000046c915 in redisplay_internal () at xdisp.c:14220
#11 0x000000000046eea5 in redisplay () at xdisp.c:13440
#12 0x0000000000545b4b in read_char (commandflag=commandflag@entry=1, map=..., map@entry=XIL(0x346a793), 
    prev_event=..., used_mouse_menu=used_mouse_menu@entry=0x7fffffffd6cb, end_time=end_time@entry=0x0)
    at keyboard.c:2484
#13 0x0000000000548c2b in read_key_sequence (keybuf=keybuf@entry=0x7fffffffd7b0, prompt=..., prompt@entry=XIL(0), 
    dont_downcase_last=dont_downcase_last@entry=false, can_return_switch_frame=can_return_switch_frame@entry=true, 
    fix_current_buffer=fix_current_buffer@entry=true, prevent_redisplay=prevent_redisplay@entry=false, bufsize=30)
    at keyboard.c:9151
#14 0x000000000054aee6 in command_loop_1 () at keyboard.c:1372
#15 0x00000000005c7a77 in internal_condition_case (bfun=bfun@entry=0x54ac40 <command_loop_1>, handlers=..., 
    handlers@entry=XIL(0x4fb0), hfun=hfun@entry=0x53e5c0 <cmd_error>) at eval.c:1326
#16 0x0000000000537f2c in command_loop_2 (ignore=..., ignore@entry=XIL(0)) at keyboard.c:1114
#17 0x00000000005c79bc in internal_catch (tag=..., tag@entry=XIL(0xc1e0), func=func@entry=0x537f10 <command_loop_2>, 
    arg=..., arg@entry=XIL(0)) at eval.c:1091
#18 0x0000000000537ee9 in command_loop () at keyboard.c:1093
#19 0x000000000053e0e6 in recursive_edit_1 () at keyboard.c:699
#20 0x000000000053e463 in Frecursive_edit () at keyboard.c:770
#21 0x000000000041aceb in main (argc=<optimized out>, argv=0x7fffffffdb58) at emacs.c:1706

Lisp Backtrace:

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

Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=sig@entry=6, 
    backtrace_limit=backtrace_limit@entry=2147483647) at emacs.c:363
363	{

I was looking at a commit in Magit, and had just hit enter in a diff
hunk to view the source file containing the change, so it's happening
when we switch from non-line-number to line-number mode.

Robert