Today I tried switching from LightDM to SDDM and immediately found a problem:
Currently I set all of my login environment variables using the .pam_environment file in my home directory.
While this works mostly there is one notable environment that does not work when doing this while using SDDM: PATH
Environment variables from ~/.pam_environment are set by the pam_env.so PAM module during the session phase and both SDDM and LightDM have this set up correctly (since their respective /etc/pam.d/* files both import the common-password file which in turn always defines -session pam_env.so user_readenv=1 as its last command).
After PAM initialization is complete however SDDM then does something that LightDM does not do: It starts the X session using the /etc/sddm/Xsession wrapper script which then sources the global /etc/profile as well as some local profile files before handing over control to /etc/X11/Xsession. While this (by itself) is awesome (and LightDM sucks for not doing it…) it also breaks the PATH environment variable set by pam_env.so as /etc/profile hard-codes PATH="/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games" in its 4th line. This is IMHO not OK and pretty confusing (at least if you are coming a LightDM background like I am).
Is there any good reason why /etc/profile must hard-code a PATH?
Maybe /etc/profile could just (mandatorily) append essential PATH elements instead?