Verify on jammy: PASS
=====================

lxd 5.0.10-24fe763 (5.0/stable) is not core26, so invalid JSON field
names are kept and snapd warns.

snap version --verbose
snap            2.77.1+ubuntu22.04.1
snapd           2.77.1+ubuntu22.04.1
series          16
ubuntu          22.04
kernel          5.15.0-198-generic
architecture    amd64
snapd-bin-from  native-package
snap-bin-from   native-package

1. Dotted invalid names are rejected:

sudo snap set lxd x.Y=z
error: cannot perform the following tasks:
- Run configure hook of "lxd" snap (invalid option name: "Y")

2. Nested and list cases warn on 2.77.1+ubuntu22.04.1 from jammy-
proposed:

sudo snap set lxd -t 'fresh={"Q": 1}'
WARNING: There is 1 new warning. See 'snap warnings'.

sudo snap set lxd -t 'nest={"good":{"Nope":1}}'
WARNING: There are 2 new warnings. See 'snap warnings'.

sudo snap set lxd -t 'items=[{"Zz":1}]'
WARNING: There are 3 new warnings. See 'snap warnings'.

snap warnings
warning: |
  Option value has invalid field name "Q". For core26+ snaps, fields must be
  dash separated lowercase alphanumerics.
---
warning: |
  Option value has invalid field name "Nope". For core26+ snaps, fields must be
  dash separated lowercase alphanumerics.
---
warning: |
  Option value has invalid field name "Zz". For core26+ snaps, fields must be
  dash separated lowercase alphanumerics.

3. Valid JSON keys still work:

sudo snap set lxd -t 'fresh={"q": 1}'
sudo snap get lxd fresh.q
1

sudo snap set lxd plain=ok
sudo snap get lxd plain
ok

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2072331

Title:
  dash-case-subset config on snap set not being validated when passing
  JSON

To manage notifications about this bug go to:
https://bugs.launchpad.net/snapd/+bug/2072331/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to