snapcraft should warn of invalid name

Bug #1636016 reported by Olivier Tilloy
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
snapcraft (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

This looks similar to bug #1589613, but I’m not sure whether I should just re-open it, so here’s a new one.
Snapcraft allows building snaps with invalid names, which are then installed but cannot be run because snap-confine complains of an invalid security tag:

$ snapcraft
"grade" property not specified: defaulting to "stable"
Preparing to pull 1foo
Pulling 1foo
Preparing to build 1foo
Building 1foo
Staging 1foo
Priming 1foo
Snapping '1foo' |
Snapped 1foo_1.0_amd64.snap
$ sudo snap install --dangerous 1foo_1.0_amd64.snap
1foo 1.0 installed
$ 1foo
security tag snap.1foo.1foo not allowed

This happens if the name of the snap starts with a number (e.g. "1foo"). The documentation for verify_security_tag(…) in snap-confine specifies that <name> must start with lowercase letter, then may contain lowercase alphanumerics and '-'.

Snapcraft should bail out early instead of generating a snap with an invalid name.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Here is a test snapcraft.yaml file for the use case:

$ cat snapcraft.yaml
name: 1foo
version: 1.0
summary: snap with invalid name
description: a snap package with an invalid name
confinement: strict
apps:
  1foo:
    command: bin/1foo
parts:
  1foo:
    plugin: dump
    source: .
    organize:
      1foo: bin/

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in snapcraft (Ubuntu):
status: New → Confirmed
Revision history for this message
Carroarmato0 (carroarmato0) wrote :

Oh, apparently a bug since last year. I'm getting the same.

I'm trying to snap a commandline tool written in Go called 12to8...

I don't think you can really expect upstream projects to all start changing their names.

[carroarmato0:~/Applications … opment/Snaps/12to8] $ 12to8
security tag snap.12to8.12to8 not allowed

Revision history for this message
John Lenton (chipaca) wrote :

For what it's worth, "12to8" is a valid snap name, and a valid app name. There was a bug in snapd (getting fixed right now).

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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