Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: hasufell@g.o, amd64@g.o, toolchain@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH multilib.eclass] Distinguish between unset and empty variables when restoring.
Date: Sat, 20 Apr 2013 05:11:25
Message-Id: 1366434740-1265-1-git-send-email-mgorny@gentoo.org
1 Currently, the multilib_toolchain_setup function does not distinguish
2 between unset and empty variables. Therefore, variables which were unset
3 before calling it are restored as empty and exported. This breaks some
4 packages, e.g. libdbusmenu.
5
6 This patch 'disables' saving variables which were unset, therefore
7 making the saved variants unset. Then, restoring exports only those
8 variables which were set in the saved variants and unsets remaining
9 ones.
10
11 Fixes: https://bugs.gentoo.org/show_bug.cgi?id=461682
12 ---
13 gx86/eclass/multilib.eclass | 7 +++++--
14 1 file changed, 5 insertions(+), 2 deletions(-)
15
16 diff --git a/gx86/eclass/multilib.eclass b/gx86/eclass/multilib.eclass
17 index 13583d0..dd78d38 100644
18 --- a/gx86/eclass/multilib.eclass
19 +++ b/gx86/eclass/multilib.eclass
20 @@ -397,7 +397,8 @@ multilib_toolchain_setup() {
21 if [[ ${__DEFAULT_ABI_SAVED} == "true" ]] ; then
22 for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
23 vv="__abi_saved_${v}"
24 - export ${v}="${!vv}"
25 + unset ${v}
26 + [[ ${!vv+1} ]] && export ${v}="${!vv}"
27 unset ${vv}
28 done
29 unset __DEFAULT_ABI_SAVED
30 @@ -408,7 +409,9 @@ multilib_toolchain_setup() {
31 if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then
32 # Back that multilib-ass up so we can restore it later
33 for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
34 - export __abi_saved_${v}="${!v}"
35 + vv=__abi_saved_${v}
36 + unset ${vv}
37 + [[ ${!v+1} ]] && export ${vv}="${!v}"
38 done
39 export __DEFAULT_ABI_SAVED="true"
40
41 --
42 1.8.1.5

Replies