snap package prints erroneous token config instructions
I haven't used exercism for a while, but upon deciding to revisit after a hiatus, I was pleased to find there is now a snap package available. Following the instructions at
https://exercism.io/cli-walkthrough
> sudo snap install exercism
and then, admittedly, not completely following all the instructions, I jumped to trying to install an exercise, and got the following error message
> exercism download --exercise=hello-world --track=typescript
Error:
Welcome to Exercism!
To get started, you need to configure the tool with your API token.
Find your token at
https://exercism.io/my/settings
Then run the configure command:
/snap/exercism/5/exercism configure --token=YOUR_TOKEN
In copying the instructions and replacing with my token
/snap/exercism/5/exercism configure --token=<my_token>
and getting a positive confirmation message that it had worked correctly, I tried re-downloading the exercise
> exercism download --exercise=hello-world --track=typescript
only to receive the same error message. After a minor amount of debugging to determine the path of the actual exercism binary
> which exercism
/snap/bin/exercism
and using the updated path when running configure
/snap/bin/exercism configure --token=<my_token>
it worked. Ultimately, I stumbled upon the correct instruction on the third page of
https://exercism.io/cli-walkthrough
exercism configure --token=<my_token>
But it seems like the command
> exercism download --exercise=<exercise-name> --track=<language>
should output this instead of the /snap/exercism/5/exercism path.
I realize I probably should have RTFM and I don't know enough about snaps to know how hard it is to fix, but seems like a reasonable fix given it's a beginner tool and the much appreciated effort for creating the snap.
I'm not familiar with go but it sounds like that's coming straight from the program's first argument:
https://github.com/exercism/cli/blob/f2323bb2a63be5d79250932a7577baf8efef9302/cmd/root.go#L45
It's later used to format this string:
https://github.com/exercism/cli/blob/374a5704e2dfe09b2cd5ae5a19c5e9c2a316617d/cmd/cmd.go#L28-L39
So this might not be an easy fix, if it's tied to how snap calls the executable.
@NobbZ Probably related to many of the snap related installation support questions we get on Gitter.
Yes. This is exactly the same issue.
And as I personally refuse to use snap (and it is also not available for my OS) I can't get into it, but I think that these problems are caused by snaps sandboxing model and inidirections.
I think we need to reconsider the complete process of discovering and reading the configuration to make it suitable to snap.
It seems as if we see more and more users struck by this problem in the gitter.
While it have been one or two in a month at the beginning, we now see them multiple times a week.
We really need to find why this is an issue and fix it, or deprecated the snap build.
My assumption is, that something in the snap wrapper touches the environment and changes XDG_* variables, but does so in a non-reliable way.
Or if it happens reliable, then the exercism binary does not consistently use those variables to resolve location of the config file.