tolga9009 / sidewinderd

Linux support for Microsoft SideWinder X4 / X6 and Logitech G103 / G105 / G710+.

Home Page:http://cevel.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Process::createWorkdir failed with a new user account

phiwui opened this issue · comments

In case of a new user account, the path .local/share doesn't exists yet in the home directory.
So, when the function Process::createWorkdir try to create the working dir (line 162 of process.cpp) it fails because mkdir doesn't create intermediate dirs.

This problem also occurs when the path specifyed in parameter workdir in sidewinderd.conf doesn't contain the path .local/share.

The use of .local/share is compliant with XDG Base Directory Specification and doesn't contradict FHS. In case of an error (e.g. .local/share doesn't exist for a new user), sidewinderd outputs an error message:

std::cerr << "Error accessing " << workdir << "." << std::endl;

The intended design for sidewinderd is to run as a desktop user and not as a dedicated daemon user. In a normal desktop environment, .local/share is usually available. In the rare event, where your local user doesn't have .local/share, I think the error message is enough to further investigate and fix the issue.

That beeing said, workdir parameter in /etc/sidewinderd.conf indeed doesn't work as intended. If specified, it should overwrite anything sidewinderd tries to do in Process::createWorkdir(). E.g. when you specify workdir = "/var/lib/sidewinderd", sidewinderd should use it as the profile directory and don't create any further subdirectories. That's definitely a bug.

Commit 2cb95cb fixes this issue. However, creation and setting correct permissions of .local/share or the folder specified in the configuration file are outside the scope of sidewinderd and the user's job. The error messages currently in place are enough to point the user in the correct direction.

Furthermore, I have set /var/lib/sidewinderd as the default value of workdir in /etc/sidewinderd.conf, as I think it's a very good suggestion.

Thank you very much!