Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 651018 - sys-apps/portage: emerge --emptytree @world 'forgets' a dependency that doesn't satisfy USE requirements
Summary: sys-apps/portage: emerge --emptytree @world 'forgets' a dependency that doesn...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Dependencies (show other bugs)
Hardware: All Linux
: Normal major with 1 vote (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
: 653970 (view as bug list)
Depends on:
Blocks: 300071
  Show dependency tree
 
Reported: 2018-03-20 19:52 UTC by calimeroteknik
Modified: 2018-05-02 22:22 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description calimeroteknik 2018-03-20 19:52:58 UTC
In order to install dev-java/icedtea-bin, I once put the following lines in /etc/portage/package.use:
dev-java/icedtea-bin -webstart headless-awt
app-text/ghostscript-gpl cups


Today I ran my routine update/check process:
# (no emerge --sync here)
emerge -av --update --deep --newrepo --newuse --changed-deps @world
emerge -av --depclean # note this
(no errors happened)

Then I removed this line from /etc/portage/package.use:
app-text/ghostscript-gpl cups

And re-ran:
~ # emerge -av --update --deep --newrepo --newuse --changed-deps @world

These are the packages that would be merged, in order:

Calculating dependencies... done!

Total: 0 packages, Size of downloads: 0 KiB

Nothing to merge; quitting.


To be frank, I expected an error, so in doubt, I tried the following:

~ # emerge -av1 app-text/ghostscript-gpl

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild   R    ] app-text/ghostscript-gpl-9.21  USE="-cups*" 

!!! Multiple package instances within a single package slot have been pulled
!!! into the dependency graph, resulting in a slot conflict:

app-text/ghostscript-gpl:0

  (app-text/ghostscript-gpl-9.21:0/0::gentoo, ebuild scheduled for merge) pulled in by
    app-text/ghostscript-gpl (Argument)

  (app-text/ghostscript-gpl-9.21:0/0::gentoo, installed) pulled in by
    >=app-text/ghostscript-gpl-9.09[cups] required by (net-print/cups-filters-1.17.9:0/0::gentoo, installed)
                                    ^^^^                                                                                                        


It might be possible to solve this slot collision
by applying all of the following changes:
   - app-text/ghostscript-gpl-9.21 (Change USE: +cups)


My portage tree wasn't super fresh, and this was portage 2.3.19.
So I updated:
emerge -av --sync # this told me a new version of portage was available
emerge -av1 portage # this updated 2.3.19 -> 2.3.24
emerge -av --update --deep --newrepo --newuse --changed-deps @world
emerge -av --depclean # note this
(no errors happened running all of this)

Re-running emerge -av1 app-text/ghostscript-gpl produces the same result as previously (character for character, I ran diff on the two outputs).

And, the output of `emerge -epv @world`, which does not produce any error, does not include ghostscript-gpl.
It does however include cups-filters, which pulls ghostscript-gpl:

~ # emerge -cpv ghostscript-gpl

Calculating dependencies... done!
  app-text/ghostscript-gpl-9.21 pulled in by:
    net-print/cups-filters-1.17.9 requires >=app-text/ghostscript-gpl-9.09[cups]

>>> No packages selected for removal by depclean
Packages installed:   509
Packages in world:    88
Packages in system:   44
Required packages:    509
Number to remove:     0


If I put "app-text/ghostscript-gpl cups" back into /etc/portage/package.use, then `emerge -epv @world` includes ghostscript-gpl as expected.

Possibly related: https://bugs.gentoo.org/show_bug.cgi?id=559224
Comment 1 Zac Medico gentoo-dev 2018-03-20 22:12:11 UTC
This is practically the same issue as bug 266836, just triggered by --emptytree instead of --newuse.
Comment 2 Zac Medico gentoo-dev 2018-03-29 07:00:27 UTC
This problem is well understood, it's due to the depgraph _add_dep method trying very hard to satisfy dependencies:

https://gitweb.gentoo.org/proj/portage.git/tree/pym/_emerge/depgraph.py?h=portage-2.3.26#n2765

Rather than come up empty-handed, it selects an installed package to satisfy the dependency. This sort of behavior could be desirable in some cases. For example, consider that some people might want to be able to continue despite an ebuild or binary package unavailable, while the installed instance satisfies the dependency. We should definitely provide an option to make emerge bail out here, though.
Comment 3 Zac Medico gentoo-dev 2018-03-29 07:08:11 UTC
See this code where for --emptytree it does not pass up the installed package if the matched_packages list is empty:

https://gitweb.gentoo.org/proj/portage.git/tree/pym/_emerge/depgraph.py?h=portage-2.3.26#n6220

if installed and not find_existing_node:
	want_reinstall = reinstall or empty or \
		(found_available_arg and not selective)
	if want_reinstall and matched_packages:
		continue

If you want emerge to bail out, you need to reject that installed package.
Comment 4 Zac Medico gentoo-dev 2018-04-26 19:44:19 UTC
*** Bug 653970 has been marked as a duplicate of this bug. ***