lanoxx / tilda

A Gtk based drop down terminal for Linux and Unix
GNU General Public License v2.0
1.25k stars 165 forks source link

Lock file created with 000 permissions -- why? #480

Open jimduchek opened 2 years ago

jimduchek commented 2 years ago

The lock file is opened with the following code:

ret = open(lock_file_full, O_WRONLY | O_CREAT | O_EXCL, 0);

Is there a reason the file is created with 0 permissions? It seems that this was a deliberate choice, but I can't figure out why.

The reason this comes up is having a file with no permissions at all causes an error with rsync, as it cannot read the contents of the file (I'm not sure why it bothers trying to read a 0-length file, but it does). Yes, I could exclude .cache/tilda, I suppose. But I don't see anything else making PID files 0-permissions, so not sure why Tilda does. Would suggest changing to S_IRUSR if this is merely an oversight.

lanoxx commented 7 months ago

It seems this was added in commit 0a66b99dcff82cf90d7cb7dc526676cbadfc52f3 around 2014 and I cannot remember why I have used 0 as the access permission. It might have been by accident. Technically, the lock files have no content, we only use them to track the pids of running tilda processes, so maybe we choose a mode of 0 to avoid accidentally writing into it. No idea, if is causing issues with rsync I guess we should give at least read access mode to the file.