commit:     c492f93bccc3399c5fde86e969e168cff469a5ac
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 24 04:13:56 2026 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sun Mar  1 21:20:16 2026 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c492f93b

bin/ebuild-helpers/xattr/install: perform path magic for python only

The install-xattr C implementation really should not care about internal
Portage variables, and currently must work around the fact that we
change the working directory to a Portage-internal path.

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 bin/ebuild-helpers/xattr/install | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/ebuild-helpers/xattr/install b/bin/ebuild-helpers/xattr/install
index aeb6cbc840..cb3725fa3e 100755
--- a/bin/ebuild-helpers/xattr/install
+++ b/bin/ebuild-helpers/xattr/install
@@ -3,10 +3,6 @@
 # Distributed under the terms of the GNU General Public License v2
 
 INSTALL_XATTR=${EPREFIX}/usr/bin/install-xattr
-# Use safe cwd, avoiding unsafe import for bug #469338.
-export __PORTAGE_HELPER_CWD=${PWD}
-cd "${PORTAGE_PYM_PATH}"
-export __PORTAGE_HELPER_PATH=${BASH_SOURCE[0]}
 
 if [[ ${PORTAGE_INSTALL_XATTR_IMPLEMENTATION} == "c" ]]; then
        implementation="c"
@@ -36,6 +32,10 @@ PATH=${path#:}
 if [[ "${implementation}" == "c" ]]; then
        exec "${INSTALL_XATTR}" "$@"
 elif [[ "${implementation}" == "python" ]]; then
+       # Use safe cwd, avoiding unsafe import for bug #469338.
+       export __PORTAGE_HELPER_CWD=${PWD}
+       cd "${PORTAGE_PYM_PATH}"
+       export __PORTAGE_HELPER_PATH=${BASH_SOURCE[0]}
        PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
                exec "${PORTAGE_PYTHON:-/usr/bin/python}" 
"${PORTAGE_BIN_PATH:?}/install.py" "$@"
 else

Reply via email to