Content interface supports multiple sources, but only one destination

Bug #1636633 reported by Kyle Fazzari
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapd
Fix Released
High
Zygmunt Krynicki

Bug Description

Take the following slot definition:

    slots:
      shared:
        content: shared
        interface: content
        read:
          - /dir1
          - /dir2

Pair it with the following corresponding plug definition:

    plugs:
      shared:
        content: shared
        interface: content
        target: my-target

Note that the slot supports multiple sources, and the plug supports only a single target. The result isn't particularly useful: first, <slot snap>/dir1 is bind-mounted to <plug snap>/my-target, then <slot snap>/dir2 is bind-mounted again to <plug snap>/my-target. So <plug snap>/my-target is always <slot snap>/dir2.

I look at this interface and can't come up with a rational user expectation for what _should_ happen in this case. Is what's currently happening expected? How do we expect multiple sources to be useful?

Kyle Fazzari (kyrofa)
description: updated
description: updated
Kyle Fazzari (kyrofa)
description: updated
description: updated
Kyle Fazzari (kyrofa)
affects: snapd (Ubuntu) → snapd
Zygmunt Krynicki (zyga)
no longer affects: snappy
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I think this was a bug in the original design. Ideally we would allow some semantics (e.g. unification) or require matching number of targets. Before we decide what that should do I think we should disallow any content slots that have more than one entry in either read or write.

Changed in snapd:
status: New → In Progress
assignee: nobody → Zygmunt Krynicki (zyga)
importance: Undecided → High
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This is addressed by the improved design [1] and there's a PR [2] pending that will enable it. That PR, among other things, will allow connecting multiple things into one
place with sensible semantics.

[1] https://forum.snapcraft.io/t/improvements-in-the-content-interface/2387
[2] https://github.com/snapcore/snapd/pull/4068

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This has been merged and will be available in 2.31. One support PR for being able to use it in read-only $SNAP is still pending but it already works for $SNAP_DATA and $SNAP_COMMON based content sharing.

Changed in snapd:
status: In Progress → Fix Committed
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This has been released and with several other fixes is available in 2.32.x

Changed in snapd:
status: Fix Committed → Fix Released
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.