all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#61887: 30.0.50; Segfault on revert-buffer-with-coding-system
@ 2023-02-28 21:48 Petteri Hintsanen
  2023-03-01 12:47 ` Eli Zaretskii
  2023-03-03 23:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 7+ messages in thread
From: Petteri Hintsanen @ 2023-02-28 21:48 UTC (permalink / raw)
  To: 61887

Hello,

After editing a binary file in nhexl-mode, calling 
revert-buffer-with-coding-system crashed Emacs.  This happened initially 
on Emacs 28.2, but the current master branch crashes as well.

Please find a recipe below and gdb backtrace.

thanks,
Petteri



Preparation:

- Get nhexl-mode-1.5 from ELPA.

- Create a test file "junk.dat" with:

     dd if=/dev/random of=junk.dat bs=1k count=5k

   or use any existing large binary file (5 MBs or more).

Recipe:

./gdb --args emacs -Q

In *scratch* buffer, type

   (add-to-list 'load-path "~/.emacs.d/elpa/nhexl-mode-1.5")
   (require 'nhexl-mode)

M-x eval-buffer

M-x find-file-literally junk.dat

M-x nhexl-mode RET

M-x nhexl-mode RET

C-x RET r utf-8 RET yes RET



GDB output:

Starting program: /home/phintsan/src/emacs/src/emacs -Q
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff0986700 (LWP 250563)]
[New Thread 0x7fffebfff700 (LWP 250564)]
[New Thread 0x7fffea4ce700 (LWP 250565)]

Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
0x00005555557be729 in balance_an_interval (i=0x55555b47e090) at 
intervals.c:390
390		  new_diff = i->total_length - i->left->total_length
#0  0x00005555557be729 in balance_an_interval (i=0x55555b47e090)
     at intervals.c:390
         old_diff = 1
#1  0x00005555557be7c8 in balance_an_interval (i=0x55555b47d980)
     at intervals.c:395
         old_diff = <optimized out>
#2  0x00005555557be7c8 in balance_an_interval (i=0x55555b47d540)
     at intervals.c:395
         old_diff = <optimized out>
#3  0x00005555557be7c8 in balance_an_interval (i=0x55555b47d100)
     at intervals.c:395
         old_diff = <optimized out>
#4  0x00005555557be7c8 in balance_an_interval (i=0x55555b47d008)
     at intervals.c:395
         old_diff = <optimized out>
#5  0x00005555557be7c8 in balance_an_interval (i=0x55555b477cd0)
     at intervals.c:395
         old_diff = <optimized out>
#6  0x00005555557be7c8 in balance_an_interval (i=0x55555b475f50)
     at intervals.c:395
         old_diff = <optimized out>
#7  0x00005555557be7c8 in balance_an_interval (i=0x55555b473c80)
     at intervals.c:395
         old_diff = <optimized out>
#8  0x00005555557be7c8 in balance_an_interval (i=0x55555b466340)
     at intervals.c:395
         old_diff = <optimized out>
#9  0x00005555557be7c8 in balance_an_interval (i=0x55555b45d5a0)
     at intervals.c:395
         old_diff = <optimized out>
#10 0x00005555557be7c8 in balance_an_interval (i=0x55555b4384c0)
     at intervals.c:395
         old_diff = <optimized out>
#11 0x00005555557be7c8 in balance_an_interval (i=0x55555b3f1150)
     at intervals.c:395
         old_diff = <optimized out>
#12 0x00005555557be7c8 in balance_an_interval (i=0x55555b32e570)
     at intervals.c:395
         old_diff = <optimized out>
#13 0x00005555557be7c8 in balance_an_interval (i=0x55555b223ef0)
     at intervals.c:395
         old_diff = <optimized out>
#14 0x00005555557be7c8 in balance_an_interval (i=0x55555afb8160)
     at intervals.c:395
         old_diff = <optimized out>
#15 0x00005555557be7c8 in balance_an_interval (i=0x55555abbf160)
     at intervals.c:395
         old_diff = <optimized out>
#16 0x00005555557be7c8 in balance_an_interval (i=0x55555a619680)
     at intervals.c:395
         old_diff = <optimized out>
#17 0x00005555557be7c8 in balance_an_interval (i=0x5555595b7758)
     at intervals.c:395
         old_diff = <optimized out>
#18 0x00005555557be89d in balance_an_interval (i=0x55555b47ded0) at 
intervals.c:405
         old_diff = <optimized out>
#19 0x00005555557be953 in balance_possible_root_interval 
(interval=interval@entry=0x55555b47dfb0) at intervals.c:430
         parent = <optimized out>
         have_parent = false
#20 0x00005555557bfbda in split_interval_right 
(interval=interval@entry=0x55555b47dfb0, offset=offset@entry=-1) at 
intervals.c:517
         new = 0x55555b47ded0
         position = <optimized out>
         new_length = <optimized out>
#21 0x00005555557c34d9 in copy_intervals (tree=<optimized out>, 
start=start@entry=7476, length=length@entry=5033991) at intervals.c:2257
         i = 0x555558258930
         new = 0x555555e81ec8
         t = 0x55555b47dfb0
         got = 266489
         prevlen = -1
#22 0x00005555557c356d in copy_intervals_to_string 
(string=string@entry=XIL(0x555556866ae4), buffer=<optimized out>, 
position=position@entry=7476, length=length@entry=5033991) at 
intervals.c:2272
         interval_copy = <optimized out>
#23 0x0000555555754af0 in make_buffer_string_both 
(start=start@entry=7476, start_byte=start_byte@entry=11087, 
end=end@entry=5041467, end_byte=end_byte@entry=7485872, 
props=props@entry=true) at editfns.c:1629
         result = XIL(0x555556866ae4)
         tem = <optimized out>
         tem1 = <optimized out>
         beg0 = 11087
         end0 = <optimized out>
         beg1 = <optimized out>
         end1 = -1
         size = 7474785
#24 0x00005555556fdf77 in del_range_2 (from=7476, 
from_byte=from_byte@entry=11087, to=to@entry=5041467, 
to_byte=to_byte@entry=7485872, ret_string=ret_string@entry=false) at 
insdel.c:1905
         nbytes_del = 7474785
         nchars_del = 5033991
         deletion = <optimized out>
#25 0x0000555555700908 in del_range_byte 
(from_byte=from_byte@entry=11087, to_byte=to_byte@entry=7485872) at 
insdel.c:1826
         from = 7476
         to = 5041467
#26 0x000055555570e267 in Finsert_file_contents 
(filename=XIL(0x555556058384), visit=XIL(0x30), beg=<optimized out>, 
end=<optimized out>, replace=XIL(0x30)) at fileio.c:4533
         bufpos = <optimized out>
         this = 0
         decoded = <optimized out>
         temp = <optimized out>
         same_at_start_charpos = <optimized out>
         inserted_chars = <optimized out>
         overlap = <optimized out>
         conversion_buffer = XIL(0x5555565c8425)
         st = {
           st_dev = 2081,
           st_ino = 31720858,
           st_nlink = 1,
           st_mode = 33200,
           st_uid = 1000,
           st_gid = 1000,
           __pad0 = 0,
           st_rdev = 0,
           st_size = 5242880,
           st_blksize = 4096,
           st_blocks = 10240,
           st_atim = {
             tv_sec = 1677619312,
             tv_nsec = 984772057
           },
           st_mtim = {
             tv_sec = 1677619265,
             tv_nsec = 828917393
           },
           st_ctim = {
             tv_sec = 1677619265,
             tv_nsec = 828917393
           },
           __glibc_reserved = {0, 0, 0}
         }
         mtime = {
           tv_sec = 1677619265,
           tv_nsec = 828917393
         }
         fd = <optimized out>
         inserted = 7476702
         unprocessed = <optimized out>
         handler = XIL(0)
         val = XIL(0)
         insval = <optimized out>
         orig_filename = XIL(0x555556058384)
         old_undo = XIL(0)
         p = XIL(0)
         total = 0
         regular = <optimized out>
         save_errno = 0
         read_buf = 
"\236/\242k\231Grs\246\237\350\314n;\201\v<ՙ)\300\020g\243?;6s$(F\340\302\323\353\231\306uV4ț\262\330%\313\356\342A\246\345\312Q\024@Ó\213\272\256\027\317\062W\327\265\363\324,\315'>?\375\230N\fq\356\n\033*\207\006\260\232R\201\252Lm\330>G\003\220e\306ձ#\"\264MuI\245\342\263\006Y\314;\334R\253\314)\003\237\303\027˔\nBCAhwS\311\030<\275\037\264?\231:\364Z\303\350K̋}Ч\004^^\222\222\252\264S\226\330\310\306G\316'\360\364\067\376\300\363\276\222\061T\254\277\002s~=~\203\207\237r\266MC98\213\266\262$\260o\373~r\334Z\206\216\271?\262\b"...
         coding = {
           id = 34,
           common_flags = 3072,
           mode = 0,
           src_multibyte = false,
           dst_multibyte = true,
           chars_at_source = false,
           raw_destination = false,
           annotated = false,
           eol_seen = 0,
           result = CODING_RESULT_SUCCESS,
           max_charset_id = 2,
           spec = {
             iso_2022 = {
               flags = 1,
               current_invocation = {0, 0},
               current_designation = {0, 0, 0, 0},
               ctext_extended_segment_len = 0,
               single_shifting = false,
               bol = false,
               embedded_utf_8 = false,
               cmp_status = {
                 state = COMPOSING_NO,
                 method = COMPOSITION_RELATIVE,
                 old_form = false,
                 length = 0,
                 nchars = 0,
                 ncomps = 0,
                 carryover = {0, 0, 0, -1700890880, 688408954, 0, 0, 
-28004, 32767, 1441713600, 21845, -28032, 32767, 1447517104, 21845, 
-28036, 32767, 1, 0, -147550513, 32767, 0, 0, -26144, 32767, -27904, 
32767, -28020, 32767, 0, 0, -147554525, 32767, -26144, 32767, 
-146502432, 32767, -26144, 32767, 2, 0, 1, 0, -147548944, 32767, 1, 0, 
1447517104, 21845, -28036, 32767, 0, 0, 0, 0, 1447379664, 21845, 0, 0, 
0, 0, 1447379664, 21845, 2, -8388608, -8388608, 16777215, 16777215}
               }
             },
             ccl = 0x1,
             utf_16 = {
               bom = utf_without_bom,
               endian = utf_16_big_endian,
               surrogate = 0
             },
             utf_8_bom = utf_without_bom,
             emacs_mule = {
               cmp_status = {
                 state = COMPOSING_CHAR,
                 method = COMPOSITION_RELATIVE,
                 old_form = false,
                 length = 0,
                 nchars = 0,
                 ncomps = 0,
                 carryover = {0 <repeats 12 times>, -1700890880, 
688408954, 0, 0, -28004, 32767, 1441713600, 21845, -28032, 32767, 
1447517104, 21845, -28036, 32767, 1, 0, -147550513, 32767, 0, 0, -26144, 
32767, -27904, 32767, -28020, 32767, 0, 0, -147554525, 32767, -26144, 
32767, -146502432, 32767, -26144, 32767, 2, 0, 1, 0, -147548944, 32767, 
1, 0, 1447517104, 21845, -28036, 32767, 0, 0, 0, 0, 1447379664, 21845, 0, 0}
               }
             },
             undecided = {
               inhibit_nbd = 1,
               inhibit_ied = 0,
               prefer_utf_8 = false
             }
           },
           safe_charsets = 0x7ffff20bfb97 "\377\377",
           head_ascii = 0,
           detected_utf8_bytes = 5317169512448,
           detected_utf8_chars = 1080,
           produced = 289,
           produced_char = 194,
           consumed = 202,
           consumed_char = 202,
           src_pos = 0,
           src_pos_byte = 0,
           src_chars = 202,
           src_bytes = 202,
           src_object = XIL(0),
           source = 0x7fffffff93b0 
"\236/\242k\231Grs\246\237\350\314n;\201\v<ՙ)\300\020g\243?;6s$(F\340\302\323\353\231\306uV4ț\262\330%\313\356\342A\246\345\312Q\024@Ó\213\272\256\027\317\062W\327\265\363\324,\315'>?\375\230N\fq\356\n\033*\207\006\260\232R\201\252Lm\330>G\003\220e\306ձ#\"\264MuI\245\342\263\006Y\314;\334R\253\314)\003\237\303\027˔\nBCAhwS\311\030<\275\037\264?\231:\364Z\303\350K̋}Ч\004^^\222\222\252\264S\226\330\310\306G\316'\360\364\067\376\300\363\276\222\061T\254\277\002s~=~\203\207\237r\266MC98\213\266\262$\260o\373~r"...,
           dst_pos = 5043114,
           dst_pos_byte = 7488325,
           dst_bytes = 49205,
           dst_object = XIL(0x5555565c8425),
           destination = 0x7fffe8e11354 
"\300\236/\300\242k\300\231Grs\300\246\300\237\301\250\301\214n;\300\201\v<ՙ)\301\200\020g\300\243?;6s$(F\301\240\301\202\301\223\301\253\300\231\301\206uV4ț\300\262\301\230%\301\213\301\256\301\242A\300\246\301\245\301\212Q\024@Ó\300\213\300\272\300\256\027\301\217\062W\327\265\301\263\301\224,\301\215'>?\301\275\300\230N\fq\301\256\n\033*\300\207\006\300\260\300\232R\300\201\300\252Lm\301\230>G\003\300\220e\301\206ձ#\"\300\264MuI\300\245\301\242\300\263\006Y\301\214;\301\234R\300\253\301\214)\003\300\237\301\203\027˔\nBCAhwS\301\211\030<\300\275\037\300\264?\300\231:\301\264Z\301"...,
           charbuf = 0x7fffffff89c0,
           charbuf_size = 218,
           charbuf_used = 194,
           carryover = "\236\265\275", '\000' <repeats 19 times>, 
"\360?", '\000' <repeats 22 times>, 
"\360?\000\000\000\000\000\000\360?\000\000\000\000\000\000\360?",
           carryover_bytes = 0,
           default_char = 32,
           detector = 0x555555643090 <detect_coding_utf_8>,
           decoder = 0x55555563c530 <decode_coding_utf_8>,
           encoder = 0x555555635b60 <encode_coding_utf_8>
         }
         replace_handled = <optimized out>
         set_coding_system = true
         coding_system = XIL(0x115e0)
         read_quit = 0
         empty_undo_list_p = <optimized out>
         we_locked_file = <optimized out>
         window_markers = <optimized out>
         same_at_start = 11087
         same_at_end = 7485872
         same_at_end_charpos = 5041467
         seekable = <optimized out>
         beg_offset = <optimized out>
         end_offset = <optimized out>
#27 0x000055555579efc5 in exec_byte_code (fun=<optimized out>, 
args_template=<optimized out>, nargs=<optimized out>, args=<optimized 
out>) at bytecode.c:809
         call_nargs = 5
         call_fun = <optimized out>
         template = <optimized out>
         val = <optimized out>
         call_args = 0x7ffff0b6d238
         original_fun = XIL(0x9810)
         bytecode = <optimized out>
         op = 5
         type = <optimized out>
         targets = {0x5555555a3e69 <exec_byte_code-2076087>, 
0x55555579f42b <exec_byte_code+2059>, 0x55555579f426 
<exec_byte_code+2054>, 0x55555579f421 <exec_byte_code+2049>, 
0x55555579ede2 <exec_byte_code+450>, 0x55555579ede2 
<exec_byte_code+450>, 0x55555579f3ed <exec_byte_code+1997>, 
0x55555579f3b9 <exec_byte_code+1945>, 0x55555579fb21 
<exec_byte_code+3841>, 0x55555579fb1c <exec_byte_code+3836>, 
0x55555579fb17 <exec_byte_code+3831>, 0x55555579fb12 
<exec_byte_code+3826>, 0x55555579ee11 <exec_byte_code+497>, 
0x55555579ee18 <exec_byte_code+504>, 0x55555579fb04 
<exec_byte_code+3812>, 0x55555579fa88 <exec_byte_code+3688>, 
0x55555579fba8 <exec_byte_code+3976>, 0x55555579fba3 
<exec_byte_code+3971>, 0x55555579fb9e <exec_byte_code+3966>, 
0x55555579fb99 <exec_byte_code+3961>, 0x55555579ed7a 
<exec_byte_code+346>, 0x55555579ed80 <exec_byte_code+352>, 
0x55555579fb7d <exec_byte_code+3933>, 0x55555579fb8b 
<exec_byte_code+3947>, 0x55555579fb30 <exec_byte_code+3856>, 
0x55555579fb2b <exec_byte_code+3851>, 0x55555579fb26 
<exec_byte_code+3846>, 0x5555557a00d8 <exec_byte_code+5304>, 
0x55555579f014 <exec_byte_code+1012>, 0x55555579f018 
<exec_byte_code+1016>, 0x55555579fb43 <exec_byte_code+3875>, 
0x55555579fb35 <exec_byte_code+3861>, 0x5555557a00b7 
<exec_byte_code+5271>, 0x5555557a00b2 <exec_byte_code+5266>, 
0x5555557a00ad <exec_byte_code+5261>, 0x5555557a00a8 
<exec_byte_code+5256>, 0x55555579ee75 <exec_byte_code+597>, 
0x55555579ee78 <exec_byte_code+600>, 0x5555557a00ca 
<exec_byte_code+5290>, 0x5555557a00bc <exec_byte_code+5276>, 
0x5555557a0087 <exec_byte_code+5223>, 0x5555557a0082 
<exec_byte_code+5218>, 0x5555557a007d <exec_byte_code+5213>, 
0x5555557a0078 <exec_byte_code+5208>, 0x55555579f058 
<exec_byte_code+1080>, 0x55555579f060 <exec_byte_code+1088>, 
0x5555557a009a <exec_byte_code+5242>, 0x5555557a008c 
<exec_byte_code+5228>, 0x55555579fd0a <exec_byte_code+4330>, 
0x55555579fd37 <exec_byte_code+4375>, 0x55555579fda0 
<exec_byte_code+4480>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555557a0f40 
<exec_byte_code+8992>, 0x5555557a0ee1 <exec_byte_code+8897>, 
0x5555557a0ea5 <exec_byte_code+8837>, 0x5555557a0e69 
<exec_byte_code+8777>, 0x5555557a0e2a <exec_byte_code+8714>, 
0x55555579fc1b <exec_byte_code+4091>, 0x55555579fbe1 
<exec_byte_code+4033>, 0x5555557a0dff <exec_byte_code+8671>, 
0x55555579fa96 <exec_byte_code+3702>, 0x55555579fbad 
<exec_byte_code+3981>, 0x5555557a0dc5 <exec_byte_code+8613>, 
0x5555557a0d9c <exec_byte_code+8572>, 0x5555557a0d62 
<exec_byte_code+8514>, 0x5555557a0d2c <exec_byte_code+8460>, 
0x5555557a0cf2 <exec_byte_code+8402>, 0x5555557a0c8d 
<exec_byte_code+8301>, 0x5555557a0c1e <exec_byte_code+8190>, 
0x5555557a0bac <exec_byte_code+8076>, 0x5555557a0b83 
<exec_byte_code+8035>, 0x5555557a0b5a <exec_byte_code+7994>, 
0x5555557a0b20 <exec_byte_code+7936>, 0x5555557a0ae6 
<exec_byte_code+7878>, 0x5555557a0aac <exec_byte_code+7820>, 
0x5555557a0a6e <exec_byte_code+7758>, 0x5555557a0a3b 
<exec_byte_code+7707>, 0x5555557a0a08 <exec_byte_code+7656>, 
0x5555557a09d5 <exec_byte_code+7605>, 0x5555557a0944 
<exec_byte_code+7460>, 0x5555557a08ef <exec_byte_code+7375>, 
0x5555557a08a4 <exec_byte_code+7300>, 0x5555557a0856 
<exec_byte_code+7222>, 0x5555557a0808 <exec_byte_code+7144>, 
0x5555557a07ba <exec_byte_code+7066>, 0x5555557a076c 
<exec_byte_code+6988>, 0x5555557a071a <exec_byte_code+6906>, 
0x5555557a06c4 <exec_byte_code+6820>, 0x5555557a0672 
<exec_byte_code+6738>, 0x5555557a0620 <exec_byte_code+6656>, 
0x5555557a05ce <exec_byte_code+6574>, 0x5555557a057b 
<exec_byte_code+6491>, 0x5555557a049d <exec_byte_code+6269>, 
0x55555579f0a2 <exec_byte_code+1154>, 0x5555557a0474 
<exec_byte_code+6228>, 0x5555557a0446 <exec_byte_code+6182>, 
0x5555557a03c7 <exec_byte_code+6055>, 0x5555557a0384 
<exec_byte_code+5988>, 0x5555557a035b <exec_byte_code+5947>, 
0x5555557a0330 <exec_byte_code+5904>, 0x5555557a0305 
<exec_byte_code+5861>, 0x5555557a02d2 <exec_byte_code+5810>, 
0x5555557a02a7 <exec_byte_code+5767>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x5555557a027c <exec_byte_code+5724>, 
0x5555557a0251 <exec_byte_code+5681>, 0x5555557a0226 
<exec_byte_code+5638>, 0x5555557a01fb <exec_byte_code+5595>, 
0x5555557a01d0 <exec_byte_code+5552>, 0x5555557a01a7 
<exec_byte_code+5511>, 0x55555579f0a2 <exec_byte_code+1154>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555557a0169 
<exec_byte_code+5449>, 0x5555557a0140 <exec_byte_code+5408>, 
0x5555557a0117 <exec_byte_code+5367>, 0x5555557a00dd 
<exec_byte_code+5309>, 0x55555579fa4e <exec_byte_code+3630>, 
0x55555579fa25 <exec_byte_code+3589>, 0x55555579f9fc 
<exec_byte_code+3548>, 0x55555579f9c2 <exec_byte_code+3490>, 
0x55555579f988 <exec_byte_code+3432>, 0x55555579f94e 
<exec_byte_code+3374>, 0x55555579f923 <exec_byte_code+3331>, 
0x55555579f8fa <exec_byte_code+3290>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x55555579fe91 <exec_byte_code+4721>, 
0x5555557a0023 <exec_byte_code+5123>, 0x55555579faca 
<exec_byte_code+3754>, 0x55555579ffe9 <exec_byte_code+5065>, 
0x55555579ffb2 <exec_byte_code+5010>, 0x55555579ff7b 
<exec_byte_code+4955>, 0x55555579fee3 <exec_byte_code+4803>, 
0x55555579fec5 <exec_byte_code+4773>, 0x55555579fb51 
<exec_byte_code+3889>, 0x55555579fe73 <exec_byte_code+4691>, 
0x55555579fe17 <exec_byte_code+4599>, 0x55555579fde9 
<exec_byte_code+4553>, 0x55555579fda8 <exec_byte_code+4488>, 
0x55555579fcbf <exec_byte_code+4255>, 0x5555557a101e 
<exec_byte_code+9214>, 0x5555557a0fdb <exec_byte_code+9147>, 
0x5555557a0f84 <exec_byte_code+9060>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x55555579f8bc <exec_byte_code+3228>, 
0x55555579f893 <exec_byte_code+3187>, 0x55555579f86a 
<exec_byte_code+3146>, 0x55555579f841 <exec_byte_code+3105>, 
0x55555579f818 <exec_byte_code+3064>, 0x55555579f7de 
<exec_byte_code+3006>, 0x55555579f7a4 <exec_byte_code+2948>, 
0x55555579f76a <exec_byte_code+2890>, 0x55555579f730 
<exec_byte_code+2832>, 0x55555579f6e5 <exec_byte_code+2757>, 
0x55555579f6ab <exec_byte_code+2699>, 0x55555579f671 
<exec_byte_code+2641>, 0x55555579f648 <exec_byte_code+2600>, 
0x55555579f5ea <exec_byte_code+2506>, 0x55555579f58c 
<exec_byte_code+2412>, 0x55555579f559 <exec_byte_code+2361>, 
0x55555579f526 <exec_byte_code+2310>, 0x55555579f4f6 
<exec_byte_code+2262>, 0x5555557a0529 <exec_byte_code+6409>, 
0x5555557a04e0 <exec_byte_code+6336>, 0x55555579f490 
<exec_byte_code+2160>, 0x55555579f430 <exec_byte_code+2064>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555557a0cb6 <exec_byte_code+8342>, 0x5555557a0999 
<exec_byte_code+7545>, 0x5555557a040a <exec_byte_code+6122>, 
0x55555579f37d <exec_byte_code+1885>, 0x55555579f341 
<exec_byte_code+1825>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x55555579f312 
<exec_byte_code+1778>, 0x55555579f2b9 <exec_byte_code+1689>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x55555579f289 <exec_byte_code+1641> <repeats 
64 times>}
         quitcounter = 1 '\001'
         bc = 0x555555ceae50 <main_thread+496>
         top = <optimized out>
         pc = <optimized out>
         bytestr = <optimized out>
         vector = <optimized out>
         maxdepth = <optimized out>
         bytestr_length = <optimized out>
         vectorp = 0x7ffff1842b50
         frame_base = <optimized out>
         fp = <optimized out>
         bytestr_data = <optimized out>
         rest = <optimized out>
         mandatory = <optimized out>
         nonrest = <optimized out>
         pushedargs = <optimized out>
         result = <optimized out>
#28 0x00005555557596e3 in Ffuncall (nargs=nargs@entry=3, 
args=args@entry=0x7fffffffd508) at eval.c:2997
         val = <optimized out>
#29 0x000055555575557f in Ffuncall_interactively (nargs=3, 
args=0x7fffffffd508) at callint.c:250
#30 0x00005555557596e3 in Ffuncall (nargs=nargs@entry=4, 
args=args@entry=0x7fffffffd500) at eval.c:2997
         val = <optimized out>
#31 0x0000555555756ab3 in Fcall_interactively (function=<optimized out>, 
record_flag=<optimized out>, keys=<optimized out>) at callint.c:787
         speccount = {
           bytes = <optimized out>
         }
         arg_from_tty = <optimized out>
         key_count = <optimized out>
         record_then_fail = <optimized out>
         save_this_command = <optimized out>
         save_this_original_command = <optimized out>
         save_real_this_command = <optimized out>
         save_last_command = <optimized out>
         prefix_arg = <optimized out>
         enable = <optimized out>
         up_event = <optimized out>
         form = <optimized out>
         specs = <optimized out>
         sa_avail = <optimized out>
         string_len = <optimized out>
         string = <optimized out>
         string_end = <optimized out>
         next_event = <optimized out>
         nargs = <optimized out>
         args = <optimized out>
         visargs = <optimized out>
         tem = <optimized out>
         val = <optimized out>
#32 0x000055555579efc5 in exec_byte_code (fun=<optimized out>, 
args_template=<optimized out>, nargs=<optimized out>, args=<optimized 
out>) at bytecode.c:809
         call_nargs = 3
         call_fun = <optimized out>
         template = <optimized out>
         val = <optimized out>
         call_args = 0x7ffff0b6d070
         original_fun = XIL(0x2aaa9ba7fe78)
         bytecode = <optimized out>
         op = 3
         type = <optimized out>
         targets = {0x5555555a3e69 <exec_byte_code-2076087>, 
0x55555579f42b <exec_byte_code+2059>, 0x55555579f426 
<exec_byte_code+2054>, 0x55555579f421 <exec_byte_code+2049>, 
0x55555579ede2 <exec_byte_code+450>, 0x55555579ede2 
<exec_byte_code+450>, 0x55555579f3ed <exec_byte_code+1997>, 
0x55555579f3b9 <exec_byte_code+1945>, 0x55555579fb21 
<exec_byte_code+3841>, 0x55555579fb1c <exec_byte_code+3836>, 
0x55555579fb17 <exec_byte_code+3831>, 0x55555579fb12 
<exec_byte_code+3826>, 0x55555579ee11 <exec_byte_code+497>, 
0x55555579ee18 <exec_byte_code+504>, 0x55555579fb04 
<exec_byte_code+3812>, 0x55555579fa88 <exec_byte_code+3688>, 
0x55555579fba8 <exec_byte_code+3976>, 0x55555579fba3 
<exec_byte_code+3971>, 0x55555579fb9e <exec_byte_code+3966>, 
0x55555579fb99 <exec_byte_code+3961>, 0x55555579ed7a 
<exec_byte_code+346>, 0x55555579ed80 <exec_byte_code+352>, 
0x55555579fb7d <exec_byte_code+3933>, 0x55555579fb8b 
<exec_byte_code+3947>, 0x55555579fb30 <exec_byte_code+3856>, 
0x55555579fb2b <exec_byte_code+3851>, 0x55555579fb26 
<exec_byte_code+3846>, 0x5555557a00d8 <exec_byte_code+5304>, 
0x55555579f014 <exec_byte_code+1012>, 0x55555579f018 
<exec_byte_code+1016>, 0x55555579fb43 <exec_byte_code+3875>, 
0x55555579fb35 <exec_byte_code+3861>, 0x5555557a00b7 
<exec_byte_code+5271>, 0x5555557a00b2 <exec_byte_code+5266>, 
0x5555557a00ad <exec_byte_code+5261>, 0x5555557a00a8 
<exec_byte_code+5256>, 0x55555579ee75 <exec_byte_code+597>, 
0x55555579ee78 <exec_byte_code+600>, 0x5555557a00ca 
<exec_byte_code+5290>, 0x5555557a00bc <exec_byte_code+5276>, 
0x5555557a0087 <exec_byte_code+5223>, 0x5555557a0082 
<exec_byte_code+5218>, 0x5555557a007d <exec_byte_code+5213>, 
0x5555557a0078 <exec_byte_code+5208>, 0x55555579f058 
<exec_byte_code+1080>, 0x55555579f060 <exec_byte_code+1088>, 
0x5555557a009a <exec_byte_code+5242>, 0x5555557a008c 
<exec_byte_code+5228>, 0x55555579fd0a <exec_byte_code+4330>, 
0x55555579fd37 <exec_byte_code+4375>, 0x55555579fda0 
<exec_byte_code+4480>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555557a0f40 
<exec_byte_code+8992>, 0x5555557a0ee1 <exec_byte_code+8897>, 
0x5555557a0ea5 <exec_byte_code+8837>, 0x5555557a0e69 
<exec_byte_code+8777>, 0x5555557a0e2a <exec_byte_code+8714>, 
0x55555579fc1b <exec_byte_code+4091>, 0x55555579fbe1 
<exec_byte_code+4033>, 0x5555557a0dff <exec_byte_code+8671>, 
0x55555579fa96 <exec_byte_code+3702>, 0x55555579fbad 
<exec_byte_code+3981>, 0x5555557a0dc5 <exec_byte_code+8613>, 
0x5555557a0d9c <exec_byte_code+8572>, 0x5555557a0d62 
<exec_byte_code+8514>, 0x5555557a0d2c <exec_byte_code+8460>, 
0x5555557a0cf2 <exec_byte_code+8402>, 0x5555557a0c8d 
<exec_byte_code+8301>, 0x5555557a0c1e <exec_byte_code+8190>, 
0x5555557a0bac <exec_byte_code+8076>, 0x5555557a0b83 
<exec_byte_code+8035>, 0x5555557a0b5a <exec_byte_code+7994>, 
0x5555557a0b20 <exec_byte_code+7936>, 0x5555557a0ae6 
<exec_byte_code+7878>, 0x5555557a0aac <exec_byte_code+7820>, 
0x5555557a0a6e <exec_byte_code+7758>, 0x5555557a0a3b 
<exec_byte_code+7707>, 0x5555557a0a08 <exec_byte_code+7656>, 
0x5555557a09d5 <exec_byte_code+7605>, 0x5555557a0944 
<exec_byte_code+7460>, 0x5555557a08ef <exec_byte_code+7375>, 
0x5555557a08a4 <exec_byte_code+7300>, 0x5555557a0856 
<exec_byte_code+7222>, 0x5555557a0808 <exec_byte_code+7144>, 
0x5555557a07ba <exec_byte_code+7066>, 0x5555557a076c 
<exec_byte_code+6988>, 0x5555557a071a <exec_byte_code+6906>, 
0x5555557a06c4 <exec_byte_code+6820>, 0x5555557a0672 
<exec_byte_code+6738>, 0x5555557a0620 <exec_byte_code+6656>, 
0x5555557a05ce <exec_byte_code+6574>, 0x5555557a057b 
<exec_byte_code+6491>, 0x5555557a049d <exec_byte_code+6269>, 
0x55555579f0a2 <exec_byte_code+1154>, 0x5555557a0474 
<exec_byte_code+6228>, 0x5555557a0446 <exec_byte_code+6182>, 
0x5555557a03c7 <exec_byte_code+6055>, 0x5555557a0384 
<exec_byte_code+5988>, 0x5555557a035b <exec_byte_code+5947>, 
0x5555557a0330 <exec_byte_code+5904>, 0x5555557a0305 
<exec_byte_code+5861>, 0x5555557a02d2 <exec_byte_code+5810>, 
0x5555557a02a7 <exec_byte_code+5767>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x5555557a027c <exec_byte_code+5724>, 
0x5555557a0251 <exec_byte_code+5681>, 0x5555557a0226 
<exec_byte_code+5638>, 0x5555557a01fb <exec_byte_code+5595>, 
0x5555557a01d0 <exec_byte_code+5552>, 0x5555557a01a7 
<exec_byte_code+5511>, 0x55555579f0a2 <exec_byte_code+1154>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555557a0169 
<exec_byte_code+5449>, 0x5555557a0140 <exec_byte_code+5408>, 
0x5555557a0117 <exec_byte_code+5367>, 0x5555557a00dd 
<exec_byte_code+5309>, 0x55555579fa4e <exec_byte_code+3630>, 
0x55555579fa25 <exec_byte_code+3589>, 0x55555579f9fc 
<exec_byte_code+3548>, 0x55555579f9c2 <exec_byte_code+3490>, 
0x55555579f988 <exec_byte_code+3432>, 0x55555579f94e 
<exec_byte_code+3374>, 0x55555579f923 <exec_byte_code+3331>, 
0x55555579f8fa <exec_byte_code+3290>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x55555579fe91 <exec_byte_code+4721>, 
0x5555557a0023 <exec_byte_code+5123>, 0x55555579faca 
<exec_byte_code+3754>, 0x55555579ffe9 <exec_byte_code+5065>, 
0x55555579ffb2 <exec_byte_code+5010>, 0x55555579ff7b 
<exec_byte_code+4955>, 0x55555579fee3 <exec_byte_code+4803>, 
0x55555579fec5 <exec_byte_code+4773>, 0x55555579fb51 
<exec_byte_code+3889>, 0x55555579fe73 <exec_byte_code+4691>, 
0x55555579fe17 <exec_byte_code+4599>, 0x55555579fde9 
<exec_byte_code+4553>, 0x55555579fda8 <exec_byte_code+4488>, 
0x55555579fcbf <exec_byte_code+4255>, 0x5555557a101e 
<exec_byte_code+9214>, 0x5555557a0fdb <exec_byte_code+9147>, 
0x5555557a0f84 <exec_byte_code+9060>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x55555579f8bc <exec_byte_code+3228>, 
0x55555579f893 <exec_byte_code+3187>, 0x55555579f86a 
<exec_byte_code+3146>, 0x55555579f841 <exec_byte_code+3105>, 
0x55555579f818 <exec_byte_code+3064>, 0x55555579f7de 
<exec_byte_code+3006>, 0x55555579f7a4 <exec_byte_code+2948>, 
0x55555579f76a <exec_byte_code+2890>, 0x55555579f730 
<exec_byte_code+2832>, 0x55555579f6e5 <exec_byte_code+2757>, 
0x55555579f6ab <exec_byte_code+2699>, 0x55555579f671 
<exec_byte_code+2641>, 0x55555579f648 <exec_byte_code+2600>, 
0x55555579f5ea <exec_byte_code+2506>, 0x55555579f58c 
<exec_byte_code+2412>, 0x55555579f559 <exec_byte_code+2361>, 
0x55555579f526 <exec_byte_code+2310>, 0x55555579f4f6 
<exec_byte_code+2262>, 0x5555557a0529 <exec_byte_code+6409>, 
0x5555557a04e0 <exec_byte_code+6336>, 0x55555579f490 
<exec_byte_code+2160>, 0x55555579f430 <exec_byte_code+2064>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555557a0cb6 <exec_byte_code+8342>, 0x5555557a0999 
<exec_byte_code+7545>, 0x5555557a040a <exec_byte_code+6122>, 
0x55555579f37d <exec_byte_code+1885>, 0x55555579f341 
<exec_byte_code+1825>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x55555579f312 
<exec_byte_code+1778>, 0x55555579f2b9 <exec_byte_code+1689>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x5555555a3e69 <exec_byte_code-2076087>, 
0x5555555a3e69 <exec_byte_code-2076087>, 0x5555555a3e69 
<exec_byte_code-2076087>, 0x55555579f289 <exec_byte_code+1641> <repeats 
64 times>}
         quitcounter = 1 '\001'
         bc = 0x555555ceae50 <main_thread+496>
         top = <optimized out>
         pc = <optimized out>
         bytestr = <optimized out>
         vector = <optimized out>
         maxdepth = <optimized out>
         bytestr_length = <optimized out>
         vectorp = 0x7ffff18b4a80
         frame_base = <optimized out>
         fp = <optimized out>
         bytestr_data = <optimized out>
         rest = <optimized out>
         mandatory = <optimized out>
         nonrest = <optimized out>
         pushedargs = <optimized out>
         result = <optimized out>
#33 0x00005555557596e3 in Ffuncall (nargs=nargs@entry=2, 
args=args@entry=0x7fffffffd7f0) at eval.c:2997
         val = <optimized out>
#34 0x00005555556e1cde in call1 (arg1=<optimized out>, fn=XIL(0x4cb0)) 
at lisp.h:3247
         cmd = XIL(0x7fffffffd7f0)
         keybuf = {make_fixnum(24), make_fixnum(13), make_fixnum(114), 
XIL(0x80), XIL(0x7ffff1b33395), XIL(0x7fffffffd810), make_fixnum(4), 
XIL(0), XIL(0x4000000011000000), XIL(0x555555d74fe0), XIL(0x3), 
XIL(0x2aaa9bdbe380), XIL(0x7fffffffd920), XIL(0x55555575cf0d), 
XIL(0x3500000014), make_fixnum(133143986203), XIL(0), XIL(0x80), XIL(0), 
XIL(0x60), XIL(0), XIL(0x30), XIL(0x7ffff17ea70d), XIL(0x555555821370), 
XIL(0x9c00), make_fixnum(23456248587376), XIL(0x7fffffffda58), 
XIL(0x7ffff544e299), XIL(0xb), XIL(0x9c00)}
         i = <optimized out>
         prev_modiff = 123
         prev_buffer = 0x5555567a7b58
#35 command_loop_1 () at keyboard.c:1494
         cmd = XIL(0x7fffffffd7f0)
         keybuf = {make_fixnum(24), make_fixnum(13), make_fixnum(114), 
XIL(0x80), XIL(0x7ffff1b33395), XIL(0x7fffffffd810), make_fixnum(4), 
XIL(0), XIL(0x4000000011000000), XIL(0x555555d74fe0), XIL(0x3), 
XIL(0x2aaa9bdbe380), XIL(0x7fffffffd920), XIL(0x55555575cf0d), 
XIL(0x3500000014), make_fixnum(133143986203), XIL(0), XIL(0x80), XIL(0), 
XIL(0x60), XIL(0), XIL(0x30), XIL(0x7ffff17ea70d), XIL(0x555555821370), 
XIL(0x9c00), make_fixnum(23456248587376), XIL(0x7fffffffda58), 
XIL(0x7ffff544e299), XIL(0xb), XIL(0x9c00)}
         i = <optimized out>
         prev_modiff = 123
         prev_buffer = 0x5555567a7b58
#36 0x0000555555757e27 in internal_condition_case 
(bfun=bfun@entry=0x5555556e18e0 <command_loop_1>, 
handlers=handlers@entry=XIL(0x90), hfun=hfun@entry=0x5555556d4d00 
<cmd_error>) at eval.c:1474
         val = <optimized out>
         c = 0x555555e71eb0
#37 0x00005555556cd9a2 in command_loop_2 
(handlers=handlers@entry=XIL(0x90)) at keyboard.c:1124
         val = <optimized out>
#38 0x0000555555757d81 in internal_catch (tag=tag@entry=XIL(0x103e0), 
func=func@entry=0x5555556cd980 <command_loop_2>, 
arg=arg@entry=XIL(0x90)) at eval.c:1197
         val = <optimized out>
         c = 0x555555e71400
#39 0x00005555556cd93e in command_loop () at lisp.h:1164
#40 0x00005555556d48b3 in recursive_edit_1 () at keyboard.c:711
         val = <optimized out>
#41 0x00005555556d4c2c in Frecursive_edit () at keyboard.c:794
         buffer = <optimized out>
#42 0x00005555555a78b7 in main (argc=<optimized out>, argv=<optimized 
out>) at emacs.c:2530
         stack_bottom_variable = 0x7ffff5a13660
         no_loadup = false
         junk = 0x0
         dname_arg = 0x0
         ch_to_dir = 0x0
         original_pwd = <optimized out>
         dump_mode = <optimized out>
         skip_args = 0
         temacs = 0x0
         attempt_load_pdump = <optimized out>
         only_version = <optimized out>
         rlim = {
           rlim_cur = 10022912,
           rlim_max = 18446744073709551615
         }
         lc_all = <optimized out>
         sockfd = <optimized out>
         module_assertions = <optimized out>

Lisp Backtrace:
"insert-file-contents" (0xf0b6d238)
"revert-buffer-insert-file-contents--default-function" (0xf0b6d1d8)
"revert-buffer--default" (0xf0b6d170)
"revert-buffer" (0xf0b6d108)
"revert-buffer-with-coding-system" (0xffffd510)
"funcall-interactively" (0xffffd508)
"call-interactively" (0xf0b6d070)
"command-execute" (0xffffd7f8)



In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
  3.24.24, cairo version 1.16.0) of 2023-02-28 built on romeo
Repository revision: 68cc286c0495caaebc3f641f6b919109045c43dd
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG
SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM
XINPUT2 XPM GTK3 ZLIB

Important settings:
   value of $LC_MESSAGES: en_US.UTF-8
   value of $LANG: fi_FI.UTF-8
   locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
   hexl-follow-ascii: t
   tooltip-mode: t
   global-eldoc-mode: t
   eldoc-mode: t
   show-paren-mode: t
   electric-indent-mode: t
   mouse-wheel-mode: t
   tool-bar-mode: t
   menu-bar-mode: t
   file-name-shadow-mode: t
   global-font-lock-mode: t
   font-lock-mode: t
   blink-cursor-mode: t
   line-number-mode: t
   indent-tabs-mode: t
   transient-mark-mode: (only . t)
   auto-composition-mode: t
   auto-encryption-mode: t
   auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
epg-config gnus-util text-property-search mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils nhexl-mode disp-table
hexl time-date subr-x cl-loaddefs cl-lib rmc iso-transl tooltip cconv
eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd
fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow
isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo
move-toolbar gtk x-toolkit xinput2 x multi-tty make-network-process
emacs)

Memory information:
((conses 16 38619 9018)
  (symbols 48 5354 0)
  (strings 32 14107 1765)
  (string-bytes 1 394418)
  (vectors 16 9708)
  (vector-slots 8 153658 15727)
  (floats 8 34 18)
  (intervals 56 224 0)
  (buffers 976 10))





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#61887: 30.0.50; Segfault on revert-buffer-with-coding-system
  2023-02-28 21:48 bug#61887: 30.0.50; Segfault on revert-buffer-with-coding-system Petteri Hintsanen
@ 2023-03-01 12:47 ` Eli Zaretskii
  2023-03-03 23:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 7+ messages in thread
From: Eli Zaretskii @ 2023-03-01 12:47 UTC (permalink / raw)
  To: Petteri Hintsanen, Stefan Monnier; +Cc: 61887

> Date: Tue, 28 Feb 2023 23:48:18 +0200
> From: Petteri Hintsanen <petterih@iki.fi>
> 
> After editing a binary file in nhexl-mode, calling 
> revert-buffer-with-coding-system crashed Emacs.  This happened initially 
> on Emacs 28.2, but the current master branch crashes as well.
> 
> Preparation:
> 
> - Get nhexl-mode-1.5 from ELPA.
> 
> - Create a test file "junk.dat" with:
> 
>      dd if=/dev/random of=junk.dat bs=1k count=5k
> 
>    or use any existing large binary file (5 MBs or more).
> 
> Recipe:
> 
> ./gdb --args emacs -Q
> 
> In *scratch* buffer, type
> 
>    (add-to-list 'load-path "~/.emacs.d/elpa/nhexl-mode-1.5")
>    (require 'nhexl-mode)
> 
> M-x eval-buffer
> 
> M-x find-file-literally junk.dat
> 
> M-x nhexl-mode RET
> 
> M-x nhexl-mode RET
> 
> C-x RET r utf-8 RET yes RET

Thank you for your report.

Stefan, can you please look into this?  It sounds like nhexl-mode
leaves an interval tree in the buffer which causes problems when
reverting non-literally.  (Maybe reverting non-literally after
visiting literally, or vice versa, should dispose of all the
intervals?)





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#61887: 30.0.50; Segfault on revert-buffer-with-coding-system
  2023-02-28 21:48 bug#61887: 30.0.50; Segfault on revert-buffer-with-coding-system Petteri Hintsanen
  2023-03-01 12:47 ` Eli Zaretskii
@ 2023-03-03 23:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-03-03 23:56   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-03-03 23:19 UTC (permalink / raw)
  To: Petteri Hintsanen; +Cc: 61887

> ./gdb --args emacs -Q
>
> In *scratch* buffer, type
>   (add-to-list 'load-path "~/.emacs.d/elpa/nhexl-mode-1.5")
>   (require 'nhexl-mode)
> M-x eval-buffer

You can directly load ~/.emacs.d/elpa/nhexl-mode-1.5/nhexl-mode.elc
(or ~/.emacs.d/elpa/nhexl-mode-1.5/nhexl-mode-autoloads.el) instead :-)

> M-x find-file-literally junk.dat
>
> M-x nhexl-mode RET
>
> M-x nhexl-mode RET
>
> C-x RET r utf-8 RET yes RET

I tried that and it did not misbehave when I tried it on `emacs.pdmp`,
but I did get a crash when I used it on `src/temacs`.

This said, I got a different backtrace.  Yours was:

> Thread 1 "emacs" received signal SIGSEGV, Segmentation fault.
> 0x00005555557be729 in balance_an_interval (i=0x55555b47e090) at
> intervals.c:390
> 390		  new_diff = i->total_length - i->left->total_length
> #0  0x00005555557be729 in balance_an_interval (i=0x55555b47e090)
>     at intervals.c:390
>         old_diff = 1
[...]
> #18 0x00005555557be89d in balance_an_interval (i=0x55555b47ded0) at
>  intervals.c:405
>         old_diff = <optimized out>
> #19 0x00005555557be953 in balance_possible_root_interval
>  (interval=interval@entry=0x55555b47dfb0) at intervals.c:430
>         parent = <optimized out>
>         have_parent = false
> #20 0x00005555557bfbda in split_interval_right
>  (interval=interval@entry=0x55555b47dfb0, offset=offset@entry=-1) at
>  intervals.c:517
>         new = 0x55555b47ded0
>         position = <optimized out>
>         new_length = <optimized out>
> #21 0x00005555557c34d9 in copy_intervals (tree=<optimized out>,
>  start=start@entry=7476, length=length@entry=5033991) at intervals.c:2257
>         i = 0x555558258930
>         new = 0x555555e81ec8
>         t = 0x55555b47dfb0
>         got = 266489
>         prevlen = -1
> #22 0x00005555557c356d in copy_intervals_to_string
>  (string=string@entry=XIL(0x555556866ae4), buffer=<optimized out>,
>  position=position@entry=7476, length=length@entry=5033991) at
>  intervals.c:2272
>         interval_copy = <optimized out>
> #23 0x0000555555754af0 in make_buffer_string_both (start=start@entry=7476,
>  start_byte=start_byte@entry=11087, end=end@entry=5041467,
>  end_byte=end_byte@entry=7485872, props=props@entry=true) at editfns.c:1629
>         result = XIL(0x555556866ae4)
>         tem = <optimized out>
>         tem1 = <optimized out>
>         beg0 = 11087
>         end0 = <optimized out>
>         beg1 = <optimized out>
>         end1 = -1
>         size = 7474785
> #24 0x00005555556fdf77 in del_range_2 (from=7476,
>  from_byte=from_byte@entry=11087, to=to@entry=5041467,
>  to_byte=to_byte@entry=7485872, ret_string=ret_string@entry=false) at
>  insdel.c:1905
>         nbytes_del = 7474785
>         nchars_del = 5033991
>         deletion = <optimized out>
> #25 0x0000555555700908 in del_range_byte (from_byte=from_byte@entry=11087,
>  to_byte=to_byte@entry=7485872) at insdel.c:1826
>         from = 7476
>         to = 5041467
> #26 0x000055555570e267 in Finsert_file_contents
>  (filename=XIL(0x555556058384), visit=XIL(0x30), beg=<optimized out>,
>  end=<optimized out>, replace=XIL(0x30)) at fileio.c:4533
[...]

Mine is:

    intervals.c:381: Emacs fatal error: assertion failed: LENGTH (i) > 0
    
    Thread 1 "emacs" hit Breakpoint 1, terminate_due_to_signal (sig=6, 
        backtrace_limit=2147483647) at emacs.c:426
    (gdb) bt
    #0  terminate_due_to_signal (sig=6, backtrace_limit=2147483647) at emacs.c:426
    #1  0x00005555557c76d0 in die
        (msg=msg@entry=0x555555952241 "LENGTH (i) > 0", file=file@entry=0x5555559520ad "intervals.c", line=line@entry=381) at alloc.c:7962
    #2  0x000055555589dc99 in balance_an_interval (i=i@entry=0x55555d057608) at intervals.c:381
    [...]
    #26 0x000055555589dda4 in balance_intervals_internal (tree=0x555591eedab0) at intervals.c:451
    #27 0x00005555558a0346 in balance_intervals (tree=<optimized out>) at intervals.c:462
    #28 0x00005555557c96b6 in sweep_buffers () at alloc.c:7669
    #29 0x00005555557cce91 in gc_sweep () at alloc.c:7685
    #30 0x00005555557d1ad9 in garbage_collect () at alloc.c:6506
    #31 0x00005555557d1cf5 in maybe_garbage_collect () at alloc.c:6350
    #32 0x00005555558056ad in maybe_gc () at lisp.h:5617
    #33 Ffuncall (nargs=nargs@entry=2, args=args@entry=0x7fffffffd2a0) at eval.c:2992
    #34 0x0000555555778779 in call1 (arg1=Python Exception <class 'gdb.error'> value has been optimized out: 
    , fn=Python Exception <class 'gdb.error'> value has been optimized out: 
    ) at lisp.h:3247
    #35 make_lock_file_name (fn=Python Exception <class 'gdb.error'> value has been optimized out: 
    , fn@entry=XIL(0x555569c01c74)) at filelock.c:656
    #36 0x0000555555779602 in unlock_file (fn=Python Exception <class 'gdb.error'> value has been optimized out: 
    , fn@entry=XIL(0x555569c01c74)) at filelock.c:737
    #37 0x0000555555803d94 in internal_condition_case_1 (bfun=bfun@entry=0x5555557795f4 <unlock_file>, arg=Python Exception <class 'gdb.error'> value has been optimized out: 
    , arg@entry=XIL(0x555569c01c74), handlers=Python Exception <class 'gdb.error'> value has been optimized out: 
    , hfun=hfun@entry=0x55555577862d <unlock_file_handle_error>) at eval.c:1498
    #38 0x000055555577881e in Funlock_file (file=Python Exception <class 'gdb.error'> value has been optimized out: 
    , file@entry=XIL(0x555569c01c74)) at filelock.c:811
    #39 0x000055555576f00b in Frestore_buffer_modified_p (flag=XIL(0)) at buffer.c:1544
    #40 0x000055555576f11a in Fset_buffer_modified_p (flag=Python Exception <class 'gdb.error'> value has been optimized out: 
    ) at buffer.c:1495
    #41 0x0000555555773ed2 in Fset_buffer_multibyte (flag=XIL(0x30)) at buffer.c:2908
    [...]

Maybe it's because I built with `--enable-checking` so I caught the
problem a bit earlier; inside the call to `set-buffer-multibyte` instead
of inside the subsequent call to `insert-file-contents`.

Clearly the cause of the crash is not in `nhexl-mode`, which is just
a trigger instead.

> Stefan, can you please look into this?  It sounds like nhexl-mode
> leaves an interval tree in the buffer which causes problems when
> reverting non-literally.  (Maybe reverting non-literally after
> visiting literally, or vice versa, should dispose of all the
> intervals?)

FWIW, in my ideal world, `set-buffer-multibyte` signals an error if the
buffer is not empty :-)

But yes, there's something funny going on in `set_intervals_multibyte_1`.

        Stefan






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#61887: 30.0.50; Segfault on revert-buffer-with-coding-system
  2023-03-03 23:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-03-03 23:56   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-03-04  0:13     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-03-03 23:56 UTC (permalink / raw)
  To: Petteri Hintsanen; +Cc: 61887

> But yes, there's something funny going on in `set_intervals_multibyte_1`.

I think I found it: when `total_length` is 0, we call `delete_interval (i)`
but that only deletes the interval represented by the node itself rather
than the whole subtree, so we may end up keeping subtrees of `i`.
Not only that's wrong since `total_length == 0` means there should be
nothing at all, but we don't even recurse on those subtrees so
they keep using the positions of the old mode.

In my case some call `delete_interval (i)` ended up replacing the node
of `total_length == 0` with an old subnode of length 2!

The patch below seems to fix it.


        Stefan


diff --git a/src/intervals.c b/src/intervals.c
index 75e37a8c90c..6f6a0c94cf5 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -2333,6 +2333,9 @@ set_intervals_multibyte_1 (INTERVAL i, bool multi_flag,
 
   if (TOTAL_LENGTH (i) == 0)
     {
+      /* Delete the whole subtree.  */
+      i->left = NULL;
+      i->right = NULL;
       delete_interval (i);
       return;
     }
@@ -2355,7 +2358,8 @@ set_intervals_multibyte_1 (INTERVAL i, bool multi_flag,
 	  left_end_byte = CHAR_TO_BYTE (left_end);
 	}
 
-      set_intervals_multibyte_1 (i->left, multi_flag, start, start_byte,
+      set_intervals_multibyte_1 (i->left, multi_flag,
+				 start, start_byte,
 				 left_end, left_end_byte);
     }
   if (i->right)






^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#61887: 30.0.50; Segfault on revert-buffer-with-coding-system
  2023-03-03 23:56   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-03-04  0:13     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-03-04  7:30       ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-03-04  0:13 UTC (permalink / raw)
  To: Petteri Hintsanen; +Cc: 61887

> The patch below seems to fix it.

I just pushed it to `emacs-29`.


        Stefan






^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#61887: 30.0.50; Segfault on revert-buffer-with-coding-system
  2023-03-04  0:13     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-03-04  7:30       ` Eli Zaretskii
  2023-09-06  0:03         ` Stefan Kangas
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-03-04  7:30 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 61887, petterih

> Cc: 61887@debbugs.gnu.org
> Date: Fri, 03 Mar 2023 19:13:28 -0500
> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
> 
> > The patch below seems to fix it.
> 
> I just pushed it to `emacs-29`.

Thanks.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#61887: 30.0.50; Segfault on revert-buffer-with-coding-system
  2023-03-04  7:30       ` Eli Zaretskii
@ 2023-09-06  0:03         ` Stefan Kangas
  0 siblings, 0 replies; 7+ messages in thread
From: Stefan Kangas @ 2023-09-06  0:03 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 61887-done, petterih, Stefan Monnier

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: 61887@debbugs.gnu.org
>> Date: Fri, 03 Mar 2023 19:13:28 -0500
>> From:  Stefan Monnier via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>>
>> > The patch below seems to fix it.
>>
>> I just pushed it to `emacs-29`.
>
> Thanks.

Closing.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-09-06  0:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-28 21:48 bug#61887: 30.0.50; Segfault on revert-buffer-with-coding-system Petteri Hintsanen
2023-03-01 12:47 ` Eli Zaretskii
2023-03-03 23:19 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-03 23:56   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-04  0:13     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-04  7:30       ` Eli Zaretskii
2023-09-06  0:03         ` Stefan Kangas

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.