Snapctl's args are difficult to determine

Back in the day we could run snapctl -h and learn how to use it. However, nowadays it looks like this:

$ snap --version
snap    2.27.5
snapd   2.27.5
series  16
ubuntu  16.04
kernel  4.4.0-93-generic
$ snapctl -h
error: error running snapctl: invalid snap cookie requested

Which requires one to dig into code. Can we get -h back, please?

3 Likes

@niemeyer can we get your input on this?

Yeah, feels reasonable and straightforward.

It’s probably a 5 mins patch by @pstolowski to respect -h before checking for the cookie.

Right. I can confirm a subtle change related to the introducion of ephemeral contexts caused this side-effect. Will fix. Thanks for reporting that @kyrofa!

PR: https://github.com/snapcore/snapd/pull/3907

Funnily enough, we had a spread test, but it was subtly broken (the PR fixes it).

Thank you, @pstolowski! I appreciate your time.

Fix is going in and will be available in 2.29. If you need it earlier, it should be in edge in a few days.

This now seems broken in a similar way:

$ snap --version
snap    2.32.9+17.10
snapd   2.32.9+17.10
series  16
ubuntu  17.10
kernel  4.13.0-37-generic
$ snapctl -h
error: cannot use "-h" with uid 1000, try with sudo

I expect to verify what -h means before I run it with sudo (in case it’s actually some kind of action), and in any case I shouldn’t need elevated privileges to see the help text.

@rbasak Thanks for the report.

@pstolowski Would you mind to check this out when you have a moment?

Sure, will check this.

The PR: https://github.com/snapcore/snapd/pull/5326