dvorka / hstr

bash and zsh shell history suggest box - easily view, navigate, search and manage your command history.
http://me.mindforger.com
Apache License 2.0
4.08k stars 231 forks source link

Segfault on "Ctrl + /" invocation ... reproducible with "Ctrl + \" #508

Open myrrc opened 8 months ago

myrrc commented 8 months ago
~ hstr --version
hstr version "2.5.0" (2021-12-13T22:00:00)

~ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS"

Steps to reproduce: launch hstr and press "Ctrl+/".

GDB stacktrace (no debugging info, unfortunately)

#0  0x00007ffff7ce07e2 in __GI___libc_read (fd=0, buf=0x7fffffffd97f, nbytes=1)
    at ../sysdeps/unix/sysv/linux/read.c:26
#1  0x00007ffff7e3b6f9 in ?? () from /lib/x86_64-linux-gnu/libncursesw.so.6
#2  0x00007ffff7e3c28b in wgetch () from /lib/x86_64-linux-gnu/libncursesw.so.6
#3  0x000055555555a90f in ?? ()
#4  0x0000555555556e06 in ?? ()
#5  0x00007ffff7bf5d90 in __libc_start_call_main (main=main@entry=0x5555555569e0, argc=argc@entry=1, 
    argv=argv@entry=0x7fffffffe6d8) at ../sysdeps/nptl/libc_start_call_main.h:58
#6  0x00007ffff7bf5e40 in __libc_start_main_impl (main=0x5555555569e0, argc=1, argv=0x7fffffffe6d8, 
    init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe6c8)
    at ../csu/libc-start.c:392
#7  0x00005555555574a5 in ?? ()

I may send you core dump if you email me

myrrc commented 8 months ago
~ foot --version
foot version: 1.11.0 -pgo +ime -graphemes -assertions

~ bash --version
GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)
dvorka commented 8 months ago

@myrrc thank you for the report! Just in case you have time - could you please try latest hstr version (2.5.0 is pretty old):

Thank you!

myrrc commented 8 months ago

Yes, the issue reproduces on the .deb you pointed me to. Fresh master build make CFLAGS='-O0 -g3' does the same.

Looks like most interesting thing here is

#3  0x000055555555e2ba in loop_to_select () at hstr.c:1303
1303               c = wgetch(stdscr);

Unfortunately, I haven't been able to dig into ncurses despite installing all debug packages.

dvorka commented 8 months ago

Hints:

atleta commented 8 months ago

I'm having the same issue when I accidentally type Ctrl+\ (instead of Ctrl+/ which does work). Also on ubuntu and the segfault seems to be on the same line as above (../sysdeps/unix/sysv/linux/read.c:26). hstr version I'm using is "3.1.0" (2023-04-18T08:50:00) from the official ubuntu repo.

dvorka commented 8 months ago

@atleta thank you Laszlo for the detailed repro description! Ctrl + / worked without problems, but with Ctrl + \ it is reproducible! :finnadie: