[Development] [QLockFile] Whether it is reasonable to use 0644 permission ?

Denis Shienkov denis.shienkov at gmail.com
Wed Jul 27 08:49:14 CEST 2016

Hi all.

As I can see, the QLockFile opens a lock-file with the 0644 permissions 
in Linux, e.g. see QLockFile::LockError QLockFilePrivate::tryLock_sys() [1].

That means that only one user (owner) can modify this file. But it leads 
to problems, for example, when this use-case:

1. User 'A' creates the lock-file for the some resource

2. The application crashed, and this lock-file stays undeleted/unchanged

3. User 'B' tries to use same free resource, but it is failed due to 
QLockFile can not write appropriate pid to the lock-file, since user 'B' 
has not access to modify this lock-file.

This happens, e.g. when user 'A' is root and so on.

Currently this problem belongs to QSerialPort which internally uses 
QLockFile to indication of employment of the /dev/ttyXYZ resources.
When it is impossible to open serial port when its lock-file has been 
created from other user. There are only one workaround - it is remove
this lock-file manually.

Why just do not use 0666 permissions for this?



More information about the Development mailing list