Request for auto-connection for Recollectr

Okay, successfully pushed and awaiting manual review!

I assume the main reason is then it only has to be done once when the snap is installed (this can be done via the install hook for instance) - and can be cleaned up easily when the snap is removed (via the remove hook).

1 Like

@Igor could you please perform publisher vetting as requested? Thanks!

1 Like

+1 from me, I verified the publisher.

1 Like

Hey @Recollectr,

Since publisher vetting was completed, I was about to grant the system-files declaration but I noticed your latest revision is not plugging system-files anymore. Are you planning to add it back?

1 Like

Hey @emitorino,

Yes we’ve just pushed a version that adds the declaration back. We’d removed it temporarily so that a security-related update could go through without any delays. The version is Rev 28.

Thanks very much @emitorino, @igor, and @alexmurray for your help with this.

2 Likes

@Recollectr thanks for the clarification and sorry but could you please follow the interface reference suggestions made by @alexmurray? I see you only added support for chrome so, at least please specify it this way:

The system-files doc can provide further details as needed.

Thanks!

1 Like

Hm yes I guess it makes sense to include all Chromium-based browsers so we’ll update that, leaving Firefox off for now.

Can you clarify what needs to change syntactically? You mean we should specify the etc-chromium-native-messaging-recollectr part for each plug we request, correct? I’ll look into how we can specify that.

In your snapcraft.yaml you should have something like:

etc-chromium-native-messaging-hosts-recollectr-chrome:
  interface: system-files
  write:
  - /etc/chromium/native-messaging-hosts/com.recollectr.chrome.ext.json

instead of:

system-files:
     write:
       - /etc/chromium/native-messaging-hosts/com.recollectr.chrome.ext.json
1 Like

Thanks very much for the clarification @emtorino!

Later this week we’ll push a new version using that format, with the additional paths for each browser we intend to support.

1 Like

Hit a small snag trying to finish this up today; when we try to install our snap to test prior to uploading, using the --dangerous flag, and then run our application, we get:

The futex facility returned an unexpected error code.[1] 75368 abort (core dumped) recollectr

Is this error expected for snaps installed with --dangerous that request access to 'system-files', or is it indicative of some other problem? If we disable the request for the plug and rebuild, Recollectr starts up without issue.

did you actually connect the interface plugs ? auto-connection is not applied when using --dangerous …

@Recollectr in case you are not familiar with how to connect the interface, please check the Manual connections section of https://snapcraft.io/docs/interface-management. The command is:

$ snap connect <snap>:<plug interface>

In this case you should run something like:

$ sudo snap connect recollectr:etc-chromium-native-messaging-hosts-recollectr-chrome

@ogra and @emitorino thank you for the replies.

@emitorino does that mean that a snap requesting access to 'system-files' won’t run unless users manually connect the interface? I wouldn’t expected that failing to connect a plug would crash the app.

But even after manually connecting every plug, the app simply crashes with a different message:

[1] 79208 segmentation fault (core dumped) recollectr

The application’s code doesn’t currently try to access these plugged locations, so I’m not sure why it would crash, but it does crash, immediately, so I don’t think we’re even getting to our application code.

It sounds like this is not expected, but removing the plug requests from our configuration resolves the issue, so maybe that points to some issue in the software we use to build our app? (electron-builder)

Not really. In this request you are asking for auto-connection, so your users won’t need to run this manual connection mitigation. You need to do that now since the changes are not yet applied on the store side (we are waiting for your updates, I still don’t see the suggestions we made applied). Please see process-for-aliases-auto-connections-and-tracks for further details.

It is indeed not expected. Can you share how your snapcraft.yaml look like for the system-files plug?

1 Like

Thanks for the clarification @emitorino.

Although we’ve made the changes, we hadn’t uploaded any new version yet since they just crash. But since we don’t have a snapcraft.yaml to share, it seems like the best way for you to see what we’re seeing is to just upload it, so I’m pushing it as candidate now (rev29).

====

Update: Found the snap.yaml - it looks like this:

base: core18
grade: stable
confinement: strict
plugs:
  gnome-3-28-1804:
    interface: content
    target: $SNAP/gnome-platform
    default-provider: gnome-3-28-1804
  gtk-3-themes:
    interface: content
    target: $SNAP/data-dir/themes
    default-provider: gtk-common-themes
  icon-themes:
    interface: content
    target: $SNAP/data-dir/icons
    default-provider: gtk-common-themes
  sound-themes:
    interface: content
    target: $SNAP/data-dir/sounds
    default-provider: gtk-common-themes
  etc-chromium-native-messaging-recollectr:
    interface: system-files
    write:
      - /etc/chromium/native-messaging-hosts/com.recollectr.chrome.ext.json
  etc-opt-chrome-native-messaging-recollectr:
    interface: system-files
    write:
      - /etc/opt/chrome/native-messaging-hosts/com.recollectr.chrome.ext.json
  etc-opt-edge-native-messaging-recollectr:
    interface: system-files
    write:
      - /etc/opt/edge/native-messaging-hosts/com.recollectr.chrome.ext.json
  hostfs-mozilla-native-messaging-recollectr:
    interface: system-files
    write:
      - /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/com.recollectr.chrome.ext.json
name: recollectr
version: 3.15.113
title: Recollectr
summary: Recollectr
description: Record and recall without breaking your flow
architectures:
  - amd64
apps:
  recollectr:
    command: command.sh
    plugs:
      - etc-chromium-native-messaging-recollectr
      - etc-opt-chrome-native-messaging-recollectr
      - etc-opt-edge-native-messaging-recollectr
      - hostfs-mozilla-native-messaging-recollectr
    autostart: recollectr.desktop
    environment:
      DISABLE_WAYLAND: '1'
      TMPDIR: $XDG_RUNTIME_DIR
      PATH: $SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin:$PATH
      SNAP_DESKTOP_RUNTIME: $SNAP/gnome-platform
      LD_LIBRARY_PATH: $SNAP_LIBRARY_PATH:$SNAP/lib:$SNAP/usr/lib:$SNAP/lib/x86_64-linux-gnu:$SNAP/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH:$SNAP/lib:$SNAP>

That’s not necessarily exactly what our input configuration looks like - since Electron-Builder manages most of the file, but the plugs are there. I think it must be correct since when we had a syntax error, the installation process warned about it, or maybe outright errored.

Thank you again for your help with this!

I can reproduce the crash but I don’t think it is related to the system-files usage - if I compare the snap.yaml from the current stable revision 27 to the one you uploaded in revision 29, we see the following differences:

--- squashfs-root-orig/meta/snap.yaml	2021-08-19 04:33:10.000000000 +0930
+++ squashfs-root/meta/snap.yaml	2021-09-04 06:37:17.000000000 +0930
@@ -18,8 +18,24 @@
     interface: content
     target: $SNAP/data-dir/sounds
     default-provider: gtk-common-themes
+  etc-chromium-native-messaging-recollectr:
+    interface: system-files
+    write:
+      - /etc/chromium/native-messaging-hosts/com.recollectr.chrome.ext.json
+  etc-opt-chrome-native-messaging-recollectr:
+    interface: system-files
+    write:
+      - /etc/opt/chrome/native-messaging-hosts/com.recollectr.chrome.ext.json
+  etc-opt-edge-native-messaging-recollectr:
+    interface: system-files
+    write:
+      - /etc/opt/edge/native-messaging-hosts/com.recollectr.chrome.ext.json
+  hostfs-mozilla-native-messaging-recollectr:
+    interface: system-files
+    write:
+      - /var/lib/snapd/hostfs/usr/lib/mozilla/native-messaging-hosts/com.recollectr.chrome.ext.json
 name: recollectr
-version: 3.15.110
+version: 3.15.113
 title: Recollectr
 summary: Recollectr
 description: Record and recall without breaking your flow
@@ -29,18 +45,10 @@
   recollectr:
     command: command.sh
     plugs:
-      - desktop
-      - desktop-legacy
-      - home
-      - x11
-      - wayland
-      - unity7
-      - browser-support
-      - network
-      - gsettings
-      - audio-playback
-      - pulseaudio
-      - opengl
+      - etc-chromium-native-messaging-recollectr
+      - etc-opt-chrome-native-messaging-recollectr
+      - etc-opt-edge-native-messaging-recollectr
+      - hostfs-mozilla-native-messaging-recollectr
     autostart: recollectr.desktop
     environment:
       DISABLE_WAYLAND: '1'

ie. whilst the system-files plugs have been added you have now dropped the various desktop related plugs - I then tested manually adding these to the snap.yaml of revision 29 and can confirm once these are then present the snap does not crash when being launched. So please re-add these and it should work as expected.

1 Like

Ahhh that makes sense! Thank you @alexmurray!

I guess when you define named plugs in Electron-Builder it no longer adds the set of plugs it normally includes by default. We’ll have a new version uploaded soon.

Revision 30 tested, uploaded, and ready for review!

Thanks - as above, I have granted use-of but not auto-connect for these system-files instances. This is now live.

1 Like