Content interface parsing too lenient
Bug #1666739 reported by
Michi Henning
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
New
|
Undecided
|
Unassigned |
Bug Description
The following is accepted by snapcraft without error:
client-libs:
interface: content
content: client-libs
read: $SNAP/lib/client
When installing the snap, I get the message:
... bad plugs or slots client-libs (read or write path must be set)
The above should be instead:
client-libs:
interface: content
content: client-libs
read: [$SNAP/lib/client]
Or:
client-libs:
interface: content
content: client-libs
read:
- $SNAP/lib/client
snapcraft should tell me that my yaml is invalid instead of silently failing to set the attribute.
To post a comment you must log in.
This is a section of the YAML that snapcraft silently passes through to snapd (it doesn't process it whatsoever). Actually validating it would require one of two things:
1) snapcraft to maintain a schema for all snapd interfaces
2) snapd to add some sort of validation function
(1) is problematic as, first of all, it's redundant. That information is already maintained in snapd. It would also require either the snapcraft team to closely monitor snapd PRs, or require the snapd team to notify the snapcraft team whenever they're making an interface change. They're also released on separate schedules, so you might end up with snapcraft not passing a schema that's actually valid in a newer snapd, or vice-versa.
(2) is possible, but would need to be implemented by snapd, and Snapcraft would need to actually depend upon snapd (it's currently only a Suggests), which would throw it into dist-upgrade territory.
I'm not sure there's an elegant solution for this.