public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH multilib.eclass] Distinguish between unset and empty variables when restoring.
@ 2013-04-20  5:12 Michał Górny
  2013-04-20  6:10 ` [gentoo-dev] " Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: Michał Górny @ 2013-04-20  5:12 UTC (permalink / raw
  To: gentoo-dev; +Cc: hasufell, amd64, toolchain, Michał Górny

Currently, the multilib_toolchain_setup function does not distinguish
between unset and empty variables. Therefore, variables which were unset
before calling it are restored as empty and exported. This breaks some
packages, e.g. libdbusmenu.

This patch 'disables' saving variables which were unset, therefore
making the saved variants unset. Then, restoring exports only those
variables which were set in the saved variants and unsets remaining
ones.

Fixes: https://bugs.gentoo.org/show_bug.cgi?id=461682
---
 gx86/eclass/multilib.eclass | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gx86/eclass/multilib.eclass b/gx86/eclass/multilib.eclass
index 13583d0..dd78d38 100644
--- a/gx86/eclass/multilib.eclass
+++ b/gx86/eclass/multilib.eclass
@@ -397,7 +397,8 @@ multilib_toolchain_setup() {
 	if [[ ${__DEFAULT_ABI_SAVED} == "true" ]] ; then
 		for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
 			vv="__abi_saved_${v}"
-			export ${v}="${!vv}"
+			unset ${v}
+			[[ ${!vv+1} ]] && export ${v}="${!vv}"
 			unset ${vv}
 		done
 		unset __DEFAULT_ABI_SAVED
@@ -408,7 +409,9 @@ multilib_toolchain_setup() {
 	if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then
 		# Back that multilib-ass up so we can restore it later
 		for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
-			export __abi_saved_${v}="${!v}"
+			vv=__abi_saved_${v}
+			unset ${vv}
+			[[ ${!v+1} ]] && export ${vv}="${!v}"
 		done
 		export __DEFAULT_ABI_SAVED="true"
 
-- 
1.8.1.5



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-dev] Re: [PATCH multilib.eclass] Distinguish between unset and empty variables when restoring.
  2013-04-20  5:12 [gentoo-dev] [PATCH multilib.eclass] Distinguish between unset and empty variables when restoring Michał Górny
@ 2013-04-20  6:10 ` Mike Frysinger
  2013-04-20 15:42   ` Michał Górny
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2013-04-20  6:10 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-dev, hasufell, amd64, toolchain

[-- Attachment #1: Type: Text/Plain, Size: 335 bytes --]

On Saturday 20 April 2013 01:12:20 Michał Górny wrote:
>  		for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
>  			vv="__abi_saved_${v}"
> -			export ${v}="${!vv}"
> +			unset ${v}
> +			[[ ${!vv+1} ]] && export ${v}="${!vv}"
>  			unset ${vv}

merge the two unset commands.  no need to run it twice.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] Re: [PATCH multilib.eclass] Distinguish between unset and empty variables when restoring.
  2013-04-20  6:10 ` [gentoo-dev] " Mike Frysinger
@ 2013-04-20 15:42   ` Michał Górny
  2013-04-22  1:18     ` Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: Michał Górny @ 2013-04-20 15:42 UTC (permalink / raw
  To: gentoo-dev; +Cc: vapier, hasufell, amd64, toolchain

[-- Attachment #1: Type: text/plain, Size: 619 bytes --]

On Sat, 20 Apr 2013 02:10:20 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> On Saturday 20 April 2013 01:12:20 Michał Górny wrote:
> >  		for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
> >  			vv="__abi_saved_${v}"
> > -			export ${v}="${!vv}"
> > +			unset ${v}
> > +			[[ ${!vv+1} ]] && export ${v}="${!vv}"
> >  			unset ${vv}
> 
> merge the two unset commands.  no need to run it twice.

How would I do this? If I do both before the 'export', I lose
the original value. If I do both after the 'export', I lose the value
I just exported.

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-dev] Re: [PATCH multilib.eclass] Distinguish between unset and empty variables when restoring.
  2013-04-20 15:42   ` Michał Górny
@ 2013-04-22  1:18     ` Mike Frysinger
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Frysinger @ 2013-04-22  1:18 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-dev, hasufell, amd64, toolchain

[-- Attachment #1: Type: Text/Plain, Size: 1580 bytes --]

On Saturday 20 April 2013 11:42:42 Michał Górny wrote:
> On Sat, 20 Apr 2013 02:10:20 -0400 Mike Frysinger wrote:
> > On Saturday 20 April 2013 01:12:20 Michał Górny wrote:
> > >  		for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
> > >  		
> > >  			vv="__abi_saved_${v}"
> > > 
> > > -			export ${v}="${!vv}"
> > > +			unset ${v}
> > > +			[[ ${!vv+1} ]] && export ${v}="${!vv}"
> > > 
> > >  			unset ${vv}
> > 
> > merge the two unset commands.  no need to run it twice.
> 
> How would I do this? If I do both before the 'export', I lose
> the original value. If I do both after the 'export', I lose the value
> I just exported.

touche.  i've committed the patch below.
-mike

--- multilib.eclass	21 Jan 2013 19:22:25 -0000	1.102
+++ multilib.eclass	22 Apr 2013 01:17:23 -0000
@@ -397,7 +397,7 @@ multilib_toolchain_setup() {
 	if [[ ${__DEFAULT_ABI_SAVED} == "true" ]] ; then
 		for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
 			vv="__abi_saved_${v}"
-			export ${v}="${!vv}"
+			[[ ${!vv+set} == "set" ]] && export ${v}="${!vv}" || unset ${v}
 			unset ${vv}
 		done
 		unset __DEFAULT_ABI_SAVED
@@ -408,7 +408,8 @@ multilib_toolchain_setup() {
 	if [[ ${ABI} != ${DEFAULT_ABI} ]] ; then
 		# Back that multilib-ass up so we can restore it later
 		for v in CHOST CBUILD AS CC CXX LD PKG_CONFIG_{LIBDIR,PATH} ; do
-			export __abi_saved_${v}="${!v}"
+			vv="__abi_saved_${v}"
+			[[ ${!v+set} == "set" ]] && export ${vv}="${!v}" || unset ${vv}
 		done
 		export __DEFAULT_ABI_SAVED="true"
 

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-04-22  1:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-20  5:12 [gentoo-dev] [PATCH multilib.eclass] Distinguish between unset and empty variables when restoring Michał Górny
2013-04-20  6:10 ` [gentoo-dev] " Mike Frysinger
2013-04-20 15:42   ` Michał Górny
2013-04-22  1:18     ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox