summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>2019-09-08 08:48:14 +0200
committerSergei Trofimovich <slyfox@gentoo.org>2019-09-08 09:29:31 +0100
commit1e2e76a2b23caef964de881b14146c58b0a0ee77 (patch)
tree864dcbd086e4a4e8b4b7aaba4590b542337ecda0
parentRevert "gcc-config: store gcc backup into /lib/gcc-backup, not /lib" (diff)
downloadgcc-config-1e2e76a2b23caef964de881b14146c58b0a0ee77.tar.gz
gcc-config-1e2e76a2b23caef964de881b14146c58b0a0ee77.tar.bz2
gcc-config-1e2e76a2b23caef964de881b14146c58b0a0ee77.zip
gcc-config: Ignore PATH set in profile files.
Profile files created by toolchain.eclass before gentoo commit 534e0f7d5e8a02264b7b7fc97c3ef11441e35c5c contain assignment of PATH variable (e.g. PATH="/usr/x86_64-pc-linux-gnu/gcc-bin/9.2.0"). Sourcing them without restoring previous PATH value breaks gcc-config. Fixes: 231bc60d6fa6b8eb309ac2ca308f7c60213f81a3 Bug: https://bugs.gentoo.org/174422 Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org> Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
-rwxr-xr-xgcc-config18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc-config b/gcc-config
index b8f695f..9965449 100755
--- a/gcc-config
+++ b/gcc-config
@@ -80,6 +80,18 @@ show_var() {
echo "${!1}"
}
+# Compatibility with profile files created before 2019-09-05.
+# These profile files were setting PATH variable.
+# Sourcing them without restoring previous PATH value breaks gcc-config.
+source_profile_pre() {
+ __PATH__=${PATH}
+}
+
+source_profile_post() {
+ PATH=${__PATH__}
+ unset __PATH__
+}
+
try_real_hard_to_find_CHOST() {
#
# First we read make.conf
@@ -533,7 +545,9 @@ prefix_copy_gcc_libs() {
for x in ${GCC_PROFILES} ; do
unset GCC_PATH LDPATH
eval $(
+ source_profile_pre
source "${x}"
+ source_profile_post
echo "GCC_PATH='${GCC_PATH}'"
echo "LDPATH='${LDPATH%%:*}'"
)
@@ -599,7 +613,9 @@ switch_profile() {
# Setup things properly again for this profile
unset GCC_SPECS LDPATH MULTIOSDIRS
+ source_profile_pre
source "${GCC_ENV_D}/${CC_COMP}"
+ source_profile_post
# Support older configs that did not setup MULTIOSDIRS for us.
: ${MULTIOSDIRS:=../${GENTOO_LIBDIR}}
@@ -814,7 +830,9 @@ list_profiles() {
if [[ ${x} == ${CURRENT_NATIVE} ]] ; then
x="${x} ${GOOD}*${NORMAL}"
elif [[ -e ${GCC_ENV_D}/config-${target} ]] ; then
+ source_profile_pre
source "${GCC_ENV_D}/config-${target}"
+ source_profile_post
[[ ${x} == ${CURRENT} ]] && x="${x} ${HILITE}*${NORMAL}"
fi
echo " [${i}] ${x}"