So, this bug will require a rebuild of the snap-store
snap to fix. The fix involves adding the network-status
plug to the snap.
Now for a post mortem of how this happened:
- snap-store/gnome-software is using GLib’s GNetworkMonitor API to decide whether the machine is currently connected to the Internet.
- when portals are enabled, GNetworkMonitor will consult xdg-desktop-portal’s
org.freedesktop.portal.NetworkMonitor
API to determine whether the computer is online. This avoids using the higher privilege APIs of the other GNetworkMonitor backends (talking to NetworkManager, or using netlink sockets). - Before responding, xdg-desktop-portal checks to see whether the sandboxed application has access to the network. For snaps, this is done by checking for a connected
network-status
plug (I’d originally had this check fornetwork
, but it was decided to change this). - As the
snap-store
snap does not plugnetwork-status
, the connectivity check fails.
Now that explains why the current revision of the snap fails. Why did previous revisions of the snap function correctly?
- We can see that portals are enabled in the snap, since its
meta/snap.yaml
file contains:environment: ... GTK_USE_PORTAL: '1'
- This fragment of yaml does not occur directly in the snap’s
snapcraft.yaml
file: it is introduced because the snap uses thegnome-3-34
Snapcraft extension. - The equivalent
meta/snap.yaml
fragment in revision 518 of the snap reads:
Note the extra ‘S’ in the environment variable name: due to this spelling mistake, portal support was not enabled and a different connectivity check was used (most likely NetworkManager).extensions: ... GTK_USE_PORTALS: '1'
- So the behaviour change is due to the revisions being built with different versions of Snapcraft. Checking the
snap/manifest.yaml
files, I can see that r518 was built with Snapcraft 4.4.4, and r542 with Snapcraft 4.8.1. It looks like the environment variable change happened in Snapcraft 4.5.
This is something we should have picked up in testing. However, it was a bit of a rushed update due to the libatk incompatibility uncovered by an update to the gnome-3-34 platform snap. It certainly means we need to perform more testing of desktop snaps whose last stable version was built with Snapcrafts from before 4.5.