shutter-project / shutter

Screenshot tool for Linux
https://shutter-project.org/
GNU General Public License v3.0
510 stars 34 forks source link

Shutter crashes on startup on NixOS #486

Open refaelsh opened 2 years ago

refaelsh commented 2 years ago

I use NixOS. Version: 0.99.2 Rev.1593. Here is the error when I run shutter:

> shutter
.
.
.
Current window manager: i3

type_changed was emitted by widget Gtk3::ComboBoxText=HASH(0x6186ca8)

qvalue_changed was emitted by widget Gtk3::HScale=HASH(0x6186df8)
Can't use an undefined value as an ARRAY reference at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 4932, <DATA> line 19.
    Shutter::App::fct_get_program_model() called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 1408
    Shutter::App::STARTUP(Shutter::App=HASH(0x5ddc6e8)) called at /nix/store/gl2h6v49mk4zn6y0kk88id2kr32d9fjl-perl5.34.1-Glib-Object-Introspection-0.049/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/Glib/Object/Introspection.pm line 67
    Glib::Object::Introspection::__ANON__(Shutter::App=HASH(0x5ddc6e8)) called at /nix/store/15a99rvx02x0iij0bkazpaz47pb3jylc-shutter-0.99.2/bin/.shutter-wrapped line 10943
fish: Job 1, 'shutter' terminated by signal SIGSEGV (Address boundary error)

>

Help please :-)

Photon89 commented 2 years ago

I think, this is the point, when @DarthGandalf should have a look. :smiley:

refaelsh commented 2 years ago

@DarthGandalf can you please take a look?

DarthGandalf commented 2 years ago

I'm back from vacation.

These <optimized out> break everything, any way to avoid such optimization?

Script to build and launch VM:

Due to nixos-rebuild, it looks like it requires using nixos already?

bjornfor commented 2 years ago

I'm back from vacation.

These <optimized out> break everything, any way to avoid such optimization?

I'm testing with adding this to the configuration.nix file (of the VM):

  nixpkgs.overlays = [
    (final: prev: {
      glib = prev.glib.overrideAttrs (old: {
        dontStrip = true;
        NIX_CFLAGS_COMPILE = (old.NIX_CFLAGS_COMPILE or "") + " -ggdb -Og";
      });
    })
  ];

but it causes lots of rebuilding. (glib is pretty deep in the dependency graph. I commented out firefox from configuration.nix to at least not have to rebuild that.)

Script to build and launch VM:

Due to nixos-rebuild, it looks like it requires using nixos already?

Actually, no. nixos-rebuild is available by default in NixOS systems (so I forgot that it was an implicit/undeclared dependency in my script), but you can also get it on any other Linux system that has Nix. In the "Script to build and launch VM" I posted, you can replace the last line with these two lines:

nixos_rebuild=$(nix-build -A nixos-rebuild "<nixpkgs>")
"$nixos_rebuild/bin/nixos-rebuild" build-vm && SHARED_DIR="$shared_dir" ./result/bin/run-nixos-vm -m 4096
bjornfor commented 2 years ago

Latest backtrace, now with glib built with -ggdb -Og:

$ gdb shutter
...
Thread 1 ".shutter-wrappe" received signal SIGSEGV, Segmentation fault.
emission_find (instance=0x4e55f60, detail=0, signal_id=35) at ../gobject/gsignal.c:893
893 ../gobject/gsignal.c: No such file or directory.
(gdb)
(gdb) bt full
#0  emission_find (instance=0x4e55f60, detail=0, signal_id=35) at ../gobject/gsignal.c:893
        emission = 0x2
#1  signal_emit_unlocked_R (node=node@entry=0x1e78b80, detail=detail@entry=0, instance=instance@entry=0x4e55f60, emission_return=emission_return@entry=0x0, instance_and_params=instance_and_params@entry=0x7fffffffb770) at ../gobject/gsignal.c:3627
        emission_node = <optimized out>
        accumulator = <optimized out>
        emission = {next = 0x3000000020, instance = 0x7fffffffba10, ihint = {signal_id = 4294949200, detail = 32767, run_type = (unknown: 0x6859b800)}, state = 195919437, chain_type = 140737488336880}
        class_closure = <optimized out>
        hlist = <optimized out>
        handler_list = 0x0
        return_accu = <optimized out>
        accu = {g_type = 0, data = {{v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}, {v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}}}
        signal_id = 35
        max_sequential_handler_number = <optimized out>
        return_value_altered = 0
#2  0x00007fffea1af69d in g_signal_emit_valist (instance=0x4e55f60, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7fffffffb8d0) at ../gobject/gsignal.c:3496
        instance_and_params = 0x7fffffffb770
        signal_return_type = 4
        param_values = 0x7fffffffb788
        node = 0x1e78b80
        i = 0
        n_params = 0
        __func__ = "g_signal_emit_valist"
#3  0x00007fffea1af8f5 in g_signal_emit (instance=instance@entry=0x4e55f60, signal_id=<optimized out>, detail=detail@entry=0) at ../gobject/gsignal.c:3553
        var_args = {{gp_offset = 24, fp_offset = 48, overflow_arg_area = 0x7fffffffb9b0, reg_save_area = 0x7fffffffb8f0}}
#4  0x00007fffe8b51100 in gtk_widget_dispose (object=0x4e55f60) at ../gtk/gtkwidget.c:12166
        widget = 0x4e55f60
        priv = 0x4e55e70
        sizegroups = <optimized out>
#5  0x00007fffea19cb91 in g_object_unref (_object=_object@entry=0x4e55f60) at ../gobject/gobject.c:3636
        weak_locations = <optimized out>
        nqueue = 0x4d337c0
        object = 0x4e55f60
        old_ref = <optimized out>
        __func__ = "g_object_unref"
#6  0x00007fffe8925048 in gtk_container_remove (container=0x4e73ce0, widget=widget@entry=0x4e55f60) at ../gtk/gtkcontainer.c:1911
        __func__ = "gtk_container_remove"
#7  0x00007fffe8b51024 in gtk_widget_dispose (object=0x4e55f60) at ../gtk/gtkwidget.c:12155
        widget = 0x4e55f60
        priv = 0x4e55e70
        sizegroups = <optimized out>
#8  0x00007fffea19cb91 in g_object_unref (_object=0x4e55f60) at ../gobject/gobject.c:3636
        weak_locations = <optimized out>
        nqueue = 0x4d337c0
        object = 0x4e55f60
        old_ref = <optimized out>
        __func__ = "g_object_unref"
#9  0x00007fffea201c2a in XS_Glib__Object_DESTROY () from /nix/store/v8klh43ivcpfcls7jn20rvf3qq6iwfvi-perl5.34.1-Glib-1.3293/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/auto/Glib/Glib.so
No symbol table info available.
#10 0x00007ffff7d4b047 in Perl_pp_entersub () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#11 0x00007ffff7ca67c7 in Perl_call_sv () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#12 0x00007ffff7d4efa9 in S_curse () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#13 0x00007ffff7d4f6a0 in Perl_sv_clear () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#14 0x00007ffff7d4fc9e in Perl_sv_free2 () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#15 0x00007ffff7d504e8 in Perl_sv_clean_objs () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#16 0x00007ffff7ca9698 in perl_destruct () from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#17 0x0000000000401234 in main ()
No symbol table info available.

Unfortunately, there's still some <optimized out>, but somewhat fewer than last time.

bjornfor commented 1 year ago

Another gdb backtrace of the shutter startup segfault, now with glib compiled with -O0 instead of -Og, which exposes the last optimized outs. (There are two optimized out variables left from GTK since I didn't build it with debugging.)

#0  0x00007fffea17cea5 in emission_find (signal_id=35, detail=0, instance=0x4e2ff60) at ../gobject/gsignal.c:893
        emission = 0x4
#1  0x00007fffea1847ba in signal_emit_unlocked_R (node=0x1e5f340, detail=0, instance=0x4e2ff60, 
    emission_return=0x0, instance_and_params=0x7fffffffb530) at ../gobject/gsignal.c:3627
        emission_node = 0xf7735ada202ac200
        accumulator = 0x7fffffffb4d0
        emission = {next = 0x7fffffffb520, instance = 0x7fffea194711 <g_value_init_from_instance+148>, ihint = {
            signal_id = 81985376, detail = 0, 
            run_type = (G_SIGNAL_DETAILED | G_SIGNAL_ACTION | G_SIGNAL_DEPRECATED | G_SIGNAL_ACCUMULATOR_FIRST_RUN | unknown: 0xfffdb400)}, state = 32767, chain_type = 14837280}
        class_closure = 0x7fffea172620 <g_object_ref+191>
        hlist = 0x4e2ff60
        handler_list = 0x0
        return_accu = 0xe26a10
        accu = {g_type = 0, data = {{v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, v_int64 = 0, v_uint64 = 0, 
              v_float = 0, v_double = 0, v_pointer = 0x0}, {v_int = 0, v_uint = 0, v_long = 0, v_ulong = 0, 
              v_int64 = 0, v_uint64 = 0, v_float = 0, v_double = 0, v_pointer = 0x0}}}
        signal_id = 35
        max_sequential_handler_number = 80
        return_value_altered = 0
#2  0x00007fffea183f2a in g_signal_emit_valist (instance=0x4e2ff60, signal_id=35, detail=0, 
    var_args=0x7fffffffb790) at ../gobject/gsignal.c:3496
        instance_and_params = 0x7fffffffb530
        signal_return_type = 4
        param_values = 0x7fffffffb548
        node = 0x1e5f340
        i = 0
        n_params = 0
        __func__ = "g_signal_emit_valist"
#3  0x00007fffea1844d9 in g_signal_emit (instance=0x4e2ff60, signal_id=35, detail=0)
    at ../gobject/gsignal.c:3553
        var_args = {{gp_offset = 24, fp_offset = 48, overflow_arg_area = 0x7fffffffb870, 
            reg_save_area = 0x7fffffffb7b0}}
#4  0x00007fffe8a88100 in gtk_widget_dispose (object=0x4e2ff60) at ../gtk/gtkwidget.c:12166
        widget = 0x4e2ff60
        priv = 0x4e2fe70
        sizegroups = <optimized out>
#5  0x00007fffea17281d in g_object_unref (_object=0x4e2ff60) at ../gobject/gobject.c:3636
        weak_locations = 0x0
        nqueue = 0x4cfae70
        object = 0x4e2ff60
        old_ref = 1
        __func__ = "g_object_unref"
#6  0x00007fffe885c048 in gtk_container_remove (container=0x4e4bce0, widget=widget@entry=0x4e2ff60)
    at ../gtk/gtkcontainer.c:1911
        __func__ = "gtk_container_remove"
#7  0x00007fffe8a88024 in gtk_widget_dispose (object=0x4e2ff60) at ../gtk/gtkwidget.c:12155
        widget = 0x4e2ff60
        priv = 0x4e2fe70
        sizegroups = <optimized out>
#8  0x00007fffea17281d in g_object_unref (_object=0x4e2ff60) at ../gobject/gobject.c:3636
        weak_locations = 0x0
        nqueue = 0x4cfae70
        object = 0x4e2ff60
        old_ref = 1
        __func__ = "g_object_unref"
#9  0x00007fffea1dbc2a in XS_Glib__Object_DESTROY ()
   from /nix/store/gwrps4v806svi58sfbc4i6kxhwawa7wr-perl5.34.1-Glib-1.3293/lib/perl5/site_perl/5.34.1/x86_64-linux-thread-multi/auto/Glib/Glib.so
No symbol table info available.
#10 0x00007ffff7d4b047 in Perl_pp_entersub ()
   from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#11 0x00007ffff7ca67c7 in Perl_call_sv ()
   from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#12 0x00007ffff7d4efa9 in S_curse ()
   from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#13 0x00007ffff7d4f6a0 in Perl_sv_clear ()
   from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#14 0x00007ffff7d4fc9e in Perl_sv_free2 ()
   from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#15 0x00007ffff7d504e8 in Perl_sv_clean_objs ()
   from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#16 0x00007ffff7ca9698 in perl_destruct ()
   from /nix/store/dk5lnlbfz4vgyywifl4zaa988p9ixa2n-perl-5.34.1/lib/perl5/5.34.1/x86_64-linux-thread-multi/CORE/libperl.so
No symbol table info available.
#17 0x0000000000401234 in main ()
No symbol table info available.