astroidmail / astroid

A graphical threads-with-tags style, lightweight and fast, e-mail client for Notmuch
http://astroidmail.github.io
Other
613 stars 65 forks source link

segfaults handling exclude_tags on startup #718

Closed daurnimator closed 2 years ago

daurnimator commented 2 years ago

With a search.exclude_tags set via notmuch config set search.exclude_tags deleted, astroid crashes with a segfault.

Thread 1 "astroid" received signal SIGSEGV, Segmentation fault.
0x00007ffff2e925eb in __memmove_avx_unaligned_erms () from /usr/lib/libc.so.6
(gdb) 
(gdb) bt
#0  0x00007ffff2e925eb in __memmove_avx_unaligned_erms () at /usr/lib/libc.so.6
#1  0x00007ffff393ae32 in  () at /usr/lib/libglibmm-2.4.so.1
#2  0x00007ffff395960a in Glib::ustring::erase(Glib::ustring_Iterator<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Glib::ustring_Iterator<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) () at /usr/lib/libglibmm-2.4.so.1
#3  0x00005555556e7e70 in Astroid::UstringUtils::trim_left(Glib::ustring&) (str=...)
    at /usr/src/debug/astroid-0.16/src/utils/ustring_utils.cc:25
#4  0x00005555556ed57f in Astroid::UstringUtils::trim_left(Glib::ustring&) (str=...)
    at /usr/src/debug/astroid-0.16/src/utils/ustring_utils.cc:13
#5  Astroid::UstringUtils::trim(Glib::ustring&) (str=...) at /usr/src/debug/astroid-0.16/src/utils/ustring_utils.cc:48
#6  Astroid::VectorUtils::split_and_trim(Glib::ustring const&, Glib::ustring) (str=<optimized out>, delim=...)
    at /usr/src/debug/astroid-0.16/src/utils/vector_utils.cc:21
#7  0x0000555555645137 in Astroid::Db::init() () at /usr/src/debug/astroid-0.16/src/db.cc:72
#8  0x0000555555628316 in Astroid::Astroid::run(int, char**) (this=0x5555558292e0, argc=1, argv=0x7fffffffbfc8)
    at /usr/src/debug/astroid-0.16/src/astroid.cc:285
#9  0x000055555561da43 in main(int, char**) (argc=1, argv=0x7fffffffbfc8) at /usr/include/glibmm-2.4/glibmm/refptr.h:259
daurnimator commented 2 years ago

I worked around that by setting exclude_tags to the empty string; and hit the issue in more places: I set sent_tags to the empty string as well. But then I started hitting it inside of the application when it was registering keybinds:

(gdb) bt
#0  0x00007ffff2e925eb in __memmove_avx_unaligned_erms () at /usr/lib/libc.so.6
#1  0x00007ffff393ae32 in  () at /usr/lib/libglibmm-2.4.so.1
#2  0x00007ffff395960a in Glib::ustring::erase(Glib::ustring_Iterator<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, Glib::ustring_Iterator<__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >) () at /usr/lib/libglibmm-2.4.so.1
#3  0x00005555556e7e70 in Astroid::UstringUtils::trim_left(Glib::ustring&) (str=...)
    at /usr/src/debug/astroid-0.16/src/utils/ustring_utils.cc:25
#4  0x00005555556ed57f in Astroid::UstringUtils::trim_left(Glib::ustring&) (str=...)
    at /usr/src/debug/astroid-0.16/src/utils/ustring_utils.cc:13
#5  Astroid::UstringUtils::trim(Glib::ustring&) (str=...)
    at /usr/src/debug/astroid-0.16/src/utils/ustring_utils.cc:48
#6  Astroid::VectorUtils::split_and_trim(Glib::ustring const&, Glib::ustring)
    (str=<optimized out>, delim=...) at /usr/src/debug/astroid-0.16/src/utils/vector_utils.cc:21
#7  0x000055555567af68 in Astroid::Key::Key(Glib::ustring, Glib::ustring, Glib::ustring)
    (this=0x7fffffffa700, spec=..., _n=..., _h=..., this=<optimized out>, spec=..., _n=..., _h=...) at /usr/src/debug/astroid-0.16/src/modes/keybindings.cc:644
#8  0x000055555567df13 in Astroid::Keybindings::register_key(Glib::ustring, std::vector<Astroid::Key, std::allocator<Astroid::Key> >, Glib::ustring, Glib::ustring, std::function<bool (Astroid::Key)>)
 (this=0x555555b36730, spec=..., aliases=, name=..., help=..., t=...)
    at /usr/src/debug/astroid-0.16/src/modes/keybindings.cc:306
#9  0x000055555567295d in Astroid::Keybindings::register_key(Glib::ustring, Glib::ustring, Glib::ustring, std::function<bool (Astroid::Key)>)
    (this=0x555555b36730, spec=..., name=..., help=..., t=...)
    at /usr/src/debug/astroid-0.16/src/modes/keybindings.cc:296
#10 0x0000555555658710 in Astroid::MainWindow::MainWindow()
    (this=0x555555b36400, this=<optimized out>)
    at /usr/src/debug/astroid-0.16/src/main_window.cc:213
#11 0x0000555555629442 in Astroid::Astroid::open_new_window(bool)
    (this=0x5555558292e0, open_defaults=<optimized out>)
    at /usr/src/debug/astroid-0.16/src/astroid.cc:487
#12 0x00007ffff3a8fbec in Gio::Application_Class::activate_callback(_GApplication*) ()
    at /usr/lib/libgiomm-2.4.so.1
#13 0x00007ffff40b66b6 in _g_closure_invoke_va
    (param_types=0x0, n_params=0, args=0x7fffffffaed0, instance=0x555555852210, return_value=<optimized out>, closure=<optimized out>) at ../glib/gobject/gclosure.c:893
#14 g_signal_emit_valist
    (instance=0x555555852210, signal_id=8, detail=<optimized out>, var_args=var_args@entry=0x7fffffffaed0) at ../glib/gobject/gsignal.c:3406
#15 0x00007ffff40b6824 in g_signal_emit
    (instance=<optimized out>, signal_id=<optimized out>, detail=<optimized out>)
    at ../glib/gobject/gsignal.c:3553
#16 0x0000555555626199 in Astroid::Astroid::on_command_line(Glib::RefPtr<Gio::ApplicationCommandLine> const&) (this=0x5555558292e0, cmd=<optimized out>)
    at /usr/src/debug/astroid-0.16/src/astroid.cc:431
#17 0x00007ffff3a924bb in Gio::Application_Class::command_line_callback(_GApplication*, _GApplicationCommandLine*) () at /usr/lib/libgiomm-2.4.so.1
#18 0x00007ffff4155472 in _g_cclosure_marshal_INT__OBJECTv
    (closure=0x555555899b80, return_value=0x7fffffffb380, instance=<optimized out>, args=<optimized out>, marshal_data=<optimized out>, n_params=<optimized out>, param_types=0x555555899f00)
    at ../glib/gio/gmarshal-internal.c:845
#19 0x00007ffff40b66b6 in _g_closure_invoke_va
    (param_types=0x555555899f00, n_params=1, args=0x7fffffffb430, instance=0x555555852210, return_value=<optimized out>, closure=<optimized out>) at ../glib/gobject/gclosure.c:893
#20 g_signal_emit_valist
    (instance=0x555555852210, signal_id=10, detail=<optimized out>, var_args=var_args@entry=0x7fffffffb430) at ../glib/gobject/gsignal.c:3406
#21 0x00007ffff40b6824 in g_signal_emit
    (instance=instance@entry=0x555555852210, signal_id=<optimized out>, detail=detail@entry=0)
    at ../glib/gobject/gsignal.c:3553
#22 0x00007ffff41b6317 in g_application_call_command_line
    (exit_status=0x7fffffffb654, options=0x555555a2c930, arguments=<optimized out>, application=0x555555852210) at ../glib/gio/gapplication.c:1080
#23 g_application_call_command_line
    (application=0x555555852210, arguments=<optimized out>, options=0x555555a2c930, exit_status=0x7fffffffb654) at ../glib/gio/gapplication.c:1058
#24 0x00007ffff41b760a in g_application_real_local_command_line
    (application=0x555555852210, arguments=0x7fffffffb658, exit_status=0x7fffffffb654)
    at ../glib/gio/gapplication.c:1135
#25 0x00007ffff3a8f64e in Gio::Application::local_command_line_vfunc(char**&, int&) ()
    at /usr/lib/libgiomm-2.4.so.1
#26 0x00007ffff3a8f955 in Gio::Application_Class::local_command_line_vfunc_callback(_GApplication*, char***, int*) () at /usr/lib/libgiomm-2.4.so.1
#27 0x00007ffff41b779a in g_application_run
    (application=0x555555852210, argc=-18860, argv=<optimized out>)
    at ../glib/gio/gapplication.c:2538
#28 0x000055555562850a in Astroid::Astroid::run(int, char**)
    (this=0x5555558292e0, argc=1, argv=0x7fffffffbfc8)
    at /usr/src/debug/astroid-0.16/src/astroid.cc:324
#29 0x000055555561da43 in main(int, char**) (argc=1, argv=0x7fffffffbfc8)
    at /usr/include/glibmm-2.4/glibmm/refptr.h:259

The thing in common seems to be that via Astroid::VectorUtils::split_and_trim Glib::ustring::erase gets called. Is there perhaps some undefined behaviour in your usage that's now being tickled? or alternatively is erase being used incorrectly?

daurnimator commented 2 years ago

uh, that's weird. I rebuilt astroid and now it seems fine. closing for now...