On 25/11/2023 00:15, Greg Wooledge wrote:
On Fri, Nov 24, 2023 at 11:51:53PM +0700, Max Nikulin wrote:

On the other hand I can not say that I understand what happens with PATH.
Likely modifications made through environment.d are overwritten by
/etc/profile. The latter is called by /etc/sddm/Xsession (or
wayland-session).
/etc/profile is only read by login shells of the Bourne family, unless
something goes out of its way to read that file explicitly.  Does KDE
spawn login shells instead of regular ones?

I see no evidences that launching konsole or xterm using menu or krunner causes starting bash as a login shell. I added a "logger" call to ~/.bash_profile and log entries appear during login only.

SDDM does read /etc/profile and ~/.profile when starting a user session:
https://sources.debian.org/src/sddm/0.20.0-1/data/scripts/Xsession/
(wayland-session is a sibling file). I do not like that a part of code is similar, but not identical to /etc/X11/Xsession from x11-common. Ideally there should be no code duplication.

I expect that GDM contains similar code reading /etc/profile and ~/.profile. LightDM Ubuntu package (but not Debian one) has it.

I suspect that startplasma does a bit more and transfers environment variables to systemd user session. The reason is the following.

plasma X11:

echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/added-by-etc-profile-d
systemctl --user show-environment | grep '^PATH'
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/added-by-etc-profile-d

fluxbox

echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/added-by-etc-profile-d
systemctl --user show-environment | grep '^PATH'
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/added-by-user-config-environment-d

Notice that a component from ~/.config/evironment.d appears only in systemd and only in the case of fluxbox.

Reply via email to