NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.63k stars 13.78k forks source link

qutebrowser crashes on file dialog #168484

Open ipvych opened 2 years ago

ipvych commented 2 years ago

Describe the bug

Opening file picker in qutebrowser crashes it with

(python3.9:237842): GLib-GIO-ERROR **: 15:44:11.748: No GSettings schemas are installed on the system

Steps To Reproduce

  1. qutebrowser -T
  2. :open https://viljamis.com/filetest/
  3. Click on Choose file

Expected behavior

qutebrowser should not crash and show GTK file picker.

Additional context

This appears to be similar to #161399, but trying to do the same fix I tried in #162089 does not seem to solve this issue.

Notify maintainers

@jagajaga @rnhmjoj @ebzzry @dotlambda

Metadata

> nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.17.0-zen1, NixOS, 22.05 (Quokka), 22.05.20220406.b6966d9`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.7.0`
 - nixpkgs: `/nix/store/gyzqxklnmyzl773qpqylnfvhg6gimyad-source`

> qutebrowser -T --version
         ______     ,,
    ,.-"`      | ,-` |
  .^           ||    |
 /    ,-*^|    ||    |
;    /    |    ||    ;-*```^*.
;   ;     |    |;,-*`         \
|   |     |  ,-*`    ,-"""\    \
|    \   ,-"`    ,-^`|     \    |
 \    `^^    ,-;|    |     ;    |
  *;     ,-*`  ||    |     /   ;;
    `^^`` |    ||    |   ,^    /
          |    ||    `^^`    ,^
          |  _,"|        _,-"
          -*`   ****"""``

qutebrowser v2.5.0
Git commit: 
Backend: QtWebEngine 5.15.8, based on Chromium 87.0.4280.144
Qt: 5.15.3

CPython: 3.9.11
PyQt: 5.15.4

sip: 6.5.1
colorama: no
jinja2: 3.0.3
pygments: 2.11.2
yaml: 6.0
adblock: 0.5.2
PyQt5.QtWebEngineWidgets: yes
PyQt5.QtWebEngine: 5.15.4
PyQt5.QtWebKitWidgets: no
pdf.js: 2.8.335 (/nix/store/z5n6n43w80lh2p2pfp694q38chlrmnl0-pdfjs-2.8.335/build/pdf.js)
sqlite: 3.38.1
QtNetwork SSL: OpenSSL 1.1.1n  15 Mar 2022

Style: Adwaita::Style
Platform plugin: xcb
OpenGL: Intel, 4.6 (Compatibility Profile) Mesa 21.3.8
Platform: Linux-5.17.0-zen1-x86_64-with-glibc2.34, 64bit
Linux distribution: NixOS 22.05 (Quokka) (nixos)
Frozen: False
Imported from /nix/store/n6igivhh4ly81khcmldpglph8vpq5lff-qutebrowser-2.5.0/lib/python3.9/site-packages/qutebrowser
Using Python from /nix/store/9px00aaqzb6n5p03i9wd8rx3msg95y9r-python3-3.9.11/bin/python3.9
Qt library executable path: /nix/store/p1aapf3rsdw6xvj557as4694l78zd1hc-qtbase-5.15.3/libexec, data path: /nix/store/p1aapf3rsdw6xvj557as4694l78zd1hc-qtbase-5.15.3

Paths:
cache: /tmp/qutebrowser-basedir-25nfm2h_/cache
config: /tmp/qutebrowser-basedir-25nfm2h_/config
data: /tmp/qutebrowser-basedir-25nfm2h_/data
runtime: /tmp/qutebrowser-basedir-25nfm2h_/runtime

Autoconfig loaded: yes
Config.py: no config.py was loaded
Uptime: 0:00:00
rnhmjoj commented 2 years ago

I'm a bit confused: qutebrowser has no GTK dependency at all, AFAIK. The file picker dialog opens up just fine and it's a standard Qt window, for me.

Maybe this has something to do with your theme Adwaita::Style, I have no Qt themes installed.

ipvych commented 2 years ago

This happened because I used QT_QPA_PLATFORMTHEME and QT_STYLE_OVERRIDE environment variables to force Qt to use my GTK theme, removing them fixed issue with qutebrowser.

I will try to find out why using these variables causes issues. Sorry for bothering, you can close this issue now since it is not related to qutebrowser.

rnhmjoj commented 2 years ago

No GSettings schemas are installed on the system

This error usually happens when a GTK application hasn't been wrapped (to run with GTK environment variables). I guess that in this case the theme must run some GTK code inside qutebrowser environment, which doesn't have those variables. I don't think you can wrap a theme, so you could try setting them directly in your interactive shell, it's usually something like this:

export GIO_EXTRA_MODULES='/nix/store/<hash>-dconf-0.40.0-lib/lib/gio/modules'
export GDK_PIXBUF_MODULE_FILE='/nix/store/<hash>-librsvg-2.52.4/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache'
export XDG_DATA_DIRS='/nix/store/<hash>-gtk+3-3.24.30/share/gsettings-schemas/gtk+3-3.24.30:/nix/store/<hash>-gsettings-desktop-schemas-41.0/share/gsettings-schemas/gsettings-desktop-schemas-41.0'
ipvych commented 2 years ago

I wrapped qutebrowser with these variables like so:

(writeShellScriptBin "qutebrowser" ''
        export GIO_EXTRA_MODULES='${dconf}/lib/gio/modules'
        export GDK_PIXBUF_MODULE_FILE='${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache'
        export XDG_DATA_DIRS='${gtk3}/share/gsettings-schemas/gtk+3-${gtk3.version}:${gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas-${gsettings-desktop-schemas.version}'
        ${qutebrowser}/bin/qutebrowser "$@"
      '')

And file picker shows up without crashes, thanks!

nixos-discourse commented 1 year ago

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

https://discourse.nixos.org/t/qutebrowser-crashes-on-file-dialog/23796/1

dschrempf commented 1 year ago

FYI, the workaround of @ivan-pop also works for me. I use qt.platformTheme from Home Manager which is setting the mentioned environment variables and was causing this bug. I do think that more people are using this setting so it would be important to know if this bug is solely related to qutebrowser or if it also affects other Qt applications.

dschrempf commented 1 year ago

This was affecting me also in other applicaitons (vlc, pircard). I had to set xdg.systemDirs.data with home manager to

  xdg.systemDirs.data = [ "${gtk3}/share/gsettings-schemas/gtk+3-${gtk3.version}"
                          "${gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas-${gsettings-desktop-schemas.version}" ];

Setting GIO_EXTRA_MODULES and GDK_PIXBUF_MODULE_FILE is unnecessary, because they are correctly set by the qutebrowser executable (and I guess also by the other executables because I did not experience any problems).

Let me know if we should inform the Home Manager guys. I think this is ultimately caused by the qt.platformTheme = "gnome"; setting.

pmiddend commented 9 months ago

I'm not using qt.platformTheme, still got the crash, and still the fix for systemDirs.data by @dschrempf works for me. Any update on this issue in general?

Aleksanaa commented 7 months ago

I wrapped qutebrowser with these variables like so:

(writeShellScriptBin "qutebrowser" ''
        export GIO_EXTRA_MODULES='${dconf}/lib/gio/modules'
        export GDK_PIXBUF_MODULE_FILE='${librsvg}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache'
        export XDG_DATA_DIRS='${gtk3}/share/gsettings-schemas/gtk+3-${gtk3.version}:${gsettings-desktop-schemas}/share/gsettings-schemas/gsettings-desktop-schemas-${gsettings-desktop-schemas.version}'
        ${qutebrowser}/bin/qutebrowser "$@"
      '')

And file picker shows up without crashes, thanks!

Try WrapGAppsHook?