Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/gcc-config:master commit in: /
Date: Sun, 08 Sep 2019 08:29:52
Message-Id: 1567931371.1e2e76a2b23caef964de881b14146c58b0a0ee77.slyfox@gentoo
1 commit: 1e2e76a2b23caef964de881b14146c58b0a0ee77
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Sun Sep 8 06:48:14 2019 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 8 08:29:31 2019 +0000
6 URL: https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=1e2e76a2
7
8 gcc-config: Ignore PATH set in profile files.
9
10 Profile files created by toolchain.eclass before gentoo commit 534e0f7d5e8a02264b7b7fc97c3ef11441e35c5c
11 contain assignment of PATH variable (e.g. PATH="/usr/x86_64-pc-linux-gnu/gcc-bin/9.2.0").
12 Sourcing them without restoring previous PATH value breaks gcc-config.
13
14 Fixes: 231bc60d6fa6b8eb309ac2ca308f7c60213f81a3
15 Bug: https://bugs.gentoo.org/174422
16 Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache.Org>
17 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
18
19 gcc-config | 18 ++++++++++++++++++
20 1 file changed, 18 insertions(+)
21
22 diff --git a/gcc-config b/gcc-config
23 index b8f695f..9965449 100755
24 --- a/gcc-config
25 +++ b/gcc-config
26 @@ -80,6 +80,18 @@ show_var() {
27 echo "${!1}"
28 }
29
30 +# Compatibility with profile files created before 2019-09-05.
31 +# These profile files were setting PATH variable.
32 +# Sourcing them without restoring previous PATH value breaks gcc-config.
33 +source_profile_pre() {
34 + __PATH__=${PATH}
35 +}
36 +
37 +source_profile_post() {
38 + PATH=${__PATH__}
39 + unset __PATH__
40 +}
41 +
42 try_real_hard_to_find_CHOST() {
43 #
44 # First we read make.conf
45 @@ -533,7 +545,9 @@ prefix_copy_gcc_libs() {
46 for x in ${GCC_PROFILES} ; do
47 unset GCC_PATH LDPATH
48 eval $(
49 + source_profile_pre
50 source "${x}"
51 + source_profile_post
52 echo "GCC_PATH='${GCC_PATH}'"
53 echo "LDPATH='${LDPATH%%:*}'"
54 )
55 @@ -599,7 +613,9 @@ switch_profile() {
56
57 # Setup things properly again for this profile
58 unset GCC_SPECS LDPATH MULTIOSDIRS
59 + source_profile_pre
60 source "${GCC_ENV_D}/${CC_COMP}"
61 + source_profile_post
62 # Support older configs that did not setup MULTIOSDIRS for us.
63 : ${MULTIOSDIRS:=../${GENTOO_LIBDIR}}
64
65 @@ -814,7 +830,9 @@ list_profiles() {
66 if [[ ${x} == ${CURRENT_NATIVE} ]] ; then
67 x="${x} ${GOOD}*${NORMAL}"
68 elif [[ -e ${GCC_ENV_D}/config-${target} ]] ; then
69 + source_profile_pre
70 source "${GCC_ENV_D}/config-${target}"
71 + source_profile_post
72 [[ ${x} == ${CURRENT} ]] && x="${x} ${HILITE}*${NORMAL}"
73 fi
74 echo " [${i}] ${x}"