plugs in apps in snap.yaml makes global plugs ignored for hooks

Bug #1854046 reported by Ian Johnson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Won't Fix
High
Unassigned

Bug Description

with a snap.yaml that globally declares its plugs and also declares app-specific plugs like so:
```
name: lp-1854046
version: '0.1'
summary: regression test snap for LP bug 1854046
description: https://bugs.launchpad.net/snapd/+bug/1854046
base: core18
architectures:
- amd64
confinement: strict
grade: stable
plugs:
  opengl: null
apps:
  lp-1854046:
    command: snap/command-chain/snapcraft-runner $SNAP/command-lp-1854046.wrapper
    plugs:
    - opengl
```

The top level plugs are ignored and not generated in the policy for the hooks. You can see this with a simple configure hook that tries to read from /var/lib/snapd/libs/gl/libGL (an access which is provided by the opengl interface):

```
#!/bin/sh -e
sha1sum /var/lib/snapd/lib/gl/libGL.so.1
```

With this the snap will refuse to install.

Changed in snapd:
assignee: nobody → Ian Johnson (anonymouse67)
Revision history for this message
Sergio Cazzolato (sergio-j-cazzolato) wrote :

I tagged that as high importance because ian is already working on this, thanks Ian for raising the issue.

Changed in snapd:
importance: Undecided → High
Changed in snapd:
status: New → Triaged
Revision history for this message
Ian Johnson (anonymouse67) wrote :

I adjusted the title/description as this bug is a little bit more finicky but I have a full regression test we can use for this.

description: updated
summary: - global plugs in snap.yaml makes hook plugs ignored
+ plugs apps in snap.yaml makes global plugs ignored for hooks
summary: - plugs apps in snap.yaml makes global plugs ignored for hooks
+ plugs in apps in snap.yaml makes global plugs ignored for hooks
Revision history for this message
Ian Johnson (anonymouse67) wrote :

Closing this with AsDesigned because the top-level (also known by me as "global") plugs/slots operate in two ways:

- as applying to all hooks and apps if _none_ of the apps and hooks declare plugs/slots
- as a "pool" of plugs/slots where individual apps/hooks can explicitly use each individual plug/slot from the top-level declaration and that plug/slot becomes "scoped" to that app hook and other apps/hooks that don't declare any of those top-level plugs/slots don't automatically get them

This case is the latter, where the lp-1854046 app is scoping the opengl plug, denying the plug to the install hook. To make this particular snap work, the solution is to either not declare plugs in the opengl app or to also explicitly declare the opengl interface as a plug.

Changed in snapd:
status: Triaged → Won't Fix
assignee: Ian Johnson (anonymouse67) → nobody
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.