snapcraft truncates trailing 0's from version

Bug #1586162 reported by Jamie Strandboge
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Medium
Sergio Schvezov

Bug Description

$ snapcraft --version
2.8.8b0

$ cat ./snapcraft.yaml
name: foo
version: 0.20
summary: bar
description: baz
architectures: [all]

parts:
  foo:
    plugin: nil

$ snapcraft
...
Snapping foo_0.2_all.snap
...
Snapped foo_0.2_all.snap

In addition to truncating the version from the file name, it is also wrong in meta/snap.yaml:
$ unsquashfs ./foo_0.2_all.snap
...
$ cat ./squashfs-root/meta/snap.yaml
architectures:
- all
description: baz
name: foo
summary: bar
version: 0.2

description: updated
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

jdstrand well, according to yaml syntax that is a number, not a string. One of the mechanisms to tell it is a string is to use quotes ("). That said, we can ignore yaml parsing and try and force it to string.

I guess this is what we want.

Changed in snapcraft:
status: New → Triaged
Revision history for this message
Gustavo Niemeyer (niemeyer) wrote :

That looks pretty bad.

With Go yaml package you can force the field to be read out as a string. I'd expect Python to be able to do something similar.

The proper fix would be to reject numeric strings, though, so that the content is proper yaml. Otherwise somebody else will do the same thing later.

What it cannot do is to allow the value to go through while corrupted.

Changed in snapcraft:
milestone: none → 3.0
assignee: nobody → Sergio Schvezov (sergiusens)
importance: Undecided → Medium
status: Triaged → In Progress
tags: added: 18.10-build-vm
Changed in snapcraft:
status: In Progress → Fix Committed
Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.