rossmacarthur / sheldon

:bowtie: Fast, configurable, shell plugin manager
https://sheldon.cli.rs
Apache License 2.0
958 stars 21 forks source link

Setting sheldon config file is not enough #156

Closed rossmacarthur closed 1 year ago

rossmacarthur commented 1 year ago

Discussed in https://github.com/rossmacarthur/sheldon/discussions/155

Originally posted by **seqizz** October 28, 2022 Hi there :wave: I've upgraded to 0.7.0, and apart from a small change I needed to do in config.toml, sheldon failed to start because of non-existent config dir: ``` error: failed to acquire lock on config directory due to: failed to open `/home/gurkan/.config/sheldon` due to: No such file or directory (os error 2) ``` Just wanted to ask if this is intended, or it's because my setup is manual? Initially it didn't make sense to need a config dir while `SHELDON_CONFIG_FILE` already given, but for locking need I created the mentioned folder and it works ok now. This looks like it could benefit a new parameter like "SHELDON_LOCK_FILE" which is mutually exclusive with config dir, for clarity.
rossmacarthur commented 1 year ago

Fixed in a632fc59ead474c07d21dd8980e7c97364350ebb

seqizz commented 1 year ago

I'm not sure if I understand the solution correctly. My global config is on /etc/sheldon.toml which made user shell lock up with the following message:

Blocking waiting for file lock on /etc

I suppose it's because my user doesn't have write rights to /etc.

rossmacarthur commented 1 year ago

@seqizz Interesting, the purpose of the file mutex (it uses flock(2)) is so that two instances of sheldon do not run at the same time. E.g. you open two terminals at the same time.

There are two constraints here

The fix was made because the directory didn't exist so I changed it to use a directory that definitely would exist. I don't think its critical that the file mutex be acquired, I think we can make sheldon handle the permission case more gracefully. I've opened an issue for this

https://github.com/rossmacarthur/sheldon/issues/159