Closed thomasbeaudry closed 11 months ago
Your machine is always acceptable as a test bed, you can limit the playbook to test new things.
This file is generated on any graphical login, so you can push, logout/login and see what happens.
Success?
No.
if I modify the Xsession file directly it works though. I also added a debug message to the Xsession.d file and i see the it runs, so the ERRFILE path is getting set somewhere else downstream
I just read the Xsession file, and essentially the Xsession.d config files get read at the end of it. The default ERRFILE path is used before these config files are ever used, so for instance, it creates the .xsession-error file if it doesn't exist.
So the only way to know if the Xsession.d config file really works is to use the system and wait for an error to occur to see if it writes the error to the new path. If we keep this setup, we will have 2 .xsession-error files though.
My read of the file:
ERRFILE is defined, and then all files in Xsession.d are loaded. Your file should redefined ERRFILE successfully.
Then the ERRFILE is created.
As for testing, .xsession-errors is logging the stdout
and stderr
of the Xsession, which immediately at login has content.
Xsession.d is defined here:
and then used here at the end of the file:
Got it. I was reading the code for /etc/X11/Xsession.options.d
which is different.
The solution here is https://docs.ansible.com/ansible/latest/collections/ansible/builtin/lineinfile_module.html
Which has a REGEX feature for reliably finding/replacing a line. We can directly replace this line:
ERRFILE=$HOME/.xsession-errors
With the rewritten one.
Going to close this PR as it'll be a completely different implementation.
I don't know how to artificially test this! I've spent too long trying to figure out how. Maybe we just test it in action. This PR addresses #71