Closed cerebralnomad closed 4 years ago
Hi @cerebralnomad , due to confinement snap packages can not read .dotfiles/folders in your home directory. Can you please try the approach suggested in #6 (see my last comment)?
I installed the snap from the edge channel but the problem persists. Cheat runs fine if the current working directory is ~/bin, ~/Documents, or ~/any_folder, but if the command is called from ~/ then I get the error
failed to list cheatsheets: failed to load cheatsheets: error walking path: open /home/nomad/.cheat: permission denied
I switched to the Bash shell just to see and it is the same there. I did install cheat from the standard repo, https://github.com/cheat/cheat/releases and it works when called from the ~/ directory. I'm going to install it on a different machine to make sure it's not just something with this particular setup.
Ok, it works fine on another machine running Ubuntu MATE 18.04. Calling cheat from the ~/ directory works as expected. It's something with my setup on this Kubuntu laptop apparently. I'll look into it further.
Evidentially it is something peculiar about that specific system. I have a spare testing laptop which I wiped and installed Kubuntu fresh. I installed the cheat snap and it worked just fine from the ~/ directory.
I'm not sure yet what the problem is with this installation, but it isn't reproducible as far as I can tell so it's a problem with this particular system, not the snap.
I installed the snap from the edge channel but the problem persists. Cheat runs fine if the current working directory is ~/bin, ~/Documents, or ~/any_folder, but if the command is called from ~/ then I get the error
failed to list cheatsheets: failed to load cheatsheets: error walking path: open /home/nomad/.cheat: permission denied
I switched to the Bash shell just to see and it is the same there. I did install cheat from the standard repo, https://github.com/cheat/cheat/releases and it works when called from the ~/ directory. I'm going to install it on a different machine to make sure it's not just something with this particular setup.
You could go into your home dir and try to find the place where this config is set by running this command: find . -name "conf.yml" -exec grep --color -H '\.cheat' {} \;
What does the command show?
Basically it should be a conf.yml within this folder ~/snap/cheat/current/conf.yml
if not you should move it into the snap folder.
Please keep in mind: a snap can not access ~/.cheat
in your home directory because of security confinement. You could instead do such a thing ~/cheat
(for now only for the cheat version in the edge channel), or move your .cheat
folder into ~/snap/cheat/current/.cheat
.
For me the folders for cheatsheets look like this:
$ cheat -d
community: /snap/cheat/1589/usr/share/cheat/cheatsheets/community
personal: /home/bernermic/snap/cheat/1589/.cheat
I hope this helps.
I figured out the problem. Apparently that ~/.cheat folder was indeed an old directory and was causing the problem. If I ran cheat -d from the ~/bin directory I got this output:
[ Sun 23 @ 0:24 ] [ ~/bin: ] ---> cheat -d
community: /home/nomad/snap/cheat/1589/cheat/cheatsheets/community
personal: /home/nomad/snap/cheat/1589/cheat/cheatsheets/personal
If I ran it from the home directory I got this:
[ Sun 23 @ 0:25 ] [ ~: ] ---> cheat -d
community: /home/nomad/snap/cheat/1589/cheat/cheatsheets/community
personal: /home/nomad/snap/cheat/1589/cheat/cheatsheets/personal
cwd: /home/nomad/.cheat
The ~/.cheat folder was empty so I removed it, and the cheat -d returned the two correct entries when run from the home folder.
[ Sun 23 @ 0:25 ] [ ~: ] ---> cheat -d
community: /home/nomad/snap/cheat/1589/cheat/cheatsheets/community
personal: /home/nomad/snap/cheat/1589/cheat/cheatsheets/personal
I then searched my terminal history and found I had been playing with cheat a very long time ago. This must have been when the .cheat folder was created. I'm not sure why the existence of the .cheat folder bothered the snap when running from the home directory, but deleting it solved the problem, now the snap runs perfectly no matter where I call it from. I appreciate your time addressing this, sorry the problem was entirely on my end, and you needn't have been bothered with it.
@cerebralnomad - all fine. As long as time allows I am allways glad when I can help :)
Thanks for your feedback and I will close this then as resolved.
Hi, guys
I can probably shed some light on this.
I did a poor job of documenting/announcing this (where is the best place for announcements? Twitter?), but as of a few minor
versions ago, $PWD/.cheat
is always on the cheatpath. This is useful because it allows you to physically store cheatsheets near to projects. (At my dayjob for example, we develop several applications. I have my cheatsheets configured such that I can always run cheat app
and see cheatsheets that are relevant to the app that I'm currently working on.)
In any case, yeah - if you tried to run cheat
from your home directory, and had a prior .cheat
directory there, unintended behavior could be expected. I encountered this problem myself a few days ago, and hadn't considered the possibility previously. I'm not sure if there is anything that I should do about that. Hmm...
Anyway, sorry for the confusion!
I'm using the ZSH shell on Kubuntu 18.04. After installing the cheat snap I run
cheat.cheatsheet-setup
and it just returns to the terminal prompt. I expected some sort of setup procedure, but that may be done without input.Running the cheat command at this point if in the ~/ directory returns the error
failed to list cheatsheets: failed to load cheatsheets: error walking path: open /home/nomad/.cheat: permission denied
However if I make, apparently, any other folder on the system the working directory, cheat works fine. I've ran it from several directories inside the ~/ directory and in the / directory.
The folder ~/.cheat exists and is owned by me, but is empty. The only odd thing I see about the .cheat folder is the date. It was created today, but it shows it was created a year ago.
drwxrwxr-x 2 nomad nomad 4.0K Feb 21 2019 .cheat