Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 615824 - sys-apps/portage: emerge fails to report slot conflicts involving autounmask USE changes
Summary: sys-apps/portage: emerge fails to report slot conflicts involving autounmask ...
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
Depends on:
Blocks: 300071 628004
  Show dependency tree
Reported: 2017-04-17 08:41 UTC by Zac Medico
Modified: 2021-02-23 22:39 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2017-04-17 08:41:49 UTC
While testing changes for bug 615680, I found that emerge fails to report slot conflicts triggered by autounmask USE changes. The problem is that the _check_slot_conflict fails to identify the slot conflict, since it only sees one package instance, when there should actually be 2 different instances with different USE settings. The problem can be solved by making _check_slot_conflict check if all parent atoms match pkg, and making _add_pkg use pkg.with_use(self._pkg_use_enabled(pkg)) to generate a second package instance (this will cause PackageTracker to recognize the slot conflict). The following test case triggers the problem:

from portage.tests import TestCase
from portage.tests.resolver.ResolverPlayground import (

class AutounmaskUseSlotConflictTestCase(TestCase):

	def testAutounmaskUseSlotConflict(self):

		ebuilds = {
			"sci-libs/K-1": {
				"IUSE": "+foo",
				"EAPI": 1
			"sci-libs/L-1": {
				"DEPEND": "sci-libs/K[-foo]",
				"EAPI": 2
			"sci-libs/M-1": {
				"DEPEND": "sci-libs/K[foo=]",
				"IUSE": "+foo",
				"EAPI": 2

		installed = {}

		test_cases = (
				["sci-libs/L", "sci-libs/M"],
				options={"--backtrack": 0},
				success = False,
				mergelist = [
				ignore_mergelist_order = True,
				slot_collision_solutions = [
						"sci-libs/K-1": {"foo": False},
						"sci-libs/M-1": {"foo": False}

		playground = ResolverPlayground(
			ebuilds=ebuilds, installed=installed, debug=True)
			for test_case in test_cases:
					True, test_case.fail_msg)
			playground.debug = False
Comment 1 Zac Medico gentoo-dev 2017-04-17 09:21:20 UTC
If we're going to add pkg.with_use(self._pkg_use_enabled(pkg)) to the graph, then we need to add USE to the hash key. Also, the way that _pkg_use_enabled is used everywhere needs to be carefully considered. Maybe it will be okay as long as USE is part of the hash key.
Comment 2 Zac Medico gentoo-dev 2017-04-24 07:06:41 UTC
Fixing this bug will require significant changes, and it shouldn't block bug 615680.
Comment 3 Larry the Git Cow gentoo-dev 2021-02-23 22:39:05 UTC
The bug has been referenced in the following commit(s):

commit f5a58b3f2e2adc7f9d2794d4e91d44ec1419b56a
Author:     Zac Medico <>
AuthorDate: 2021-02-23 22:14:30 +0000
Commit:     Zac Medico <>
CommitDate: 2021-02-23 22:37:34 +0000

    Add USE conflict unit test for bug 615824
    Test bug 615824, where an automask USE change results in
    a conflict which is not reported. In order to install L,
    foo must be disabled for both K and M, but autounmask
    disables foo for K and leaves it enabled for M:
    [ebuild  N     ] sci-libs/K-1  USE="-foo"
    [ebuild  N     ] sci-libs/L-1
    [ebuild  N     ] sci-libs/M-1  USE="foo"
    The following USE changes are necessary to proceed:
     (see "package.use" in the portage(5) man page for more details)
    # required by sci-libs/L-1::test_repo
    # required by sci-libs/L (argument)
    >=sci-libs/K-1 -foo
    Signed-off-by: Zac Medico <>

 .../resolver/  | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)