Gnome-3-38-2004: Python gobject introspection broken on stable (segfaults)

Consider this minimal reproducer:

name: gitest
base: core20
version: test
summary: Test python gi.repository import
description: |
  Test python gi.repository import

grade: devel
confinement: devmode

    command: gitest
      - gnome-3-38

    plugin: nil
    override-build: |
      touch $SNAPCRAFT_PART_INSTALL/gitest
      chmod +x $SNAPCRAFT_PART_INSTALL/gitest


$ snap info gnome-3-38-2004 | grep stable
tracking:     latest/stable
  latest/stable:    0+git.6ba6040 2021-09-21 (76) 254MB -

this fails when trying to import via GObject introspection:

$ snap run --shell gitest
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

$ python3
Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> gi.require_version("Gtk", "3.0")
>>> from gi.repository import Gtk
Segmentation fault (core dumped)

with gnome-3-38-2004 from candidate:

$ snap info gnome-3-38-2004 | grep candidate
tracking:     latest/candidate
  latest/candidate: 0+git.cd626d1 2021-11-16 (87) 259MB -

this works again:

$ python3
Python 3.8.10 (default, Jun  2 2021, 10:49:15) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from gi.repository import Gtk

(.:354217): dbind-WARNING **: 10:48:50.733: Couldn't connect to accessibility bus: Failed to connect to socket /tmp/dbus-vdXnQGroWF: No such file or directory
<stdin>:1: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.

I’ll leave this here for visibility, and might get around to reporting it as a bug later on. I think a new release to stable with this fixed is required. Some automated tests for such things would be a good idea, too.

Edit: Here’s the bug:

I have a similar setup, except that I use a custom python interpreter rather than the one provided by core20 (and overridden by the gnome extension). Also, I noticed that you’re not using the python snap plugin… I tried your test and couldn’t reproduce the segfault with my setup. Not really sure what the issue is with python and that extension. Here’s my snapcraft.yaml for reference: Gnome extension conflicts with python plugin

This wasn’t a regression in the platform snap, it was never working properly. It was something I fixed and published to candidate since. We have a few nice fixes queued up in candidate and I plan to finish testing those and promote to stable early next week.


Thanks a lot, I appreciate it.

For educational purposes, if you don’t mind: What was the problem in the first place? Which change fixes it?

It was caused by a mixture of stage packages that brought in some dependencies which conflicted with some packages that were being built from source in the SDK snap. I cleaned up those stage-packages, which fixed this.

For the record: The problem has been resolved with revision 87 of gnome-3-38-2004.

1 Like