-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Clight version the issue has been seen with:
4.11-6a5ad96
Used distribution:
Own distribution built with Yocto
Describe the bug
When clight is started it tries to open its log file. In case neither XDG_RUNTIME_DIR nor XDG_DATA_HOME are set the log file resides in <home>/.local/share/clight/, where <home> is the home directory of the current user. Clight tries to create the log folder if it doesn't exist. But the call to mkdir will only succeed if the directory <home>/.local/share/ already exists. If not, the call to mkdir will fail. Since its return value isn't checked, clight continues to open the log file. The call to open will return -1 which is then used as file descriptor argument for flock. The call to flock will also fail and clight will exit.
I think clight shouldn't assume that <home>/.local/share/ already exists.
Expected behavior
Clight should create intermediate directories if necessary.
To Reproduce
- Ensure that neither
XDG_RUNTIME_DIRnorXDG_DATA_HOMEare set in the environment ofclight. - Ensure that the folder
<home>/.local/doesn't exist, where<home>is the home directory of the current user - Start clight
Please attach a Clight verbose log too!
root@tutn-bpfb5m3:~# /usr/bin/clight --verbose
Bad file descriptor
A lock is present on /root/.local/share/clight/clight.log. Another clight instance running?
root@tutn-bpfb5m3:~# ls -la /root/
total 24
drwx------. 1 root root 4096 Nov 21 07:54 .
drwxr-xr-x. 1 root root 4096 Nov 21 07:54 ..
-rw-------. 1 root root 147 Nov 21 07:55 .ash_history
drwx------. 2 root root 4096 Nov 21 07:54 .ssh