--- Begin Message ---
Subject: |
25.0.95; replace-match can crash emacs |
Date: |
Wed, 29 Jun 2016 22:17:20 +0800 |
Under some circumstances replace-match can crash emacs. It takes a lot
to reproduce the crash and I haven't been able to find a minimal
example. But I wonder if the backtrace that I captured in LLDB can give
any clue to the clause? I can't reproduce the same crash in emacs24.
Process 26639 resuming
Process 26639 stopped
* thread #1: tid = 0x16771fc, 0x0000000100280a5e
emacs`find_interval(tree=0x0000000000000000, position=-1) + 142 at
intervals.c:678, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=1, address=0x10)
frame #0: 0x0000000100280a5e emacs`find_interval(tree=0x0000000000000000,
position=-1) + 142 at intervals.c:678
675 while (1)
676 {
677 eassert (tree);
-> 678 if (relative_position < LEFT_TOTAL_LENGTH (tree))
679 {
680 tree = tree->left;
681 }
(lldb) bt
* thread #1: tid = 0x16771fc, 0x0000000100280a5e
emacs`find_interval(tree=0x0000000000000000, position=-1) + 142 at
intervals.c:678, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS
(code=1, address=0x10)
* frame #0: 0x0000000100280a5e emacs`find_interval(tree=0x0000000000000000,
position=-1) + 142 at intervals.c:678
frame #1: 0x000000010028356a emacs`set_point_both(charpos=-1, bytepos=-1) +
234 at intervals.c:1921
frame #2: 0x0000000100283476 emacs`set_point(charpos=-1) + 54 at
intervals.c:1816
frame #3: 0x0000000100284597 emacs`move_if_not_intangible(position=-1) +
855 at intervals.c:2157
frame #4: 0x00000001001abf19 emacs`Freplace_match(newtext=4298753236,
fixedcase=0, literal=0, string=0, subexp=6) + 8505 at search.c:2726
frame #5: 0x00000001001ff4f2 emacs`Ffuncall(nargs=6,
args=0x00007fff5fbfc638) + 1298 at eval.c:2709
frame #6: 0x000000010025dda1 emacs`exec_byte_code(bytestr=4309967268,
vector=4312661053, maxdepth=46, args_template=2054, nargs=2,
args=0x00007fff5fbfd058) + 3537 at bytecode.c:880
frame #7: 0x00000001002005a9 emacs`funcall_lambda(fun=4312661285, nargs=2,
arg_vector=0x00007fff5fbfd048) + 521 at eval.c:2855
frame #8: 0x00000001001ff687 emacs`Ffuncall(nargs=3,
args=0x00007fff5fbfd040) + 1703 at eval.c:2742
frame #9: 0x000000010025dda1 emacs`exec_byte_code(bytestr=4320265620,
vector=4312660189, maxdepth=26, args_template=3078, nargs=3,
args=0x00007fff5fbfdba8) + 3537 at bytecode.c:880
frame #10: 0x00000001002005a9 emacs`funcall_lambda(fun=4312660309, nargs=3,
arg_vector=0x00007fff5fbfdb90) + 521 at eval.c:2855
frame #11: 0x00000001001ff687 emacs`Ffuncall(nargs=4,
args=0x00007fff5fbfdb88) + 1703 at eval.c:2742
frame #12: 0x00000001001f571a emacs`Ffuncall_interactively(nargs=4,
args=0x00007fff5fbfdb88) + 58 at callint.c:252
frame #13: 0x00000001001ff2e0 emacs`Ffuncall(nargs=5,
args=0x00007fff5fbfdb80) + 768 at eval.c:2673
frame #14: 0x00000001001fef5c emacs`Fapply(nargs=3,
args=0x00007fff5fbfe320) + 1196 at eval.c:2321
frame #15: 0x00000001001f5bef emacs`Fcall_interactively(function=10062088,
record_flag=0, keys=4370513885) + 1215 at callint.c:389
frame #16: 0x00000001001ff45b emacs`Ffuncall(nargs=4,
args=0x00007fff5fbfe4c8) + 1147 at eval.c:2700
frame #17: 0x000000010025dda1 emacs`exec_byte_code(bytestr=4299648644,
vector=4299648677, maxdepth=54, args_template=4102, nargs=1,
args=0x00007fff5fbfeed8) + 3537 at bytecode.c:880
frame #18: 0x00000001002005a9 emacs`funcall_lambda(fun=4299648597, nargs=1,
arg_vector=0x00007fff5fbfeed0) + 521 at eval.c:2855
frame #19: 0x00000001001ff687 emacs`Ffuncall(nargs=2,
args=0x00007fff5fbfeec8) + 1703 at eval.c:2742
frame #20: 0x00000001001fffa4 emacs`call1(fn=15168, arg1=10062088) + 68 at
eval.c:2552
frame #21: 0x000000010013a9c3
emacs`__command_loop_1_block_invoke(.block_descriptor=<unavailable>) + 2147 at
keyboard.c:1519
frame #22: 0x00000001002e6252
emacs`mac_autorelease_loop(body=0x00007fff5fbff268) + 34 at macappkit.m:835
frame #23: 0x0000000100139ffa emacs`command_loop_1 + 794 at keyboard.c:1332
frame #24: 0x00000001001fd333
emacs`internal_condition_case(bfun=(emacs`command_loop_1 at keyboard.c:1283),
handlers=19680, hfun=(emacs`cmd_error at keyboard.c:935)) + 115 at eval.c:1309
frame #25: 0x000000010014fa52
emacs`__command_loop_2_block_invoke(.block_descriptor=<unavailable>) + 50 at
keyboard.c:1119
frame #26: 0x00000001002e6252
emacs`mac_autorelease_loop(body=0x00000001003839c0) + 34 at macappkit.m:835
frame #27: 0x000000010014f8fb emacs`command_loop_2(ignore=0) + 27 at
keyboard.c:1118
frame #28: 0x00000001001fcb08 emacs`internal_catch(tag=47616,
func=(emacs`command_loop_2 at keyboard.c:1116), arg=0) + 72 at eval.c:1074
frame #29: 0x000000010013924b emacs`command_loop + 251 at keyboard.c:1099
frame #30: 0x00000001001390b0 emacs`recursive_edit_1 + 192 at keyboard.c:692
frame #31: 0x00000001001393e1 emacs`Frecursive_edit + 305 at keyboard.c:763
frame #32: 0x00000001001370ac emacs`main(argc=14, argv=0x00007fff5fbff838)
+ 5740 at emacs.c:1650
frame #33: 0x00007fff950485ad libdyld.dylib`start + 1
frame #34: 0x00007fff950485ad libdyld.dylib`start + 1
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#23869: 25.0.95; replace-match can crash emacs |
Date: |
Mon, 04 Jul 2016 18:36:20 +0300 |
> From: Stefan Monnier <address@hidden>
> Cc: address@hidden, address@hidden
> Date: Sun, 03 Jul 2016 17:06:18 -0400
>
> > The only alternative I'm aware of is to detect the clobbering and
> > error out, as the patch I proposed does as "last line of defense".
>
> Sounds fine, yes.
>
> > Is that what you had in mind?
>
> I didn't have anything specific in mind, but indeed it's typically the
> approach I've taken so far in similar circumstances (e.g. detecting
> when syntax-propertize modified the buffer and cry foul if so).
Thanks, I installed on emacs-25 changes to do that, and I'm closing
this bug.
--- End Message ---