Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 813099 - Portage doesn't take into account already installed package when resolving || () dependency containing a blocker atom
Summary: Portage doesn't take into account already installed package when resolving ||...
Status: UNCONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Dependencies (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-14 21:38 UTC by Alexander Tsoy
Modified: 2023-12-23 18:30 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 Alexander Tsoy 2021-09-14 21:38:33 UTC
portage fails to properly resolve the following dependency:

|| (
    category/package[-someuseflag]
    !category/package
)

For some reason it doesn't take into account already installed category/package[-someuseflag]. I've tried sys-apps/portage-3.0.23 and sys-apps/portage-3.0.20-r6.


This works fine:

$ sudo emerge -pv media-video/pipewire media-plugins/alsa-plugins

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

Calculating dependencies... done!
[ebuild   R    ] media-plugins/alsa-plugins-1.2.2::gentoo  USE="mix speex usb_stream -arcam_av -debug -ffmpeg -jack -libsamplerate -oss -pulseaudio" ABI_X86="32 (64) (-x32)" 0 KiB
[ebuild   R   ~] media-video/pipewire-0.3.33-r1:0/0.3::gentoo  USE="bluetooth gstreamer jack-sdk pipewire-alsa systemd v4l -doc -echo-cancel -extra -jack-client -test" ABI_X86="(64) -32 (-x32)" 0 KiB

Total: 2 packages (2 reinstalls), Size of downloads: 0 KiB



But this doesn't:

$ sudo emerge -pv media-video/pipewire 

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

Calculating dependencies... done!
[ebuild   R   ~] media-video/pipewire-0.3.33-r1:0/0.3::gentoo  USE="bluetooth gstreamer jack-sdk pipewire-alsa systemd v4l -doc -echo-cancel -extra -jack-client -test" ABI_X86="(64) -32 (-x32)" 0 KiB
[blocks B      ] media-plugins/alsa-plugins ("media-plugins/alsa-plugins" is blocking media-video/pipewire-0.3.33-r1)

Total: 1 package (1 reinstall), Size of downloads: 0 KiB
Conflict: 1 block (1 unsatisfied)

 * Error: The above package list contains packages which cannot be
 * installed at the same time on the same system.

  (media-plugins/alsa-plugins-1.2.2:0/0::gentoo, installed) pulled in by
    media-plugins/alsa-plugins required by @selected 

  (media-video/pipewire-0.3.33-r1:0/0.3::gentoo, ebuild scheduled for merge) pulled in by
    media-video/pipewire


For more information about Blocked Packages, please refer to the following
section of the Gentoo Linux x86 Handbook (architecture is irrelevant):

https://wiki.gentoo.org/wiki/Handbook:X86/Working/Portage#Blocked_packages



$ emerge --info portage
Portage 3.0.23 (python 3.9.6-final-0, default/linux/amd64/17.1, gcc-10.3.0, glibc-2.33-r1, 5.10.63-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-5.10.63-gentoo-x86_64-AMD_Ryzen_7_5800X_8-Core_Processor-with-glibc2.33
KiB Mem:    65833144 total,   3103380 free
KiB Swap:   16777212 total,  16775932 free
Timestamp of repository gentoo: Tue, 14 Sep 2021 07:00:01 +0000
Head commit of repository gentoo: c3b0fb0c5a039c91b39cf2410de16ac0a38dd76c
Head commit of repository puleglot: dc6ea7a0dc0dd561924ab880c5007c0c99c1e4fe

sh dash 0.5.11.3-r1
ld GNU ld (Gentoo 2.36.1 p5) 2.36.1
distcc 3.4 x86_64-pc-linux-gnu [disabled]
app-shells/bash:          5.1_p8::gentoo
dev-java/java-config:     2.3.1::gentoo
dev-lang/perl:            5.34.0::gentoo
dev-lang/python:          3.9.6_p2::gentoo
dev-lang/rust:            1.53.0::gentoo
dev-util/cmake:           3.20.5::gentoo
sys-apps/baselayout:      2.7::gentoo
sys-apps/sandbox:         2.24::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r5::gentoo
sys-devel/automake:       1.16.3-r1::gentoo
sys-devel/binutils:       2.36.1-r2::gentoo
sys-devel/gcc:            10.3.0-r2::gentoo
sys-devel/gcc-config:     2.4::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.3::gentoo
sys-kernel/linux-headers: 5.10::gentoo (virtual/os-headers)
sys-libs/glibc:           2.33-r1::gentoo
Repositories:

gentoo
    location: /var/db/repos/gentoo
    sync-type: rsync
    sync-uri: rsync://puleglot.ru/gentoo-portage
    priority: -1000
    sync-rsync-verify-max-age: 24
    sync-rsync-verify-metamanifest: yes
    sync-rsync-verify-jobs: 4
    sync-rsync-extra-opts: 

crossdev
    location: /var/db/repos/crossdev
    masters: gentoo
    priority: 100

puleglot
    location: /var/db/repos/puleglot
    sync-type: git
    sync-uri: https://puleglot.ru/git/gentoo/puleglot-overlay.git
    masters: gentoo
    priority: 900

local
    location: /usr/local/portage
    masters: gentoo
    priority: 1000

Installed sets: @devel
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=znver3 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/easy-rsa /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -march=znver3 -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--dynamic-deps=n --with-bdeps=y --binpkg-respect-use=y --ask-enter-invalid"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR"
FCFLAGS="-O2 -march=znver3 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg cgroup clean-logs compress-build-logs config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms split-log strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -march=znver3 -pipe"
GENTOO_MIRRORS="http://mirror.yandex.ru/gentoo-distfiles/ http://distfiles.gentoo.org/"
LANG="ru_RU.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j6"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
RUSTFLAGS="-C opt-level=2 -C target-cpu=znver3"
USE="X a52 aac acl acpi aio alsa amd64 amr ape asyncns avahi avif bash-completion bluetooth bluray branding bzip2 cairo caps cdda cddb cdparanoia cdr cli colord crypt cryptsetup cups dbus dconf device-mapper djvu dri dts dvd dvdr eds egl evo exif faac faad ffmpeg flac fontconfig fortran fuse gdbm gif gnome gnome-keyring gnome-online-accounts gpm gstreamer gtk gtk3 hardened heif iconv icu idn ieee1394 introspection ipv6 jpeg jpeg2k lcms libass libglvnd libnotify libsecret libtirpc lz4 lzma mac maildir mms mp3 mp4 multilib musepack musicbrainz nautilus ncurses networkmanager nls nptl ogg opengl openmp opus pam pcre pie pipewire png policykit postscript pulseaudio raw readline samba sasl seccomp speex spell split-usr ssl ssp startup-notification svg systemd theora tiff tls truetype udev unicode upnp-av urandom usb vaapi vdpau vim-syntax vorbis vpx vulkan wavpack wayland webp x264 x265 xattr xfs xtpax xv xvid xz zeroconf zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2018" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" APACHE2_MPMS="prefork" CALLIGRA_FEATURES="karbon sheets words" CAMERAS="*" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sha sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" GRUB_PLATFORMS="efi-64 pc" INPUT_DEVICES="evdev libinput" KERNEL="linux" L10N="en ru" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php7-3 php7-4" POSTGRES_TARGETS="postgres12 postgres13" PYTHON_SINGLE_TARGET="python3_9" PYTHON_TARGETS="python3_9" QEMU_SOFTMMU_TARGETS="aarch64 arm i386 mips mips64 mips64el mipsel x86_64" QEMU_USER_TARGETS="aarch64 arm" RUBY_TARGETS="ruby26" USERLAND="GNU" VIDEO_CARDS="amdgpu radeon radeonsi vesa" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq proto steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

=================================================================
                        Package Settings
=================================================================

sys-apps/portage-3.0.23::gentoo was built with the following:
USE="(ipc) native-extensions rsync-verify xattr -apidoc -build -doc -gentoo-dev (-selinux) -test" ABI_X86="(64)" PYTHON_TARGETS="python3_9 -pypy3 -python3_10 -python3_8"
FEATURES="multilib-strict ipc-sandbox usersync fixlafiles binpkg-logs pid-sandbox unmerge-logs usersandbox ebuild-locks preserve-libs qa-unresolved-soname-deps network-sandbox split-log binpkg-dostrip protect-owned xattr unknown-features-warn merge-sync unmerge-orphans sandbox cgroup distlocks news sfperms compress-build-logs buildpkg assume-digests binpkg-docompress config-protect-if-modified userfetch clean-logs strict userpriv parallel-fetch"
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2021-09-14 21:49:49 UTC
Out of interest, if you do emerge -pv category/package, say, emerge -pv media-plugins/alsa-plugins, what happens?

It's not looking to rebuild it or similar? It'd be interesting to see why it wants to rule it out.

(FWIW, this feels like an odd dependency anyway. Shouldn't !category/package[someuseflag] work instead? Maybe I'm missing something there though.)
Comment 2 Alexander Tsoy 2021-09-14 21:57:56 UTC
(In reply to Sam James from comment #1)
> Out of interest, if you do emerge -pv category/package, say, emerge -pv
> media-plugins/alsa-plugins, what happens?

$ emerge -pv media-plugins/alsa-plugins

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

Calculating dependencies... done!
[ebuild   R    ] media-plugins/alsa-plugins-1.2.2::gentoo  USE="mix speex usb_stream -arcam_av -debug -ffmpeg -jack -libsamplerate -oss -pulseaudio" ABI_X86="32 (64) (-x32)" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB


> (FWIW, this feels like an odd dependency anyway. Shouldn't
> !category/package[someuseflag] work instead? Maybe I'm missing something
> there though.)

Yeah, indeed. :)
Comment 3 Zac Medico gentoo-dev 2021-09-14 22:50:15 UTC
The dep_zapdeps function assigns lower cost to the !media-plugins/alsa-plugins choice because blockers are ignored here:

https://gitweb.gentoo.org/proj/portage.git/tree/lib/portage/dep/dep_check.py?h=portage-3.0.23#n406

		for atom in atoms:
			if atom.blocker:
				continue

Choices are sorted by cost here:

https://gitweb.gentoo.org/proj/portage.git/tree/lib/portage/dep/dep_check.py?h=portage-3.0.23#n690

	for choices in choice_bins:
		if len(choices) < 2:
			continue

		if minimize_slots:
			choices.sort(key=operator.attrgetter('new_slot_count'))
Comment 4 Zac Medico gentoo-dev 2021-09-15 03:19:24 UTC
(In reply to Alexander Tsoy from comment #2)
> (In reply to Sam James from comment #1)
> > Out of interest, if you do emerge -pv category/package, say, emerge -pv
> > media-plugins/alsa-plugins, what happens?
> 
> $ emerge -pv media-plugins/alsa-plugins
> 
> These are the packages that would be merged, in order:
> 
> Calculating dependencies... done!
> [ebuild   R    ] media-plugins/alsa-plugins-1.2.2::gentoo  USE="mix speex
> usb_stream -arcam_av -debug -ffmpeg -jack -libsamplerate -oss -pulseaudio"
> ABI_X86="32 (64) (-x32)" 0 KiB
> 
> Total: 1 package (1 reinstall), Size of downloads: 0 KiB
> 
> 
> > (FWIW, this feels like an odd dependency anyway. Shouldn't
> > !category/package[someuseflag] work instead? Maybe I'm missing something
> > there though.)
> 
> Yeah, indeed. :)

Yes, that's a simpler and equivalent expression, and portage would interpret it correctly. The || ( media-plugins/alsa-plugins[-pulseaudio] !media-plugins/alsa-plugins ) expression in unnecessarily complex. Both || deps and blockers are better avoided when possible.
Comment 5 Zac Medico gentoo-dev 2021-09-15 03:38:12 UTC
(In reply to Zac Medico from comment #4)
> Yes, that's a simpler and equivalent expression, and portage would interpret
> it correctly. The || ( media-plugins/alsa-plugins[-pulseaudio]
> !media-plugins/alsa-plugins ) expression in unnecessarily complex. Both ||
> deps and blockers are better avoided when possible.

Honestly, I don't know what the intention of the current alsa-plugins dependency is, but I suspect that the || dep has been misused.
Comment 6 Larry the Git Cow gentoo-dev 2021-09-16 21:51:49 UTC
The bug has been referenced in the following commit(s):

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

commit bb2267c8c9f435c2623e924e3ae2ad4e444642b9
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-09-16 21:50:15 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-09-16 21:51:36 +0000

    media-video/pipewire: add 0.3.36
    
    Bug: https://bugs.gentoo.org/791499
    Bug: https://bugs.gentoo.org/813099
    Thanks-to: Niklāvs Koļesņikovs <89q1r14hd@relay.firefox.com> (pointing out the version bug)
    Signed-off-by: Sam James <sam@gentoo.org>

 media-video/pipewire/Manifest             | 1 +
 media-video/pipewire/pipewire-9999.ebuild | 7 ++-----
 2 files changed, 3 insertions(+), 5 deletions(-)
Comment 7 Larry the Git Cow gentoo-dev 2021-09-16 21:55:49 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7d32da171523679474240d62b5dc7be927a6b218

commit 7d32da171523679474240d62b5dc7be927a6b218
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-09-16 21:54:50 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-09-16 21:55:36 +0000

    media-video/pipewire: add 0.3.36
    
    Bug: https://bugs.gentoo.org/791499
    Bug: https://bugs.gentoo.org/813099
    Fixes: bb2267c8c9f435c2623e924e3ae2ad4e444642b9
    Signed-off-by: Sam James <sam@gentoo.org>

 ...pewire-0.3.36-fix-crash-uaf-media-session.patch |  36 +++
 .../files/pipewire-0.3.36-fix-version.patch        |  25 ++
 media-video/pipewire/pipewire-0.3.36.ebuild        | 280 +++++++++++++++++++++
 media-video/pipewire/pipewire-9999.ebuild          |   2 +-
 4 files changed, 342 insertions(+), 1 deletion(-)
Comment 8 Larry the Git Cow gentoo-dev 2023-12-23 18:30:40 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9420c7358c39f71fa2cc4a362c2709b2a0e0bb98

commit 9420c7358c39f71fa2cc4a362c2709b2a0e0bb98
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2023-12-22 20:25:10 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2023-12-23 18:29:31 +0000

    kde-plasma/print-manager: Add 23.08.5-r100 shim pulling in SLOT 6
    
    Starting situation:
    
    [P] kde-plasma/print-manager-5.91.0:6
            RDEPEND: !kde-plasma/print-manager:5
    [I] kde-plasma/print-manager-23.08.4:5
    
    There are two revdeps:
            kde-apps/kdeutils-meta-23.08.4-r1:5, slated for merge, having:
                    cups? ( || (
                            kde-plasma/print-manager:6
                            >=kde-plasma/print-manager-23.08.4:5
                    ) )
            kde-plasma/plasma-meta-5.91.0, slated for merge, having:
                    cups ? (>=kde-plasma/print-manager-5.91.0:6)
    
    For the ensuing world upgrade, Portage refuses to pick print-manager:6
    over print-manager:5, presenting it as [blocks B] error.
    
    Bug: https://bugs.gentoo.org/813099
    Bug: https://bugs.gentoo.org/814335
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 kde-plasma/print-manager/print-manager-23.08.5-r100.ebuild | 13 +++++++++++++
 profiles/package.mask                                      |  1 +
 2 files changed, 14 insertions(+)

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

commit ae9a2d38e4b156d7aebaac6c24d714094352a858
Author:     Andreas Sturmlechner <asturm@gentoo.org>
AuthorDate: 2023-12-22 19:46:42 +0000
Commit:     Andreas Sturmlechner <asturm@gentoo.org>
CommitDate: 2023-12-23 18:29:31 +0000

    kde-apps/kio-extras: Add 23.08.5-r100 shim pulling in kio-extras-kf5
    
    Starting situation:
    
    [I] kde-apps/kio-extras-23.08.4:5
    [P] kde-apps/kio-extras-24.01.85:6
        RDEPEND: !kde-apps/kio-extras:5 !kde-apps/kio-extras-kf5:5[-kf6compat]
    
    As a non-colliding continuation of SLOT 5, there is:
    [P] kde-apps/kio-extras-kf5-24.01.85:5 USE="... kf6compat ..."
        RDEPEND: !kde-apps/kio-extras:5
    
    All SLOT 5 revdeps look like this:
            RDEPEND="|| (
                    kde-apps/kio-extras-kf5:5
                    kde-apps/kio-extras:5
            )"
    
    The ensuing world upgrade contains installed packages depending on SLOT 5
    and ebuilds scheduled for merge depending on SLOT 6.
    
    Portage refuses to pick kio-extras-kf5 over kio-extras:5, presenting
    it as [blocks B] error.
    
    Workaround:
    Add kde-apps/kio-extras-23.08.5-r100:5 (RDEPEND=kde-apps/kio-extras-kf5:5)
    
    Bug: https://bugs.gentoo.org/813099
    Bug: https://bugs.gentoo.org/814335
    Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>

 kde-apps/kio-extras/kio-extras-23.08.5-r100.ebuild | 13 +++++++++++++
 profiles/package.mask                              |  3 ++-
 2 files changed, 15 insertions(+), 1 deletion(-)