unhelpful error message when snap is installed already

Bug #1782110 reported by Marian Gasparovic
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd (Ubuntu)
Confirmed
Medium
John Lenton

Bug Description

I tried to install atom with snap install atom --classic and I received "error: store.SnapNotFound with 2 snaps"
Turns out, this snap was already installed.
Returned error message is not helpful at all.

snapd 2.32.9+18.04
Ubuntu 18.04

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

There's something very strange going on.

This is what I get:

$ snap install atom --classic
atom 1.28.2 from 'snapcrafters' installed
$ snap install atom --classic
snap "atom" is already installed, see 'snap help refresh'
$

the 'already installed' error is returned before even looking at the store; there's just no way to get to that error just like this.

Can you reproduce this? How?

If not, could you get us the output of 'snap tasks' for the change in question? (look at 'snap changes' to figure out which one it is).

Revision history for this message
Marian Gasparovic (marosg) wrote :

Here is the list of all snap install commands, it was 58/60 which failed with that error

   41 sudo snap install slack
   42 sudo snap install slack --classic
   43 sudo snap install irccloud-desktop
   44 sudo snap install atom
   45 sudo snap install atom --classic
   56 sudo snap install firefox
   57 sudo snap install chromium
   58 sudo snap install atom –classic
   60 sudo snap install atom –-classic
   61 sudo snap install vlc

Whoa, found it... in 60, those -- characters are not the same, first '-' is not '-', it was copy/paste and that is some strange character

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

Yep! reproduced it:

$ snap install atom –classic
error: store.SnapNotFound with 2 snaps

that _is_ a terrible error.

Changed in snapd (Ubuntu):
status: New → Confirmed
assignee: nobody → John Lenton (chipaca)
importance: Undecided → Medium
Revision history for this message
John Lenton (chipaca) wrote :

I've added code to check for typographical dashes and warn the user:
https://github.com/snapcore/snapd/pull/5524

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

For reference:

$ snap install ––help
Your command included some characters that look like dashes but are not:
    "snap install \u2013\u2013help"
in some situations you might find that when copying from an online source such
as a blog you need to replace “typographic” dashes and quotes with their ASCII
equivalent. Dashes in particular are homoglyphs on most terminals and in most
fixed-width fonts, so it can be hard to tell.

error: snap "––help" not found
$

Revision history for this message
Seth Arnold (seth-arnold) wrote : Re: [Bug 1782110] Re: unhelpful error message when snap is installed already

On Tue, Jul 17, 2018 at 02:39:22PM -0000, John Lenton wrote:
> $ snap install ––help
> Your command included some characters that look like dashes but are not:
> "snap install \u2013\u2013help"

What happens if en or em dashes are used as part of a snap name? Are they
allowed characters or forbidden? Could there be commands that "look" safe
but in reality operate on pacakges with funny names?

Thanks

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

Em dashes cannot be part of a snap name.
They _could_ be part of an intentional 'snap set' command, something like
   snap set mysnap foo=—o—
in which case, if the "snap set" fails, the user will get the above message, followed by whatever error. Like so:

$ snap set bofh foo=—o—
Your command included some characters that look like dashes but are not:
    "snap set bofh foo=\u2014o\u2014"
in some situations you might find that when copying from an online source such
as a blog you need to replace “typographic” dashes and quotes with their ASCII
equivalent. Dashes in particular are homoglyphs on most terminals and in most
fixed-width fonts, so it can be hard to tell.

error: cannot perform the following tasks:
- Run configure hook of "bofh" snap (snap "bofh" has no "configure" hook)

I think this is reasonable unless we want to actually parse the em dashes, which seems like a lot more work for this corner case.

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.