rossmacarthur/sheldon

Setting sheldon config file is not enough

rossmacarthur opened this issue ยท 3 comments

Discussed in #155

Originally posted by seqizz October 28, 2022
Hi there ๐Ÿ‘‹

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.

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.

@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 directory must exist already.
  • The directory must be writable by the user, I figured the directory where the config file lives would usually be writable.

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

#159