Comment 5 for bug 1814592

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Sigh, comment #4 had too many typos that I'm going to just restate it in corrected form here (sorry; editing comments would be a nice feature in LP...)

Samuele, the OR is definitely the case for all previous interfaces, but these new personal-files and system-files interfaces are different in that the attribute itself is meant to be a list of paths for read and write such that the snap can do:

plugs:
  personal-files:
    read:
    - $HOME/.foo
    - $HOME/.bar
    write:
    - /etc/baz
    - /etc/norf

In this case, the snap is declaring it wants all of them. I would therefore expect the snap declaration to be of the form:

{
  "personal-files": {
    "allow-auto-connection": "true",
    "allow-installation": {
      "plug-attributes": {
        "read": [
          "\\$HOME/\\.foo",
          "\\$HOME/\\.bar"
        ],
        "write": [
          "/etc/baz",
          "/etc/norf"
        ]
      }
    }
  }
}

Rather than:

{
  "personal-files": {
    "allow-auto-connection": "true",
    "allow-installation": [
      {
        "plug-attributes": {
          "read": "\\$HOME/\\.foo"
        }
      },
      {
        "plug-attributes": {
          "read": "\\$HOME/\\.bar"
        }
      },
      {
        "plug-attributes": {
          "write": "/etc/baz"
        }
      },
      {
        "plug-attributes": {
          "write": "/etc/norf"
        }
      }
    ]
  }
}

This latter syntax seems to make more sense when the interface attribute is a string and the snap is plugging the interface multiple times, like with the dbus and the name attribute for providing multiple dbus services in the snap. The latter syntax for when the interface attribute is a list of strings is a bit awkward.

Granted, the syntax I was expecting does mean that the snap must match the complete list, which is potentially awkward if the snap decides to drop one of the paths. I don't think we ever explicitly discussed what happens when an interface attribute is itself a list, so it is good to have this conversation.