-
-
Notifications
You must be signed in to change notification settings - Fork 49
Description
On a recently-installed Arch Linux laptop, I ran into an issue where GlobalMutex.LinuxGlobalMutexAdapter threw "SIL.PlatformUtilities.NativeException: An error with the number, 13, ocurred." Error 13 in Linux is EPERM, permission denied.
On investigating, I found that LinuxGlobalMutexAdapter was trying to open a global mutex file in /var/lock. On recent systemd systems, /var/lock is a symlink to /run/lock and /run/lock is considered deprecated, and is expected to go away in systemd release 258 (current systemd release is 256). This comment from Lennart Poettering explains why:
"It [that is, /run/lock] is inherently legacy, and I can only advise your software to place the lock it needs in a more appropriate place, for example /run/$yoursoftware/ somewhere. These directories are typically generated via tmpfiles or RuntimeDirectory= and have the benefit that they are not a shared namespace, but a private one, and thus not prone to the security issues.
Sorry, but /run/lock/ really should die, there's zero benefit of using that dir over a proper, private runtime directory, like everyone else does.
We should update LinuxGlobalMutexAdapter to handle a "permission denied" error in /var/lock and try another path, /run/palaso/lock (creating /run/palaso/lock if it doesn't exist, and assuming that /run/palaso has already been created with appropriate permissions by the appropriate Linux package, e.g. the fieldworks .deb package should include a /usr/lib/tmpfiles.d/palaso-lock.conf file with the contents "d /run/palaso/lock 1777 root root -" so that systemd will automatically create /run/palaso/lock as a sticky-bit directory on bootup). That way we will future-proof any code that uses GlobalMutex on Linux systems, allowing it to continue to work after systemd 258 removes /var/lock support.
(Note: that last line comes from the comment in Arch Linux's conf file setting up /run/lock, which reads as follows:)
# This used to be created by systemd, but is considered part of legacy
# SystemV support, and that in turn will be removed with systemd v258
# ultimately. It is still used by differnt packages, so let's move it
# here... As /run is a tmpfs it has to be created by tmpfiles.
d /run/lock 0755 root root -