From 784d2c19f2d62982db16af9055bdab6b595a661b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 18 Feb 2021 21:51:43 -0800 Subject: make.defaults: prevent USE="${USE} ..." misbehavior Discard parent profile USE from the expand_map variable before it is used to evaluate a child profile. This prevents accidents triggered by USE="${USE} ..." settings at the top of make.defaults which caused parent profile USE to override parent profile package.use settings. Note that would be nice to guard the USE_EXPAND variables like this too, but unfortunately USE_EXPAND is not known until after make.defaults has been evaluated, so that will require some form of make.defaults preprocessing. Bug: https://bugs.gentoo.org/771549 Signed-off-by: Zac Medico --- lib/portage/package/ebuild/config.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py index e5ec681af..690efde9d 100644 --- a/lib/portage/package/ebuild/config.py +++ b/lib/portage/package/ebuild/config.py @@ -612,9 +612,20 @@ class config: mygcfg = {} if profiles_complex: - mygcfg_dlists = [getconfig(os.path.join(x.location, "make.defaults"), - tolerant=tolerant, expand=expand_map, recursive=x.portage1_directories) - for x in profiles_complex] + mygcfg_dlists = [] + for x in profiles_complex: + # Prevent accidents triggered by USE="${USE} ..." settings + # at the top of make.defaults which caused parent profile + # USE to override parent profile package.use settings. + # It would be nice to guard USE_EXPAND variables like + # this too, but unfortunately USE_EXPAND is not known + # until after make.defaults has been evaluated, so that + # will require some form of make.defaults preprocessing. + expand_map.pop("USE", None) + mygcfg_dlists.append( + getconfig(os.path.join(x.location, "make.defaults"), + tolerant=tolerant, expand=expand_map, + recursive=x.portage1_directories)) self._make_defaults = mygcfg_dlists mygcfg = stack_dicts(mygcfg_dlists, incrementals=self.incrementals) -- cgit v1.2.3-65-gdbad