mawww / kakoune

mawww's experiment for a better code editor
http://kakoune.org
The Unlicense
9.7k stars 705 forks source link

[BUG][CRASH] ctags-search crashes kakoune after trying to browse autocomplete options. #5157

Closed DISSISOR closed 2 months ago

DISSISOR commented 2 months ago

Version of Kakoune

v2023.08.05-310-gc9564130

Reproducer

Reproduced in Void Linux. Generate tags file with universal ctags. Launch kakoune. Use ctags-search on any tag with multiple matches. It doesn't matter whether you provide tag explicitly or just use the selection. Try to select another completion option.

Outcome

Segfault. That's the error message I got:

Received SIGSEGV, exiting.
Pid: 10642
Callstack:
kak(+0xa3938) [0x55f7feeac938]
kak(+0x4f439) [0x55f7fee58439]
/usr/lib/libc.so.6(+0x3f8c0) [0x7f682be318c0]
kak(+0xb5dd1) [0x55f7feebedd1]
kak(+0xb6481) [0x55f7feebf481]
kak(+0x19ae31) [0x55f7fefa3e31]
kak(+0x19d536) [0x55f7fefa6536]
kak(+0x1aa72c) [0x55f7fefb372c]
kak(+0x195c66) [0x55f7fef9ec66]
kak(+0x128570) [0x55f7fef31570]
kak(+0x11d22c) [0x55f7fef2622c]
kak(+0x61b48) [0x55f7fee6ab48]
kak(+0x42776) [0x55f7fee4b776]
/usr/lib/libc.so.6(+0x29c4c) [0x7f682be1bc4c]
/usr/lib/libc.so.6(__libc_start_main+0x85) [0x7f682be1bd05]
kak(+0x489c1) [0x55f7fee519c1]

Backtrace from gdb:

#0  0x00007fae37cecb0d in __GI___libc_read (fd=0, buf=0x7ffe967d7c90, nbytes=1)
    at ../sysdeps/unix/sysv/linux/read.c:26
#1  0x000055c151ceaca9 in Kakoune::notify_fatal_error (msg=...) at src/assert.cc:32
#2  0x000055c151a7e8ef in Kakoune::signal_handler (signal=11) at src/main.cc:1047
#3  <signal handler called>
#4  0x000055c151b69770 in Kakoune::HashMap<Kakoune::String, Kakoune::FaceSpec, (Kakoune::MemoryDomain)14, Kakoune::Vector, false>::find_index<Kakoune::StringView> (this=0x7ffe967d6458,
    key=..., hash=2755819853) at src/hash_map.hh:227
#5  0x000055c151b695ba in Kakoune::HashMap<Kakoune::String, Kakoune::FaceSpec, (Kakoune::MemoryDomain)14, Kakoune::Vector, false>::find_index<Kakoune::StringView> (this=0x7ffe967d6458,
    key=...) at src/hash_map.hh:236
#6  0x000055c151b68e7b in Kakoune::HashMap<Kakoune::String, Kakoune::FaceSpec, (Kakoune::MemoryDomain)14, Kakoune::Vector, false>::find<Kakoune::StringView> (this=0x7ffe967d6458, key=...)
    at src/hash_map.hh:328
#7  0x000055c151b68dae in Kakoune::HashMap<Kakoune::String, Kakoune::FaceSpec, (Kakoune::MemoryDomain)14, Kakoune::Vector, false>::find<Kakoune::StringView> (this=0x7ffe967d6458, key=...)
    at src/hash_map.hh:335
#8  0x000055c151b65d72 in Kakoune::FaceRegistry::resolve_spec (this=0x7ffe967d6448, spec=...)
    at src/face_registry.cc:128
#9  0x000055c151b65b82 in Kakoune::FaceRegistry::operator[] (this=0x7ffe967d6448,
    facedesc=...) at src/face_registry.cc:111
#10 0x000055c151cfc211 in Kakoune::InputModes::LineEditor::build_display_line (
    this=0x55c153cd94f0, in_width=...) at src/input_handler.cc:618
#11 0x000055c151d008d5 in Kakoune::InputModes::Prompt::display (this=0x55c153cd93f0)
    at src/input_handler.cc:1044
#12 0x000055c151cff543 in Kakoune::InputModes::Prompt::on_key (this=0x55c153cd93f0, key=...,
    synthesized=false) at src/input_handler.cc:915
#13 0x000055c151cf75ef in Kakoune::InputMode::handle_key (this=0x55c153cd93f0, key=...,
    synthesized=false) at src/input_handler.cc:34
#14 0x000055c151cf5c1a in Kakoune::InputHandler::handle_key (this=0x55c153bc4228, key=...)
    at src/input_handler.cc:1666
#15 0x000055c151c3b0b9 in Kakoune::Client::process_pending_inputs (this=0x55c153bc41b0)
    at src/client.cc:114
#16 0x000055c151c31a74 in Kakoune::ClientManager::process_pending_inputs (this=0x7ffe967d9370)
    at src/client_manager.cc:108
#17 0x000055c151a7cd8c in Kakoune::run_server (session=..., server_init=..., client_init=...,
    init_buffer=..., init_coord=..., flags=Kakoune::ServerFlags::None,
    ui_type=Kakoune::UIType::Terminal, debug_flags=Kakoune::DebugFlags::None, files=...)
    at src/main.cc:898
#18 0x000055c151a8191f in main (argc=2, argv=0x7ffe967daae8) at src/main.cc:1242

Expectations

You should be able to actually select another match and jump to it.

Additional information

Could reproduce in st, alacritty, tmux. First bad commit I've got with bisect is 3d7d0fec.

arrufat commented 2 months ago

I am using this patch from @krobelus

https://lists.sr.ht/~mawww/kakoune/%3C20240421181853.2421375-2-aclopte@gmail.com%3E/raw

DISSISOR commented 2 months ago

This patch was merged! Many thanks, works just fine.