Allowable characters in some section of gadget.yaml

Barry Warsaw barry at ubuntu.com
Fri Feb 3 17:39:07 UTC 2017


Over in LP: #1661515, a bug describes an ubuntu-image parsing error in the
defaults section of a gadget.yaml:

https://bugs.launchpad.net/ubuntu-image/+bug/1661515

The spec does not define what is allowed in the defaults section:

https://github.com/snapcore/snapd/wiki/Gadget-snap#gadget.yaml

The current ubuntu-image code assumes defaults can contain only a-zA-Z0-9 for
the <snap id> and the same plus dashes for the <key>.  There is no restriction
on the <value>.

The bug happens because the <key> has a dot in it.  The fix is easy, but leads
to questions hopefully Gustavo or someone else can authoritatively answer.
What characters should be allowed for the <snap id>, <key>, and <value>
values of the `defaults:` section?

In reviewing the problem I also noticed a small discrepancy for volume names.
The gadget.yaml spec says that volume names match [a-z-]+ (implying but not
specifying case preserving, case insensitivity) but the current implementation
also allows for digits.  I'd like to tighten this up to either reject digits
in the implementation (highly not preferred due to backward compatibility), or
expand the spec to allow digits in the volume names.  I'd also like to be
explicit in the spec about volume names being case preserving, case
insensitive.

I'm happy to update the spec and plan to align the implementation in the
upcoming 0.15 release of ubuntu-image.

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <https://lists.snapcraft.io/archives/devices/attachments/20170203/eef9eab5/attachment.pgp>


More information about the Devices mailing list