Issues with SystemdProcessRunner and environment variables
Given https://invent.kde.org/plasma/plasma-workspace/-/blob/v6.1.0/startkde/startplasma.cpp?ref_type=tags#L358 , !1622 (merged) effectively changed the default runner to SystemdProcessRunner
on KDE Plasma.
However, SystemdProcessRunner
currently has issues with environment variables:
- If neither
KProcessRunner::modifyEnv
norKProcess::setEnv
is called when initializing theKProcessRunner
, our environment variables are not propagated to the new process as the new process is spawned bysystemd --user
, which breaks e.g. inheritingXDG_ACTIVATION_TOKEN
when the kio client does not have an active window. - If at least one of those are called, our environment variables are propagated as these two functions initializes
m_process->processEnvironment()
toQProcessEnvironment::systemEnvironment()
andSystemdProcessRunner
pass it to systemd. However, this fails when our environment variables include variables that can not be passed in this way to systemd, e.g. when the name of one of the environment variables contains.
. This can be demonstrated by e.g. runningenv "xxx.yyy=zzz" dolphin
and trying to open a file or runningenv "xxx.yyy=zzz" kioclient exec file:/usr/share/applications/net.minetest.minetest.desktop
when minetest is installed. Note that e.g. Pulseaudio usesPULSE_PROP_application.name
as an environment variable name.
Given those, here are my questions:
- Do we revert 24977bfc as
SystemdProcessRunner
was not actually the default on Plasma and does not seem to be ready for prime time yet? - Do we want
SystemdProcessRunner
to propagate environment variables from parent? If we do, how do we filter out environment variables that systemd does not like? If we don't, should we special caseXDG_ACTIVATION_TOKEN
like theDBusActivationRunner
did?