From db5650ec49b9d0358add837a62cdac9f2a0cf88f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 21 Oct 2010 18:32:08 -0700 Subject: [PATCH] lock-helper.py: use PORTAGE_PYM_PATH for safety --- bin/lock-helper.py | 2 ++ pym/_emerge/AsynchronousLock.py | 2 +- pym/portage/__init__.py | 1 + pym/portage/dbapi/vartree.py | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/lock-helper.py b/bin/lock-helper.py index 5c332b2af..469d3a9da 100755 --- a/bin/lock-helper.py +++ b/bin/lock-helper.py @@ -2,7 +2,9 @@ # Copyright 2010 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 +import os import sys +sys.path.insert(0, os.environ['PORTAGE_PYM_PATH']) import portage def main(args): diff --git a/pym/_emerge/AsynchronousLock.py b/pym/_emerge/AsynchronousLock.py index bce81ed5c..d72add4f1 100644 --- a/pym/_emerge/AsynchronousLock.py +++ b/pym/_emerge/AsynchronousLock.py @@ -171,7 +171,7 @@ class _LockProcess(AbstractPollTask): self._proc = SpawnProcess( args=[portage._python_interpreter, os.path.join(portage._bin_path, 'lock-helper.py'), self.path], - env=os.environ, + env=dict(os.environ, PORTAGE_PYM_PATH=portage._pym_path), fd_pipes={0:out_pr, 1:in_pw, 2:sys.stderr.fileno()}, scheduler=self.scheduler) self._proc.addExitListener(self._proc_exit) diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index d302b5242..33ac561d3 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -328,6 +328,7 @@ except (ImportError, OSError) as e: _python_interpreter = os.path.realpath(sys.executable) _bin_path = PORTAGE_BIN_PATH +_pym_path = PORTAGE_PYM_PATH def _ensure_default_encoding(): diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index d14d06b7a..89fdca092 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -3828,6 +3828,7 @@ class dblink(object): shutil.copytree(var_orig, var_new, symlinks=True) os.chmod(var_new, dir_perms) portage._bin_path = settings['PORTAGE_BIN_PATH'] + portage._pym_path = settings['PORTAGE_PYM_PATH'] os.chmod(base_path_tmp, dir_perms) # This serves so pre-load the modules. _preload_elog_modules(self.settings) -- 2.26.2