commit:     21739ea1e0a793e207b7ae28d524e45582d9b2ca
Author:     Florian Schmaus <flo <AT> geekplace <DOT> eu>
AuthorDate: Tue Apr 27 11:02:56 2021 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon May 24 06:13:07 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=21739ea1

env-update: skip PATH in systemd user environment definition

Having PATH in the systemd user environment created by env-update
makes it impossible to use "systemctl --user import-environment PATH"
to set PATH in systemd user units according to the current value of
PATH. Using "systemctl --user import-environment PATH" is a well known
idiom, and hence should work. Therefore, we skip the creation of the
PATH entry by env-update.

Closes: https://github.com/gentoo/portage/pull/701
Signed-off-by: Florian Schmaus <flo <AT> geekplace.eu>
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>

 lib/portage/util/env_update.py | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/portage/util/env_update.py b/lib/portage/util/env_update.py
index 5588931a8..abf261fbc 100644
--- a/lib/portage/util/env_update.py
+++ b/lib/portage/util/env_update.py
@@ -367,6 +367,11 @@ def _env_update(makelinks, target_root, prev_mtimes, 
contents, env,
                systemd_gentoo_env.write(senvnotice)
 
                for env_key in env_keys:
+                       # Skip PATH since this makes it impossible to use
+                       # "systemctl --user import-environment PATH".
+                       if env_key == 'PATH':
+                               continue
+
                        env_key_value = env[env_key]
 
                        # Skip variables with the empty string

Reply via email to