As of version v[TBD], snapd will validate version strings in snaps.
For historically reasons snapd has been very lax about validation of the version string of snaps. However, the time seems right to make it consistent with what snapcraft and the review tools check. In doing this work we found that those two had diverging opinions on what constituted a valid version, so we’ve fixed this as well.
Here’s what’s a valid version, now (via the awesome regexper):
The Snapcraft PR: https://github.com/snapcore/snapcraft/pull/1924. Note that we don’t validate the length with regex-- we use a different schema option so we can provide a more helpful error if the version is longer than 32 characters.
Snapcraft PR has also landed, and should be available shortly in 2.39.1. Probably good for snapcraft to start rejecting these before snapd or the store.
@chipaca@kyrofa Do we have versions using underline already? Given that it’s conventionally used to separate the fields in filenames, might be nice to avoid that one if there’s still time. If it’s too late, no big deal.
@chipaca Btw, wasn’t aware of regexper… very nice.
Support for the underscore has already landed in both snapd and snapcraft (it’s contained in the snapcraft release we’re shipping now). We can remove it, but we’ll need to synchronize again. @jdstrand, @chipaca? Sooner probably better than later if you guys agree with this.