Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 771549

Summary: sys-apps/portage: USE="${USE} foo" at top of make.defaults causes unexpected override of parent profile package.use
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: Enhancement/Feature RequestsAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: sam, zerochaos
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=492854
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 766117    
Bug Blocks:    

Description Zac Medico gentoo-dev 2021-02-19 04:13:50 UTC
Occasionally people put a setting like USE="${USE} foo" a the top of make.defaults, and that pulls USE from the parent profile into the current profile, which can cause unexpected override of parent profile package.use.

We can guard against this if we remove the parent profile's USE setting from the expand_map variable.
Comment 2 Zac Medico gentoo-dev 2021-02-22 04:32:38 UTC
It would be nice to guard the USE_EXPAND variables like this too, but USE_EXPAND is not known until after make.defaults is evaluated.
Comment 3 Larry the Git Cow gentoo-dev 2021-02-22 05:32:00 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=784d2c19f2d62982db16af9055bdab6b595a661b

commit 784d2c19f2d62982db16af9055bdab6b595a661b
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2021-02-19 05:51:43 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2021-02-22 05:26:53 +0000

    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 <zmedico@gentoo.org>

 lib/portage/package/ebuild/config.py | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
Comment 4 Larry the Git Cow gentoo-dev 2021-02-22 13:54:34 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6b98e103aa15da331d647a8f65a45bb3bb4e3197

commit 6b98e103aa15da331d647a8f65a45bb3bb4e3197
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2021-02-22 13:46:04 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2021-02-22 13:54:29 +0000

    sys-apps/portage: Bump to version 3.0.15
    
     #715112 default enable FEATURES=binpkg-multi-instance
     #756778 content-hash distfiles layout
     #766459 emirrordist: prevent distfiles_db _pkg_str pickle problems
     #766767 emaint --fix merges: add -y, --yes option
     #766773 emerge: disable --autounmask-license by default
     #767913 portage.getpid: call os.getpid() lazily
     #770712 PopenProcess: use call_soon for _async_waipid in _start
     #771549 prevent USE="${USE} ..." misbehavior
    
    Bug: https://bugs.gentoo.org/766117
    Bug: https://bugs.gentoo.org/715112
    Bug: https://bugs.gentoo.org/756778
    Bug: https://bugs.gentoo.org/766459
    Bug: https://bugs.gentoo.org/766767
    Bug: https://bugs.gentoo.org/766773
    Bug: https://bugs.gentoo.org/767913
    Bug: https://bugs.gentoo.org/770712
    Bug: https://bugs.gentoo.org/771549
    Package-Manager: Portage-3.0.15, Repoman-3.0.2
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.15.ebuild | 268 +++++++++++++++++++++++++++++++++
 2 files changed, 269 insertions(+)
Comment 5 Zac Medico gentoo-dev 2021-04-09 21:26:34 UTC
*** Bug 560166 has been marked as a duplicate of this bug. ***