light
light copied to clipboard
Command fails if the user that runs it has no home dir when compilled with `--with-udev`
Issue
Even if there is no .config arguments being used, (eg: -O or -I), the .config dir is unconditionally created, and the program unconditionally errors out if that creation fails.
This means that daemon accounts with $HOME set to something like /dev/null will never be able to run any command, even if they have the correct permissions (ie: in the video group) and are not using any save/restore features.
Potential Fix
I've created a very simple patch for the issue that I use to allow my login manager greetd to adjust the brightness, all it does is remove the return after warning that it couldn't create the .config folder. Save/restore commands (light -O and light -I) still error out, however that is to be expected as they have nowhere to save to and restore from.
A more substantial fix would be to only create the configuration directory if it is needed, instead of unconditionally.
--- a/src/light.c
+++ b/src/light.c
@@ -472,7 +472,6 @@ light_context_t* light_initialize(int argc, char **argv)
if(rc && errno != EEXIST)
{
LIGHT_WARN("couldn't create configuration directory");
- return false;
}
// Create the built-in enumerators
Meta
System Info (uname -a):
Linux laptop 5.15.10-gentoo #2 SMP Sun Dec 19 10:43:13 AEDT 2021 x86_64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz GenuineIntel GNU/Linux
Program Info (light -V):
v1.2
How it was installed
# emerge -av dev-libs/light
I had the exact same issue with gtkgreet and your patch fixed it for me! This is awesome!