snap install with duplicated snap names gives confusing errors

Bug #1843725 reported by Paweł Stołowski
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Confirmed
Medium
Unassigned

Bug Description

If same snap name is passed to snap install by mistake, it gives confusing errors, e.g.

$ sudo snap install hello-world hello-world
error: cannot perform the following tasks:
- Download snap "hello-world" (29) from channel "stable" (rename /var/lib/snapd/snaps/hello-world_29.snap.partial /var/lib/snapd/snaps/hello-world_29.snap: no such file or directory)

It actually succeeds with the installation and just errors out on the 2nd snap.

Now, while having hello-world installed, doing it again with two same snap names produces:

$ sudo snap install hello-world hello-world hello-world
error: cannot install "hello-world", "hello-world", "hello-world": no install/refresh information
       results from the store

while it behaves ok with just one name:
$ sudo snap install hello-world
snap "hello-world" is already installed, see 'snap help refresh'

Changed in snapd:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Paweł Stołowski (stolowski) wrote :

In the same vain, 'snap remove hello-world hello-world' removes the snap but gives funny error because of the duplication:

$ sudo snap remove hello-world hello-world
error: cannot perform the following tasks:
- Stop snap "hello-world" services (snap has no current revision)
- Remove security profile for snap "hello-world" (29) (cannot find installed snap "hello-world" at revision 29: missing file /snap/hello-world/29/meta/snap.yaml)
- Remove data for snap "hello-world" (29) (snap "hello-world" is not installed)

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

I think the right approach is:

* in snapstate (or in daemon, might be more straightforward there as it's before it's split into ops), all multi-ops should check for duplication and bail the whole thing early

* in cmd/snap, check for duplication and error nicely

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.