Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programs using gdk_pixbuf 2.38 crash with 2.36 loaders from system #54278

Open
minijackson opened this issue Jan 18, 2019 · 32 comments
Open

Programs using gdk_pixbuf 2.38 crash with 2.36 loaders from system #54278

minijackson opened this issue Jan 18, 2019 · 32 comments
Labels
0.kind: regression Something that worked before working no longer

Comments

@minijackson
Copy link
Member

Issue description

Since the update from 3.3 to 3.4, GnuCash hasn't been able to open, and instead crashes with a segmentation fault. I don't know if this is a Nix or an upstream issue.

Steps to reproduce

  • Install GnuCash 3.4
  • Run GnuCash

I have tried changing to a more common locale, moving my GnuCash data files to "simulate" a fresh install, but to no avail.

Technical details

  • system: "x86_64-linux"
  • host os: Linux 4.14.93, NixOS, 18.09.1922.97e0d53d669 (Jellyfish)
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.1.3
  • channels(root): "nixos-18.09.1922.97e0d53d669"
  • channels(minijackson): "unstable-19.03pre166683.088cb13aee0"
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
GDB stacktrace (click to expand)
#0  0x00007fffed1ecbb2 in __memmove_avx_unaligned_erms () from /nix/store/xdsjx0gba4id3yyqxv66bxnm2sqixkjj-glibc-2.27/lib/libc.so.6
#1  0x00007fffe6997225 in png_combine_row () from /nix/store/px5w0kjsn31dcs1zscqss8zjxkb9j45m-libpng-apng-1.6.35/lib/libpng16.so.16
#2  0x00007fffe698722b in png_push_process_row () from /nix/store/px5w0kjsn31dcs1zscqss8zjxkb9j45m-libpng-apng-1.6.35/lib/libpng16.so.16
#3  0x00007fffe69876dc in png_process_IDAT_data () from /nix/store/px5w0kjsn31dcs1zscqss8zjxkb9j45m-libpng-apng-1.6.35/lib/libpng16.so.16
#4  0x00007fffe69878e5 in png_push_read_IDAT () from /nix/store/px5w0kjsn31dcs1zscqss8zjxkb9j45m-libpng-apng-1.6.35/lib/libpng16.so.16
#5  0x00007fffe6987b8b in png_process_data () from /nix/store/px5w0kjsn31dcs1zscqss8zjxkb9j45m-libpng-apng-1.6.35/lib/libpng16.so.16
#6  0x00007fffd03e33d2 in gdk_pixbuf.png_image_load_increment () from /nix/store/gz47a30bzg0jhpr1galrah9g0bw5h0x4-gdk-pixbuf-2.36.12/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so
#7  0x00007ffff57e267b in gdk_pixbuf_loader_load_module () from /nix/store/402siv2c4fnmnqzmj0816lq1zy9v7kbi-gdk-pixbuf-2.38.0/lib/libgdk_pixbuf-2.0.so.0
#8  0x00007ffff57e3269 in gdk_pixbuf_loader_write () from /nix/store/402siv2c4fnmnqzmj0816lq1zy9v7kbi-gdk-pixbuf-2.38.0/lib/libgdk_pixbuf-2.0.so.0
#9  0x00007ffff6acaee4 in load_scalable_with_loader () from /nix/store/v1fsmybazgy865xvmwq52wk26p74i0gj-gtk+3-3.24.1/lib/libgtk-3.so.0
#10 0x00007ffff6acc03b in gtk_image_set_from_file () from /nix/store/v1fsmybazgy865xvmwq52wk26p74i0gj-gtk+3-3.24.1/lib/libgtk-3.so.0
#11 0x00007ffff6acc108 in gtk_image_new_from_file () from /nix/store/v1fsmybazgy865xvmwq52wk26p74i0gj-gtk+3-3.24.1/lib/libgtk-3.so.0
#12 0x00007fffeff5d4a0 in gnc_gnome_get_pixmap () from /nix/store/91gqgx6v5r3yf8g8pfsnya649d64gir2-gnucash-3.4/lib/gnucash/libgncmod-gnome-utils.so
#13 0x00007fffeff72799 in gnc_show_splash_screen () from /nix/store/91gqgx6v5r3yf8g8pfsnya649d64gir2-gnucash-3.4/lib/gnucash/libgncmod-gnome-utils.so
#14 0x00007fffeff5d717 in gnc_gui_init () from /nix/store/91gqgx6v5r3yf8g8pfsnya649d64gir2-gnucash-3.4/lib/gnucash/libgncmod-gnome-utils.so
#15 0x0000000000403773 in main ()
/tmp/gnucash.trace log when running with --debug --extra (click to expand)
* 17:56:25  INFO <gnc.gui> [main] System locale returned fr_FR.UTF-8
* 17:56:25  INFO <gnc.gui> [main] Effective locale set to fr_FR.UTF-8.
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] The icon theme search path has 34 elements.
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 0: /home/minijackson/.local/share/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 1: /home/minijackson/.icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 2: /nix/store/91gqgx6v5r3yf8g8pfsnya649d64gir2-gnucash-3.4/share/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 3: /nix/store/8m96gcl6b0dx53g4cygllwzfbc56vrx5-hicolor-icon-theme-0.17/share/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 4: /nix/store/85qvxqinhc3837b8r91rq65dgc9p6cbq-gsettings-desktop-schemas-3.28.1/share/gsettings-schemas/gsettings-desktop-schemas-3.28.1/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 5: /nix/store/v1fsmybazgy865xvmwq52wk26p74i0gj-gtk+3-3.24.1/share/gsettings-schemas/gtk+3-3.24.1/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 6: /nix/store/85qvxqinhc3837b8r91rq65dgc9p6cbq-gsettings-desktop-schemas-3.28.1/share/gsettings-schemas/gsettings-desktop-schemas-3.28.1/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 7: /nix/store/v1fsmybazgy865xvmwq52wk26p74i0gj-gtk+3-3.24.1/share/gsettings-schemas/gtk+3-3.24.1/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 8: /nix/store/91gqgx6v5r3yf8g8pfsnya649d64gir2-gnucash-3.4/share/gsettings-schemas/gnucash-3.4/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 9: /run/opengl-driver/share/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 10: /run/opengl-driver-32/share/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 11: /home/minijackson/.nix-profile/share/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 12: /nix/var/nix/profiles/default/share/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 13: /run/current-system/sw/share/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 14: /etc/profiles/per-user/minijackson/share/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 15: /var/empty/local/share/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 16: /var/empty/share/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 17: /nix/store/91gqgx6v5r3yf8g8pfsnya649d64gir2-gnucash-3.4/share/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 18: /nix/store/8m96gcl6b0dx53g4cygllwzfbc56vrx5-hicolor-icon-theme-0.17/share/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 19: /nix/store/85qvxqinhc3837b8r91rq65dgc9p6cbq-gsettings-desktop-schemas-3.28.1/share/gsettings-schemas/gsettings-desktop-schemas-3.28.1/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 20: /nix/store/v1fsmybazgy865xvmwq52wk26p74i0gj-gtk+3-3.24.1/share/gsettings-schemas/gtk+3-3.24.1/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 21: /nix/store/85qvxqinhc3837b8r91rq65dgc9p6cbq-gsettings-desktop-schemas-3.28.1/share/gsettings-schemas/gsettings-desktop-schemas-3.28.1/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 22: /nix/store/v1fsmybazgy865xvmwq52wk26p74i0gj-gtk+3-3.24.1/share/gsettings-schemas/gtk+3-3.24.1/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 23: /nix/store/91gqgx6v5r3yf8g8pfsnya649d64gir2-gnucash-3.4/share/gsettings-schemas/gnucash-3.4/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 24: /run/opengl-driver/share/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 25: /run/opengl-driver-32/share/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 26: /home/minijackson/.nix-profile/share/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 27: /nix/var/nix/profiles/default/share/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 28: /run/current-system/sw/share/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 29: /etc/profiles/per-user/minijackson/share/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 30: /var/empty/local/share/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 31: /var/empty/share/pixmaps
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 32: /nix/store/91gqgx6v5r3yf8g8pfsnya649d64gir2-gnucash-3.4/share/gnucash/icons
* 17:56:25  INFO <gnc.gui> [gnc_load_app_icons] Path 33: /nix/store/91gqgx6v5r3yf8g8pfsnya649d64gir2-gnucash-3.4/share/icons
* 17:56:25  INFO <gnc.app-utils.gsettings> [gnc_gsettings_register_cb] schema: general, key: retain-days, settings_ptr: 0x20b3c30, handler_id: 29
* 17:56:25  INFO <gnc.app-utils.gsettings> [gnc_gsettings_register_cb] schema: general, key: retain-type-never, settings_ptr: 0x20b3c30, handler_id: 30
* 17:56:25  INFO <gnc.app-utils.gsettings> [gnc_gsettings_register_cb] schema: general, key: retain-type-days, settings_ptr: 0x20b3c30, handler_id: 31
* 17:56:25  INFO <gnc.app-utils.gsettings> [gnc_gsettings_register_cb] schema: general, key: retain-type-forever, settings_ptr: 0x20b3c30, handler_id: 32
* 17:56:25  INFO <gnc.app-utils.gsettings> [gnc_gsettings_register_cb] schema: general, key: file-compression, settings_ptr: 0x20b3c30, handler_id: 33
@hedning hedning added the 0.kind: regression Something that worked before working no longer label Jan 19, 2019
@hedning
Copy link
Contributor

hedning commented Jan 19, 2019

Hmm, I'm unable to reproduce (tested at 088cb13 via nix run).

@markuskowa
Copy link
Member

It crashes for me with a segfault, when I run it from a NixOS 18.09 installation but works fine on NixOS unstable. I observed that problem with other packages while reviewing PRs (e.g. gparted).

@samueldr
Copy link
Member

samueldr commented Jan 26, 2019

I have seen the same segmentation fault on other pixbuf-using software running on an 18.09 system using unstable-built software.

This is because pixbuf 2.38 tries to use a 2.36 library.

Just before segfault in dbeaver,

24047 32148 openat(AT_FDCWD, "/nix/store/2csk60d9iy25r84hlz2kdbzlxq4a706b-gdk-pixbuf-2.36.12/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-bmp.so", O_RDONLY) = 31

Just before segfault in (unreleased) netsurf update

3931 32313 openat(AT_FDCWD, "/nix/store/2csk60d9iy25r84hlz2kdbzlxq4a706b-gdk-pixbuf-2.36.12/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so", O_RDONLY|O_CLOEXEC) = 5 

Looks like the same class of bug than #24256.

@jtojnar
Copy link
Member

jtojnar commented Feb 1, 2019

I have always expected gdk-pixbuf loaders to have stable ABI? Is it declared anywhere though?

@samueldr
Copy link
Member

samueldr commented Feb 1, 2019

No idea, I know I'm currently being bitten left and right by this, when doing anything on 18.09 which then uses gdk-pixbuf. The crashes aren't necessarily at start.

google-chrome-beta (on plasma, not in a clean environment) will crash sometimes in the open/save dialog (haven't straced it), but will crash reproducibly here on the print dialog. (Makes sense, a gtk-based thing.)

1216496 16945 openat(AT_FDCWD, "/run/current-system/sw/share/themes/Greybird/gtk-3.0/assets/bullet-symbolic.symbolic.png", O_RDONLY) = 157
1216497 16945 fstat(157, {st_mode=S_IFREG|0444, st_size=147, ...}) = 0
1216498 16945 read(157, "\211PNG\r\n\32\n\0\0\0\rIHDR\0\0\0\16\0\0\0\16\10\6\0\0\0\37H-"..., 65536) = 147
1216499 16945 read(157, "", 65536)              = 0
1216500 16945 stat("/nix/store/fb65ghs5231v5qwjybyd7hx8d1q3bbhl-gdk-pixbuf-2.36.12/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so", {st_mode=S_IFREG|0555, st_size=32992, ...}) = 0
1216501 16945 openat(AT_FDCWD, "/nix/store/fb65ghs5231v5qwjybyd7hx8d1q3bbhl-gdk-pixbuf-2.36.12/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so", O_RDONLY|O_CLOEXEC) = 223
1216502 16945 read(223, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@%\0\0\0\0\0\0"..., 832) = 832
1216503 16945 fstat(223, {st_mode=S_IFREG|0555, st_size=32992, ...}) = 0
1216504 16945 mmap(NULL, 2121784, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 223, 0) = 0x7f8d921b3000
1216505 16945 mprotect(0x7f8d921b8000, 2097152, PROT_NONE) = 0
1216506 16945 mmap(0x7f8d923b8000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 223, 0x5000) = 0x7f8d923b8000
1216507 16945 close(223)                        = 0
1216508 16945 mprotect(0x7f8d923b8000, 4096, PROT_READ) = 0
1216509 16945 --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=NULL} ---

qemu, e.g. starting a build-vm on 18.09 from an unstable checkout, will crash when opening a menu, still on the same plasma machines. This is fixed using wrapGAppsHook.

These are not exhaustive, and I have made a small list of the intersection of the "using gdk_pixbuf" and "not wrapped" package set. I don't know what to do about it though... (The list obviously has false positives in.)

Finally, it seems the spotify segfault could be unrelated, or at least, the strace should show it loading a 2.36 object, not failing to open locale files.

I probably should figure out an automated reproducible test case to validate or invalidate the issue.

@jtojnar
Copy link
Member

jtojnar commented Feb 1, 2019

The gdk-pixbuf is used for loading icons by GTK.

Finally, it seems the spotify segfault could be unrelated, or at least, the strace should show it loading a 2.36 object, not failing to open locale files.

I do not think @hyperfekt choose the right segment of the strace. If there is no further output before the crash, it is probably due to output buffer not being flushed.

@samueldr
Copy link
Member

samueldr commented Feb 1, 2019

The gdk-pixbuf is used for loading icons by GTK.

Yes, (obvious in the trace section, where a png icon is being loaded, and the png module for 2.36 is being loaded).


I do not think @hyperfekt choose the right segment of the strace. If there is no further output before the crash, it is probably due to output buffer not being flushed.

Yeah, hence the could, right now it's inconclusive, but it is likely.

@jtojnar
Copy link
Member

jtojnar commented Feb 1, 2019

Here is a simple repro:

let
  nixpkgs = import (fetchTarball {
    url = "https://github.com/NixOS/nixpkgs/archive/f2a1a4e93be2d76720a6b96532b5b003cc769312.tar.gz";
    sha256 = "1yjk6ffnm6ahj34yy2q1g5wpdx0m1j7h8i4bzn4x78g9chb0ppy4";
  }) {};

  nixpkgs_old = import (fetchTarball {
    url = "https://github.com/NixOS/nixpkgs/archive/10dbdd30d199146bf9b41c029127ffe7b92caff2.tar.gz";
    sha256 = "1mabavzzxbcxr9isk5k9ylr060prgflyaikfk41grb3b4x105na1";
  }) {};
in
with nixpkgs.pkgs;

let
  testSrc = writeText "test.c" ''
    #include <gdk-pixbuf/gdk-pixbuf.h>
    #include <glib.h>

    int main(int argc, char const *argv[]) {
        GError* err = NULL;
        if (gdk_pixbuf_new_from_file("${nixos-artwork.wallpapers.gnome-dark}/share/artwork/gnome/nix-wallpaper-simple-dark-gray_bottom.png", &err) == NULL) {
            g_error("%s", err->message);
            return 1;
        }

        return 0;
    }
  '';
in runCommand "gdk-pixbuf-loading-test" {
    buildInputs = [ gdk_pixbuf pkgconfig gcc makeWrapper ];
  } ''
    mkdir -p $out

    cc \
      $(pkg-config --cflags gdk-pixbuf-2.0) \
      $(pkg-config --libs gdk-pixbuf-2.0) \
      ${testSrc} -o $out/test

    wrapProgram $out/test --set GDK_PIXBUF_MODULE_FILE "${nixpkgs_old.gdk_pixbuf}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"

    $out/test
  ''

@jtojnar
Copy link
Member

jtojnar commented Feb 1, 2019

abidiff /nix/store/b226z7lag85bb15hajm7kzzcm3la0rlw-gdk-pixbuf-2.36.12/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so /nix/store/rk26pyb7qan47q27qikdhhi8p7jyswq2-gdk-pixbuf-2.38.0/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so does not show any difference.

@jtojnar
Copy link
Member

jtojnar commented Feb 1, 2019

Building with debug info

Nix expression
let
  nixpkgs = import (fetchTarball {
    url = "https://github.com/NixOS/nixpkgs/archive/f2a1a4e93be2d76720a6b96532b5b003cc769312.tar.gz";
    sha256 = "1yjk6ffnm6ahj34yy2q1g5wpdx0m1j7h8i4bzn4x78g9chb0ppy4";
  }) {};

  nixpkgs_old = import (fetchTarball {
    url = "https://github.com/NixOS/nixpkgs/archive/10dbdd30d199146bf9b41c029127ffe7b92caff2.tar.gz";
    sha256 = "1mabavzzxbcxr9isk5k9ylr060prgflyaikfk41grb3b4x105na1";
  }) {};

  gdk-pixbuf = nixpkgs.enableDebugging (nixpkgs.gdk_pixbuf.overrideAttrs (attrs: {
    mesonBuildType = "debug";
  }));

  gdk_pixbuf_old = nixpkgs.enableDebugging (nixpkgs_old.gdk_pixbuf.overrideAttrs (attrs: {
    mesonBuildType = "debug";
  }));
in
with nixpkgs.pkgs;

let
  testSrc = writeText "test.c" ''
    #include <gdk-pixbuf/gdk-pixbuf.h>
    #include <glib.h>

    int main(int argc, char const *argv[]) {
        GError* err = NULL;
        if (gdk_pixbuf_new_from_file("${nixos-artwork.wallpapers.gnome-dark}/share/artwork/gnome/nix-wallpaper-simple-dark-gray_bottom.png", &err) == NULL) {
            g_error("%s", err->message);
            return 1;
        }

        return 0;
    }
  '';
in runCommand "gdk-pixbuf-loading-test" {
    buildInputs = [ gdk-pixbuf pkgconfig gcc makeWrapper ];
  } ''
    mkdir -p $out

    cc -ggdb \
      $(pkg-config --cflags gdk-pixbuf-2.0) \
      $(pkg-config --libs gdk-pixbuf-2.0) \
      ${testSrc} -o $out/test

    wrapProgram $out/test --set GDK_PIXBUF_MODULE_FILE "${gdk_pixbuf_old}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"

    # $out/test
  ''

shows some more details

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f3268bc39ff in __memmove_avx_unaligned_erms () from /nix/store/fivq0nbggp4y8mhy3ixprqd7qyn1hy2j-glibc-2.27/lib/libc.so.6
(gdb) bt
#0  0x00007f3268bc39ff in __memmove_avx_unaligned_erms () from /nix/store/fivq0nbggp4y8mhy3ixprqd7qyn1hy2j-glibc-2.27/lib/libc.so.6
#1  0x00007f3266530225 in png_combine_row () from /nix/store/73bda0a26bda42v22y9fj051r44wsyma-libpng-apng-1.6.35/lib/libpng16.so.16
#2  0x00007f3266523438 in png_read_row () from /nix/store/73bda0a26bda42v22y9fj051r44wsyma-libpng-apng-1.6.35/lib/libpng16.so.16
#3  0x00007f3266524faa in png_read_image () from /nix/store/73bda0a26bda42v22y9fj051r44wsyma-libpng-apng-1.6.35/lib/libpng16.so.16
#4  0x00007f326674d0f1 in gdk_pixbuf__png_image_load (f=0x1299260, error=0x7ffcc62a5568) at ../gdk-pixbuf/io-png.c:331
#5  0x00007f32693cb469 in _gdk_pixbuf_generic_image_load (module=module@entry=0x12aa630, f=f@entry=0x1299260, error=error@entry=0x7ffcc62a5568) at ../gdk-pixbuf/gdk-pixbuf-io.c:1000
#6  0x00007f32693cb577 in gdk_pixbuf_new_from_file (filename=0x400868 "/nix/store/wv6f93xfgbzpgi1jnj6rzh0c01nmvxil-simple-dark-gray-2018-08-28/share/artwork/gnome/nix-wallpaper-simple-dark-gray_bottom.png", 
    error=0x7ffcc62a5568) at ../gdk-pixbuf/gdk-pixbuf-io.c:1071
#7  0x000000000040079f in main (argc=1, argv=0x7ffcc62a5658) at /nix/store/9syiafxf5219n2l37ymjnhss81c3l303-test.c:6

Line #4 comes from 2.36, rest from 2.38, perhaps the different libpng or libc versions are the culprit.

@jtojnar
Copy link
Member

jtojnar commented Feb 1, 2019

Using the same set of libraries did not help

Nix expression
let
  nixpkgs = import (fetchTarball {
    url = "https://github.com/NixOS/nixpkgs/archive/f2a1a4e93be2d76720a6b96532b5b003cc769312.tar.gz";
    sha256 = "1yjk6ffnm6ahj34yy2q1g5wpdx0m1j7h8i4bzn4x78g9chb0ppy4";
  }) {};

  nixpkgs_old = fetchTarball {
    url = "https://github.com/NixOS/nixpkgs/archive/10dbdd30d199146bf9b41c029127ffe7b92caff2.tar.gz";
    sha256 = "1mabavzzxbcxr9isk5k9ylr060prgflyaikfk41grb3b4x105na1";
  };

  gdk-pixbuf = nixpkgs.enableDebugging (nixpkgs.gdk_pixbuf.overrideAttrs (attrs: {
    mesonBuildType = "debug";
  }));

  gdk_pixbuf_old = nixpkgs.enableDebugging ((nixpkgs.callPackage "${nixpkgs_old}/pkgs/development/libraries/gdk-pixbuf/default.nix" {}).overrideAttrs (attrs: {
    mesonBuildType = "debug";
  }));
in
with nixpkgs.pkgs;

let
  testSrc = writeText "test.c" ''
    #include <gdk-pixbuf/gdk-pixbuf.h>
    #include <glib.h>

    int main(int argc, char const *argv[]) {
        GError* err = NULL;
        if (gdk_pixbuf_new_from_file("${nixos-artwork.wallpapers.gnome-dark}/share/artwork/gnome/nix-wallpaper-simple-dark-gray_bottom.png", &err) == NULL) {
            g_error("%s", err->message);
            return 1;
        }

        return 0;
    }
  '';
in runCommand "gdk-pixbuf-loading-test" {
    buildInputs = [ gdk-pixbuf pkgconfig gcc makeWrapper ];
  } ''
    mkdir -p $out

    cc -ggdb \
      $(pkg-config --cflags gdk-pixbuf-2.0) \
      $(pkg-config --libs gdk-pixbuf-2.0) \
      ${testSrc} -o $out/test

    wrapProgram $out/test --set GDK_PIXBUF_MODULE_FILE "${gdk_pixbuf_old}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"

    # $out/test
  ''
#0  0x00007f9f3ec639ff in __memmove_avx_unaligned_erms () from /nix/store/fivq0nbggp4y8mhy3ixprqd7qyn1hy2j-glibc-2.27/lib/libc.so.6
#1  0x00007f9f3c5d0275 in png_combine_row () from /nix/store/lk79kfxzf7b1j5yrsmv0z7bmrvfcb9gc-libpng-apng-1.6.35/lib/libpng16.so.16
#2  0x00007f9f3c5c343f in png_read_row () from /nix/store/lk79kfxzf7b1j5yrsmv0z7bmrvfcb9gc-libpng-apng-1.6.35/lib/libpng16.so.16
#3  0x00007f9f3c5c4fba in png_read_image () from /nix/store/lk79kfxzf7b1j5yrsmv0z7bmrvfcb9gc-libpng-apng-1.6.35/lib/libpng16.so.16
#4  0x00007f9f3c7ed0c5 in gdk_pixbuf__png_image_load (f=0x15a4260, error=0x7ffde6a15768) at /build/source/build/../gdk-pixbuf/io-png.c:331
#5  0x00007f9f3f46b469 in _gdk_pixbuf_generic_image_load (module=module@entry=0x15b5630, f=f@entry=0x15a4260, error=error@entry=0x7ffde6a15768)
    at /build/gdk-pixbuf-2.38.0/build/../gdk-pixbuf/gdk-pixbuf-io.c:1000
#6  0x00007f9f3f46b577 in gdk_pixbuf_new_from_file (filename=0x400868 "/nix/store/wv6f93xfgbzpgi1jnj6rzh0c01nmvxil-simple-dark-gray-2018-08-28/share/artwork/gnome/nix-wallpaper-simple-dark-gray_bottom.png", 
    error=0x7ffde6a15768) at /build/gdk-pixbuf-2.38.0/build/../gdk-pixbuf/gdk-pixbuf-io.c:1071
#7  0x000000000040079f in main (argc=1, argv=0x7ffde6a15858) at /nix/store/9syiafxf5219n2l37ymjnhss81c3l303-test.c:6

@pbogdan
Copy link
Member

pbogdan commented Feb 1, 2019

FWIW I used a tweaked version of @jtojnar's expression to run a bisect against gdk-pixbuf which narrowed things down to changes introduced in https://gitlab.gnome.org/GNOME/gdk-pixbuf/commit/c60ffd502cf84ca67777ebf4aa87e65057bd46e0 which, to my very superficial understanding, make the older loader feed garbage to libpng because the layout of some internal data structure has changed.
I applied https://gitlab.gnome.org/GNOME/gdk-pixbuf/commit/5dd78ae0f43666206848bd7223689b9547056933 and https://gitlab.gnome.org/GNOME/gdk-pixbuf/commit/ce9622582221fc7b166dfecf5300b497f737759c to gdk_pixbuf from 18.09 (from what I gather the commits make the loaders use public API instead of prodding said data structure directly) and that seems to keep them compatible across versions in my limited testing.

@Zimmi48
Copy link
Member

Zimmi48 commented Feb 2, 2019

@samueldr Your list has Coq in it, it is because of the CoqIDE gtk application which indeed shows this segmentation fault behavior with a recent nixpkgs-unstable (11cf7d6).

@samueldr
Copy link
Member

samueldr commented Feb 2, 2019

The list was generated by doing an intersection and subtraction of the list of packages depending on gdk_pixbuf - wrapGAppsHook - [all qts...]. This is why it's possible there are false positives, but short of software shipping their own gdk_pixbuf, shouldn't be false negatives (excluding interactions with Qt).

@das-g
Copy link
Member

das-g commented Feb 22, 2019

Ah, so that's why I get a segfault in when trying to run UMLet (nixpkgs.umlet) from nixpkgs master on NixOS 18.09?

I can confirm that (like in #56145 & #55048) this happens also on b9d77e9, but not on b9d77e9^ (f6c9a67). (As the segfault looked so similar, I didn't git bisect and only tested these two revisions.)

@das-g
Copy link
Member

das-g commented Feb 22, 2019

Should I file a separate NixOS/nixpkgs issue about UMLet? If not, should the title of one of the existing issues be changed to indicate that more than a single application is affected?

@jtojnar jtojnar changed the title GnuCash segmentation fault Programs using gdk_pixbuf 2.38 crash with 2.36 loaders from system Feb 22, 2019
@jtojnar
Copy link
Member

jtojnar commented Feb 22, 2019

Renamed this one since it has the most detail.

@alex-giusi-tiri
Copy link

I think what I am experiencing could be related to this bug (because of the reference to libgtk-3.so.0.2404.0 in journalctl):

Since I updated to the 19.03 channel, this happens. However, I have now rolled back to 18.09.

All open MATE terminals crash when one tab or a window is closed (via the GUI X button) and if the option Menu > Edit > Profiles > Default > Edit > Title and Command > When command exists == "Hold the terminal open".
If that option's value is kept to "Hold the terminal open", and if exit is executed before the tab is closed on a window having multiple tabs open, or if exit is executed on all tabs of a window, and the window is closed, then not any crash happens.
If that option has any other value, then not any crash happens, regardless of how the terminal is closed.

I have attached straces of multiple cases of workflow for comparison, and some journalctl entries.
mate-terminal-when_exit_termin-on_close_tab_button+close_win_button-strace.log
mate-terminal-when_exit_termin-on_exit_cmds-strace.log
mate-terminal-when_hold_termin_open-on_close_tab_button-strace.log
mate-terminal-when_hold_termin_open-on_close_window_button-strace.log
mate-terminal-when_hold_termin_open-on_exit_cmd+close_tab_button+close_window_button-strace.log
mate-terminal-when_hold_termin_open-on_exit_cmds+close_tab_button+close_window_button-strace.log
mate-terminal-when_restart_cmd-on_close_tab_button+close_win_button-strace.log
mate-terminal-when_restart_cmd-on_exit_cmd+close_win_button-strace.log
mate-terminal-crash-journalctl.log
os-release.txt

@das-g das-g mentioned this issue Mar 5, 2019
10 tasks
@cdepillabout
Copy link
Member

Is there a solution or workaround for this? I have a user of Termonad that is running into this:

cdepillabout/termonad#107

Is setting the GDK_PIXBUF_MODULE_FILE in the wrapper the way to deal with this?

@fare
Copy link
Contributor

fare commented Mar 15, 2019

Chatting with @jtojnar on IRC, I found that if I unset GIO_EXTRA_MODULES GDK_PIXBUF_MODULE_FILE GI_TYPELIB_PATH then the newly compiled qiv (2.3.2 using the gnome-3.32 branch, or the 2.3.1 straight from channels/nixpkgs-unstable) works correctly.

@minijackson
Copy link
Member Author

I've tested @fare's solution with GnuCash and it also works correctly! I've only needed to unset the GDK_PIXBUF_MODULE_FILE (GI_TYPELIB_PATH isn't set in my environment and GnuCash runs fine with the default GIO_EXTRA_MODULES)

This also fixes unstable's Inkscape that has been segfaulting like GnuCash.

Thank you for the temporary fix!

@das-g
Copy link
Member

das-g commented Jul 13, 2019

With NixOS 19.03 released, is this still an issue? Is something still to be done for it not becoming an issue again?

@Zimmi48
Copy link
Member

Zimmi48 commented Jul 13, 2019

My impression is that this is no longer an issue but nothing has been done to avoid this issue to arise again.

@alex-giusi-tiri
Copy link

alex-giusi-tiri commented Jan 9, 2020

I still have this issue on NixOS 19.09.1806.b047b7315d8c9bee05e3b2d7daf0a357099180fa (Loris) x86_64, like described before: comment.
Unsetting unset GIO_EXTRA_MODULES GDK_PIXBUF_MODULE_FILE GI_TYPELIB_PATH does not seem to have an effect for 19.03, 19.09.
I ran this in my terminal; is that the intended place? Should it be applied when compiling mate-terminal, for e.g?
Thanks!

@jtojnar
Copy link
Member

jtojnar commented Jan 10, 2020

@alex-giusi-tiri If you unset GDK_PIXBUF_MODULE_FILE then you are most likely experiencing a different bug and I suggest opening a new issue including logs and a backtrace (coredumpctl gdb and then bt full).

@stale
Copy link

stale bot commented Jul 8, 2020

Hello, I'm a bot and I thank you in the name of the community for opening this issue.

To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 8, 2020
timor added a commit to timor/factor that referenced this issue Mar 16, 2021
This resolves a problem when the wrapped Factor binary is executed with
`GDK_PIXBUF_MODULE_FILE` set to an incompatible version.  This happens if e.g.
Factor is run from within an Emacs that uses newer gdk versions.

Related NixOS issue: NixOS/nixpkgs#54278

In the long run, this should be replaced by a derivation which correctly runs
through all the phases correctly to set up `wrapGAppsHook` correctly.
timor added a commit to timor/factor that referenced this issue Mar 16, 2021
This resolves a problem when the wrapped Factor binary is executed with
`GDK_PIXBUF_MODULE_FILE` set to an incompatible version.  This happens if e.g.
Factor is run from within an Emacs that uses newer gdk versions.

Related NixOS issue: NixOS/nixpkgs#54278

In the long run, this should be replaced by a derivation which correctly runs
through all the phases correctly to set up `wrapGAppsHook` correctly.  Even
then, the correct behavior would probably be to have the surrounding
environment (e.g. Emacs) restore the default variable value in it's
sub-environments.
mrjbq7 pushed a commit to factor/factor that referenced this issue Mar 16, 2021
This resolves a problem when the wrapped Factor binary is executed with
`GDK_PIXBUF_MODULE_FILE` set to an incompatible version.  This happens if e.g.
Factor is run from within an Emacs that uses newer gdk versions.

Related NixOS issue: NixOS/nixpkgs#54278

In the long run, this should be replaced by a derivation which correctly runs
through all the phases correctly to set up `wrapGAppsHook` correctly.  Even
then, the correct behavior would probably be to have the surrounding
environment (e.g. Emacs) restore the default variable value in it's
sub-environments.
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/ubuntu-with-nix-and-home-manager-gtk-file-save-dialogs-make-applications-crash-gdk-pixbuf-env-var-faulty/14921/4

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 8, 2022
@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 10, 2022
@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/failing-to-run-old-version-of-gnu-cash/33128/2

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: regression Something that worked before working no longer
Projects
None yet
Development

No branches or pull requests