Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 917259 - app-arch/pigz-2.8 unpack fails because app-alternatives/gzip-1 installs broken symlink first
Summary: app-arch/pigz-2.8 unpack fails because app-alternatives/gzip-1 installs broke...
Status: RESOLVED FIXED
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: InVCS
: 899606 899650 (view as bug list)
Depends on: 916977
Blocks:
  Show dependency tree
 
Reported: 2023-11-12 16:38 UTC by Benn Snyder
Modified: 2024-03-03 23:02 UTC (History)
7 users (show)

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


Attachments
runtime cycle digraph (64 nodes) (debug.log,21.31 KB, text/x-log)
2023-11-17 04:45 UTC, Zac Medico
Details
runtime cycle digraph (23 nodes) (debug.log,4.25 KB, text/x-log)
2023-11-18 07:19 UTC, Zac Medico
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Benn Snyder 2023-11-12 16:38:08 UTC
When switching app-alternatives/gzip to pigz while app-arch/pigz is not already installed, the build fails because the gzip symlink is already broken.

Reproducible: Always

Steps to Reproduce:
1. Switch to pigz by setting in package.use

    app-alternatives/gzip pigz -reference

2. Perform a world update

    $ sudo emerge -vDu --changed-use @world
Actual Results:  
Portage installs the app-alternatives/gzip symlinks first.

    [ebuild     U  ] app-alternatives/gzip-1::gentoo [0::gentoo] USE="pigz* -reference* (-split-usr)" 0 KiB
    [ebuild  N     ] app-arch/pigz-2.8::gentoo  USE="-static -test -verify-sig" 119 KiB

Then the app-arch pigz build fails...

    >>> Unpacking pigz-2.8.tar.gz to /tmportage/portage/app-arch/pigz-2.8/work
    /usr/lib/portage/python3.11/phase-helpers.sh: line 371: gzip: command not found

...because the gzip symlink is broken.

    $ file /bin/gzip
    /bin/gzip: broken symbolic link to pigz

Expected Results:  
app-arch/pigz should be installed BEFORE app-alternatives/gzip so that the /bin/gzip symlink is never broken during this process.
Comment 1 Ionen Wolkens gentoo-dev 2023-11-12 17:09:13 UTC
Please provide emerge --info

>When switching app-alternatives/gzip to pigz while app-arch/pigz
>is not already installed, the build fails because the gzip symlink
>is already broken.
Odd... this shouldn't be possible unless there's a portage bug or something else strange going on. app-alternatives/gzip[pigz] runtime depends on pigz and so portage should always install it *first*

Haven't tried --changed-use but e.g. for me it's done before as you'd expect:
$ USE="-reference pigz" emerge -pvq app-alternatives/gzip
[ebuild  N    ] app-arch/pigz-2.8  USE="-static -test -verify-sig" 
[ebuild   R   ] app-alternatives/gzip-1  USE="pigz* (split-usr) -reference*"
Comment 2 Benn Snyder 2023-11-12 17:18:59 UTC
I do have aggressive job parallelization flags, but still it's weird to get out-of-order installation with RDEPEND.  I remember reading https://devmanual.gentoo.org/general-concepts/dependencies/#runtime-dependencies which says

> Items which are in RDEPEND but not DEPEND could in theory be merged after the target package. Portage does not currently do this.

but maybe this is no longer 100% accurate.

--------

$ emerge --info

Portage 3.0.51 (python 3.11.5-final-0, default/linux/amd64/17.1/desktop/plasma/systemd/merged-usr, gcc-13, glibc-2.37-r7, 6.1.57-gentoo-dist-hardened x86_64)
=================================================================
System uname: Linux-6.1.57-gentoo-dist-hardened-x86_64-Intel-R-_Core-TM-_i7-6700HQ_CPU_@_2.60GHz-with-glibc2.37
KiB Mem:    16198560 total,   4009824 free
KiB Swap:   33554428 total,  32166396 free
Timestamp of repository gentoo: Sun, 12 Nov 2023 16:32:00 +0000
Head commit of repository gentoo: f9d8f0e9721047236cfecaa96b55f8c2b4dbd925

Head commit of repository steam-overlay: e6ea1449bcfc7c9157fc23be050ae15534992f22

sh bash 5.1_p16-r6
ld GNU ld (Gentoo 2.40 p5) 2.40.0
ccache version 4.8.2 [enabled]
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r6::gentoo
dev-lang/perl:             5.38.0-r1::gentoo
dev-lang/python:           3.11.5::gentoo
dev-lang/rust:             1.72.0-r1::gentoo
dev-util/ccache:           4.8.2::gentoo
dev-util/cmake:            3.26.5-r2::gentoo
dev-util/meson:            1.2.2-r1::gentoo
sys-apps/baselayout:       2.14::gentoo
sys-apps/sandbox:          2.38::gentoo
sys-apps/systemd:          254.5::gentoo
sys-devel/autoconf:        2.13-r7::gentoo, 2.71-r6::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.40-r5::gentoo
sys-devel/binutils-config: 5.5::gentoo
sys-devel/clang:           16.0.6::gentoo
sys-devel/gcc:             13.2.1_p20230826::gentoo
sys-devel/gcc-config:      2.11::gentoo
sys-devel/libtool:         2.4.7-r1::gentoo
sys-devel/lld:             16.0.6::gentoo
sys-devel/llvm:            16.0.6::gentoo
sys-devel/make:            4.4.1-r1::gentoo
sys-kernel/linux-headers:  6.1::gentoo (virtual/os-headers)
sys-libs/glibc:            2.37-r7::gentoo
Repositories:

gentoo
    location: /var/tmp/cache/repos/gentoo
    sync-type: git
    sync-uri: https://anongit.gentoo.org/git/repo/sync/gentoo.git
    priority: -1000
    volatile: False
    sync-git-verify-commit-signature: yes

overboard
    location: /var/tmp/cache/repos/overboard
    masters: gentoo
    volatile: True

steam-overlay
    location: /var/tmp/cache/repos/steam-overlay
    sync-type: git
    sync-uri: https://github.com/anyc/steam-overlay
    masters: gentoo
    volatile: False

Installed sets: @boinc, @desktop
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /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"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS="--jobs=10 --load-average=32 --keep-going"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE 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 XDG_STATE_HOME"
FCFLAGS="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs buildpkg-live ccache 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 strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LEX="flex"
LINGUAS="en_US"
MAKEOPTS="--jobs=10 --load-average=32"
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="/tmportage"
RUSTFLAGS="-C target-cpu=native"
SHELL="/bin/bash"
USE="aac acl acpi activities aio amd64 bluetooth branding bzip2 cairo ccache cdr cli crypt cups dbus declarative dist-kernel dri dts dvdr encode exif ffmpeg flac gdbm gif git gpm gui hardened iconv icu ipv6 jpeg kde kwallet lcms libtirpc lm-sensors lto mad mng mp3 mp4 mpeg multilib ncurses networkmanager nls nptl offensive ogg opencl opengl openmp pam pango pcre pdf pgo pipewire plasma png policykit ppds pulseaudio qml qt5 readline screencast seccomp smp sound spell ssl startup-notification system-bootstrap system-ffmpeg system-icu system-llvm systemd test-rust threads tiff truetype udev udisks unicode upower usb vaapi vorbis vulkan wayland webp widgets wifi x264 xattr xcb xml xv zfs zlib zstd" ABI_X86="64" ADA_TARGET="gnat_2021" 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" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 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" INPUT_DEVICES="libinput synaptics" KERNEL="linux" L10N="en_US" 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="php8-1" POSTGRES_TARGETS="postgres15" PYTHON_SINGLE_TARGET="python3_11" PYTHON_TARGETS="python3_11" RUBY_TARGETS="ruby31" VIDEO_CARDS="intel i965 nvidia" 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:  ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, RANLIB, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-13 01:51:44 UTC
Can you reproduce this in a clean chroot (can do it in e.g. /tmp or /opt or whatever)? If so, could you give the steps to do so?
Comment 4 Zac Medico gentoo-dev 2023-11-13 18:16:27 UTC
This could be something about the depgraph asap_nodes logic which is used for PDEPEND, since gzip has a PDEPEND on app-alternatives/gzip.
Comment 5 Zac Medico gentoo-dev 2023-11-13 18:46:31 UTC
It might have been find_smallest_cycle operating on asap_nodes that did it.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-15 05:42:04 UTC
What we could really do with is the merge order of the emerge which failed. I don't suppose you take snapshots of your system?
Comment 7 Benn Snyder 2023-11-15 13:55:07 UTC
I cloned a snapshot and replicated it in a chroot.  It only happens when sys-libs/zlib is included in the package list.  I can't share the snapshot because it contains private data, but I'll be happy to run further diagnostics upon request.


# USE="-reference pigz" emerge -pv app-alternatives/gzip sys-libs/zlib

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

Calculating dependencies... done!
Dependency resolution took 11.76 s.

[ebuild     U  ] app-alternatives/gzip-1::gentoo [0::gentoo] USE="pigz* -reference* (-split-usr)" 0 KiB
[ebuild     U  ] sys-libs/zlib-1.3-r1:0/1::gentoo [1.2.13-r2:0/1::gentoo] USE="minizip (-split-usr) -static-libs -verify-sig" ABI_X86="32 (64) (-x32)" 0 KiB
[ebuild  N     ] app-arch/pigz-2.8::gentoo  USE="-static -test -verify-sig" 0 KiB

Total: 3 packages (2 upgrades, 1 new), Size of downloads: 0 KiB
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-15 13:57:28 UTC
(In reply to Benn Snyder from comment #7)
> I cloned a snapshot and replicated it in a chroot.  It only happens when
> sys-libs/zlib is included in the package list. 

I think I might go buy a lottery ticket!

Earlier: https://github.com/gentoo/portage/pull/1182#discussion_r1393663504.

> I can't share the snapshot
> because it contains private data, but I'll be happy to run further
> diagnostics upon request.
> 

Thanks. I'll see if Zac wants anything or if the below is enough to tweak the test to reproduce it. If not, we can definitely just get the information we need by questions/output, no need to share the full thing.
Comment 9 Zac Medico gentoo-dev 2023-11-17 04:45:05 UTC
Created attachment 874912 [details]
runtime cycle digraph (64 nodes)

(In reply to Benn Snyder from comment #7)
> # USE="-reference pigz" emerge -pv app-alternatives/gzip sys-libs/zlib
> 
> These are the packages that would be merged, in order:
> 
> Calculating dependencies... done!
> Dependency resolution took 11.76 s.
> 
> [ebuild     U  ] app-alternatives/gzip-1::gentoo [0::gentoo] USE="pigz*
> -reference* (-split-usr)" 0 KiB
> [ebuild     U  ] sys-libs/zlib-1.3-r1:0/1::gentoo [1.2.13-r2:0/1::gentoo]
> USE="minizip (-split-usr) -static-libs -verify-sig" ABI_X86="32 (64) (-x32)"
> 0 KiB
> [ebuild  N     ] app-arch/pigz-2.8::gentoo  USE="-static -test -verify-sig"
> 0 KiB
> 
> Total: 3 packages (2 upgrades, 1 new), Size of downloads: 0 KiB

I've reproduced this locally, and it was triggered by the 64 package "cycle" in the attached debug log snippet. In this case the problem is that find_smallest_cycle selects too many packages, so my patch does not handle it.
Comment 10 Zac Medico gentoo-dev 2023-11-17 05:06:11 UTC
This fixed it by making the topological sort remove only one node at a time:

> diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py
> index 8d72c3241..1c99ade43 100644
> --- a/lib/_emerge/depgraph.py
> +++ b/lib/_emerge/depgraph.py
> @@ -9464,8 +9464,8 @@ class depgraph:
>                              ignore_priority=ignore_priority
>                          )
>                          if leaves:
> -                            cycle_digraph.difference_update(leaves)
> -                            selected_nodes.extend(leaves)
> +                            cycle_digraph.remove(leaves[0])
> +                            selected_nodes.append(leaves[0])
>                              break
>                      else:
>                          selected_nodes.extend(cycle_digraph)

I'll try some more to make my test case reproduce this.
Comment 11 Zac Medico gentoo-dev 2023-11-17 07:37:22 UTC
I have a test case that reproduces the bug with this cycle, and the patch from comment #10 doesn't fix it well enough:

runtime cycle digraph (9 nodes):

(app-alternatives/gzip-1:0/0::test_repo, ebuild scheduled for merge) depends on
  (app-arch/pigz-2.8:0/0::test_repo, ebuild scheduled for merge) (runtime)
(sys-libs/zlib-1.3-r1:0/1::test_repo, ebuild scheduled for merge) depends on
  (sys-devel/automake-1.16.5-r1:0/0::test_repo, installed) (buildtime)
(sys-devel/automake-1.16.5-r1:0/0::test_repo, installed) depends on
  (dev-lang/perl-5.36.1-r3:0/0::test_repo, installed) (runtime)
  (app-alternatives/gzip-1:0/0::test_repo, ebuild scheduled for merge) (optional)
(app-arch/pigz-2.8:0/0::test_repo, ebuild scheduled for merge) depends on
  (sys-libs/zlib-1.3-r1:0/1::test_repo, ebuild scheduled for merge) (buildtime)
  (app-alternatives/gzip-1:0/0::test_repo, ebuild scheduled for merge) (runtime_post)
(dev-lang/perl-5.36.1-r3:0/0::test_repo, installed) depends on
  (sys-libs/zlib-1.3-r1:0/1::test_repo, ebuild scheduled for merge) (runtime)
  (virtual/libcrypt-2-r1:0/2::test_repo, installed) (runtime)
(sys-libs/glibc-2.37-r7:0/0::test_repo, installed) depends on
  (dev-lang/perl-5.36.1-r3:0/0::test_repo, installed) (runtime)
  (sys-apps/locale-gen-2.23-r1:0/0::test_repo, installed) (runtime)
(sys-apps/locale-gen-2.23-r1:0/0::test_repo, installed) depends on
  (app-alternatives/gzip-1:0/0::test_repo, ebuild scheduled for merge) (runtime)
(virtual/libcrypt-2-r1:0/2::test_repo, installed) depends on
  (sys-libs/libxcrypt-4.4.36:0/0::test_repo, installed) (runtime)
(sys-libs/libxcrypt-4.4.36:0/0::test_repo, installed) depends on
  (sys-libs/glibc-2.37-r7:0/0::test_repo, installed) (runtime)

The topological sort selects app-alternatives/gzip-1 as part of a large group of leaves, and in my test case it's always first in that group, causing the test to fail because app-alternatives/gzip-1 happens to be leaves[0].
Comment 12 Zac Medico gentoo-dev 2023-11-17 08:04:57 UTC
The test case is in https://github.com/gentoo/portage/pull/1184. It seems like this can probably be fixed with finer-grained scoring as discussed in bug 754777.
Comment 13 Larry the Git Cow gentoo-dev 2023-11-18 01:16:13 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=1525b51fb1df477f8801470509e786558ab153dc

commit 1525b51fb1df477f8801470509e786558ab153dc
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-11-17 07:47:07 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-11-17 07:57:15 +0000

    Add test case to reproduce bug 917259
    
    Test bug 917259, where app-alternatives/gzip is upgraded
    before its pigz RDEPEND is installed. This is triggered
    when find_smallest_cycle selects a large cycle and the
    topological sort produces poor results when leaf_nodes returns
    app-alternatives/gzip as part of a large group of nodes.
    This problem might be solved by implementing a finer-grained
    ignore_priority for leaf_nodes calls.
    
    Bug: https://bugs.gentoo.org/917259
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/tests/resolver/meson.build             |   1 +
 .../tests/resolver/test_alternatives_gzip.py       | 248 +++++++++++++++++++++
 2 files changed, 249 insertions(+)
Comment 14 Zac Medico gentoo-dev 2023-11-18 05:37:55 UTC
This fixes the test case by causing it to increase ignore_priority in order to find a smaller cycle, but it breaks a circular DEPEND vs circular RDEPEND assertion ('app-misc/circ-buildtime-a-1', 'app-misc/circ-buildtime-c-1') in lib/portage/tests/resolver/test_merge_order.py:

> --- a/lib/_emerge/depgraph.py
> +++ b/lib/_emerge/depgraph.py
> @@ -9347,8 +9347,8 @@ class depgraph:
>  
>                          # Exit this loop with the lowest possible priority, which
>                          # minimizes the use of installed packages to break cycles.
> -                        if smallest_cycle is not None:
> -                            break
> +                        #if smallest_cycle is not None:
> +                        #    break
>  
>                      return smallest_cycle, ignore_priority
Comment 15 Zac Medico gentoo-dev 2023-11-18 07:19:22 UTC
Created attachment 875041 [details]
runtime cycle digraph (23 nodes)

I've tested the app-alternatives/gzip emerge command on my laptop's packages with https://github.com/gentoo/portage/pull/1185, and it solves the problem here. The size of the largest runtime cycle is down to 23 nodes with this patch, compared to 64 before. The app-alternatives/gzip package is no longer considered to be part of a runtime cycle.
Comment 16 Larry the Git Cow gentoo-dev 2023-11-19 17:55:58 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=9206d5a75ecd2d9ae0fe63e57d28aa8061b5927e

commit 9206d5a75ecd2d9ae0fe63e57d28aa8061b5927e
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-11-18 17:07:59 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-11-19 04:15:22 +0000

    find_smallest_cycle: Increase ignore_priority to find smaller cycles
    
    Fix AlternativesGzipTestCase by increasing ignore_priority in
    order to find smaller cycles. This causes some changes in merge
    order for MergeOrderTestCase, but they appear to be acceptable
    since they prevent temporarily unsatisfied RDEPEND by relying
    on satisfied installed build-time dependencies.
    
    Add a test case for bug 690436, since the change to merge order
    in MergeOrderTestCase is related (see commit 680276cc4d4f).
    
    Bug: https://bugs.gentoo.org/690436
    Bug: https://bugs.gentoo.org/917259
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/depgraph.py                            |   7 +-
 lib/portage/tests/resolver/meson.build             |   1 +
 .../tests/resolver/test_alternatives_gzip.py       |   7 +-
 lib/portage/tests/resolver/test_merge_order.py     |  24 ++--
 .../tests/resolver/test_rebuild_ghostscript.py     | 160 +++++++++++++++++++++
 5 files changed, 180 insertions(+), 19 deletions(-)
Comment 17 Larry the Git Cow gentoo-dev 2023-11-25 06:30:18 UTC
The bug has been referenced in the following commit(s):

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

commit cdc781349337fa755bc15773e2a87e4b41f5ff1e
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-11-22 21:46:12 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-11-22 22:26:13 +0000

    Revert "find_smallest_cycle: Increase ignore_priority to find smaller cycles"
    
    This reverts commit 9206d5a75ecd2d9ae0fe63e57d28aa8061b5927e.
    The len(smallest_cycle) == 1 loop termination condition is
    not optimal and it's too expensive as reported in bug 917660.
    
    Bug: https://bugs.gentoo.org/917660
    Bug: https://bugs.gentoo.org/917259
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/depgraph.py                            |  7 +++----
 .../tests/resolver/test_alternatives_gzip.py       |  7 +++++--
 lib/portage/tests/resolver/test_merge_order.py     | 24 ++++++++++------------
 .../tests/resolver/test_rebuild_ghostscript.py     |  6 +++---
 4 files changed, 22 insertions(+), 22 deletions(-)
Comment 18 Larry the Git Cow gentoo-dev 2023-11-28 22:42:17 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=3487594cd8f46a5c83caaab3a9425321443e5efc

commit 3487594cd8f46a5c83caaab3a9425321443e5efc
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-11-28 04:58:07 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-11-28 22:41:45 +0000

    Increase ignore_priority during topological sort for runtime cycle
    
    Fix AlternativesGzipTestCase by increasing ignore_priority in
    order to find smaller groups of leaf nodes during topological
    sort for runtime cycles. This causes some changes in merge
    order for MergeOrderTestCase, but they appear to be acceptable
    since they prevent temporarily unsatisfied RDEPEND by relying
    on satisfied installed build-time dependencies.
    
    Bug: https://bugs.gentoo.org/917259
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/depgraph.py                            | 27 ++++++++++++++++------
 .../tests/resolver/test_alternatives_gzip.py       |  8 +++----
 lib/portage/tests/resolver/test_merge_order.py     | 20 ++++++++--------
 .../tests/resolver/test_rebuild_ghostscript.py     |  2 +-
 4 files changed, 35 insertions(+), 22 deletions(-)
Comment 19 Larry the Git Cow gentoo-dev 2023-11-29 00:33:55 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=9823f70c6e4ef3cdd6abb4d9fc599ce02a138125

commit 9823f70c6e4ef3cdd6abb4d9fc599ce02a138125
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-11-28 23:58:23 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-11-29 00:00:18 +0000

    Prefer installed leaves in runtime cycle topological sort
    
    In order to avoid possibly merging a package too early, prefer
    installed leaves in runtime cycle topological sort. This fixes
    an AlternativesGzipTestCase failure that arose after 2e298ea7ba36
    caused leaves to be selected in a slightly different order.
    
    Bug: https://bugs.gentoo.org/917259
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/depgraph.py | 6 ++++++
 1 file changed, 6 insertions(+)
Comment 20 Larry the Git Cow gentoo-dev 2023-11-29 19:55:10 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=31832c7faf5bffde25a596ce62ecf84c478fac45

commit 31832c7faf5bffde25a596ce62ecf84c478fac45
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-11-29 16:14:27 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-11-29 16:33:18 +0000

    Optimize runtime cycle ignore_priority leaf selection loop for topological sort
    
    Since increasing ignore_priority can only lead to a larger
    selection of leaf nodes, there is no need to increase ignore_priority
    to search for smaller groups of leaf nodes.
    
    It was the "only harvest one node at a time" part of commit
    3487594cd8f4 that caused the test case to succeed.
    
    Fixes: 3487594cd8f4 ("Increase ignore_priority during topological sort for runtime cycle")
    Bug: https://bugs.gentoo.org/917259
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/depgraph.py                        | 31 ++++++++++----------------
 lib/portage/tests/resolver/test_merge_order.py |  8 +++----
 2 files changed, 16 insertions(+), 23 deletions(-)
Comment 21 Larry the Git Cow gentoo-dev 2023-12-01 03:03:31 UTC
The bug has been closed via the following commit(s):

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

commit baec60737ddc370dcf77ce1c797ff187357c4b14
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-12-01 02:54:12 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-12-01 02:54:29 +0000

    sys-apps/portage: add 3.0.56
    
    Closes: https://bugs.gentoo.org/760893
    Closes: https://bugs.gentoo.org/917033
    Closes: https://bugs.gentoo.org/917259
    Closes: https://bugs.gentoo.org/917315
    Closes: https://bugs.gentoo.org/918515
    Closes: https://bugs.gentoo.org/918682
    Closes: https://bugs.gentoo.org/918683
    Closes: https://bugs.gentoo.org/916977
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.56.ebuild | 238 +++++++++++++++++++++++++++++++++
 2 files changed, 239 insertions(+)
Comment 22 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-03 23:01:57 UTC
*** Bug 899606 has been marked as a duplicate of this bug. ***
Comment 23 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-03-03 23:02:05 UTC
*** Bug 899650 has been marked as a duplicate of this bug. ***