Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 921333 - Wrong merge order with dev-qt/{qtcore,qtxmlpatterns} and kde-frameworks/syntax-highlighting
Summary: Wrong merge order with dev-qt/{qtcore,qtxmlpatterns} and kde-frameworks/synta...
Status: CONFIRMED
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: build-order 930802
  Show dependency tree
 
Reported: 2024-01-04 07:10 UTC by Sam James
Modified: 2024-04-28 00:32 UTC (History)
3 users (show)

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


Attachments
emerge -p -uvDU @world (file_921333.txt,29.93 KB, text/plain)
2024-01-04 07:11 UTC, Sam James
Details
emerge_debug.xz (emerge_debug.xz,598.98 KB, application/x-xz)
2024-01-04 07:13 UTC, Sam James
Details
diff of output before/after (file_921333.txt,1.57 KB, text/plain)
2024-01-05 02:40 UTC, Sam James
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-04 07:10:03 UTC
I had a kde-frameworks/syntax-highlighting build failure which ended with:
```
FAILED: bin/katehighlightingindexer
: && /usr/bin/x86_64-pc-linux-gnu-g++ -O2 -pipe -march=broadwell -mabm -maes --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=4096 -fdiagnostics-color=always -frecord-gcc-switches -ggdb3 -fno-operator-names -fno-exceptions -Wall -Wextra -Wcast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -Wundef -Wnon-virtual-dtor -Woverloaded-virtual -Werror=return-type -Werror=init-self -Werror=undef -Wvla -Wdate-time -Wsuggest-override -Wlogical-op -pedantic -Wzero-as-null-pointer-constant -Wmissing-include-dirs -fdiagnostics-color=always -Wl,--enable-new-dtags -O2 -pipe -march=broadwell -mabm -maes --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=4096 -fdiagnostics-color=always -frecord-gcc-switches -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs src/indexer/CMakeFiles/katehighlightingindexer.dir/katehighlightingindexer_autogen/mocs_compilation.cpp.o src/indexer/CMakeFiles/katehighlightingindexer.dir/katehighlightingindexer.cpp.o src/indexer/CMakeFiles/katehighlightingindexer.dir/__/lib/worddelimiters.cpp.o -o bin/katehighlightingindexer  /usr/lib64/libQt5XmlPatterns.so.5.15.10  /usr/lib64/libQt5Network.so.5.15.11  /usr/lib64/libQt5Core.so.5.15.11 && :
/usr/lib/gcc/x86_64-pc-linux-gnu/13/../../../../x86_64-pc-linux-gnu/bin/ld: /usr/lib64/libQt5XmlPatterns.so.5.15.10: undefined reference to `QXmlUtils::isChar(QChar)@Qt_5_PRIVATE_API'
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
```

It looks like dev-qt/qtcore-5.15.11-r1 was merged which invalidated dev-qt/qtxmlpatterns-5.15.10's RDEPEND, but kde-frameworks/syntax-highlighting got merged before dev-qt/qtxmlpatterns-5.15.11 was upgraded to.

(Unfortunately, I don't have a snapshot before this happened, and the binpkg client that consumes binpkgs from this chroot was at an older state and can't reproduce it on trying to update.)

----

# emerge --info
fatal: detected dubious ownership in repository at '/var/db/repos/gentoo'
To add an exception for this directory, call:

	git config --global --add safe.directory /var/db/repos/gentoo
Portage 3.0.60_p6 (python 3.11.5-final-0, default/linux/amd64/17.1/hardened, gcc-13, glibc-2.37-r7, 6.6.9 x86_64)
=================================================================
System uname: Linux-6.6.9-x86_64-AMD_Ryzen_9_3950X_16-Core_Processor-with-glibc2.37
KiB Mem:    65758036 total,   1442804 free
KiB Swap:   16662520 total,  16552952 free
Timestamp of repository gentoo: Thu, 04 Jan 2024 04:48:59 +0000
Timestamp of repository sam_c: Sat, 30 Dec 2023 16:32:01 +0000
Head commit of repository sam_c: 255eedbfc4b445af2ce1ea1ab03cc4544e604b96

sh bash 5.1_p16-r6
ld GNU ld (Gentoo 2.40 p5) 2.40.0
ccache version 4.8.3 [disabled]
app-misc/pax-utils:        1.3.5::gentoo
app-shells/bash:           5.1_p16-r6::gentoo
dev-java/java-config:      2.3.3-r1::gentoo
dev-lang/perl:             5.38.2-r1::gentoo
dev-lang/python:           3.11.5::gentoo
dev-lang/rust-bin:         1.71.1::gentoo
dev-util/ccache:           4.8.3::gentoo
dev-util/cmake:            3.27.7::gentoo
dev-util/meson:            1.3.1::gentoo
sys-apps/baselayout:       2.14-r1::gentoo
sys-apps/sandbox:          2.37::gentoo
sys-apps/systemd:          253.11::gentoo
sys-devel/autoconf:        2.71-r6::gentoo
sys-devel/automake:        1.16.5-r1::gentoo
sys-devel/binutils:        2.40-r5::gentoo, 2.41-r2::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/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/db/repos/gentoo
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/gentoo.git
    priority: -1000
    volatile: False
    sync-git-clone-extra-opts: -b stable -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 -c gc.rerereunresolved=0 -c gc.pruneExpire=now
    sync-git-verify-commit-signature: yes

local
    location: /var/db/repos/local
    masters: gentoo
    volatile: False

sam_c
    location: /var/db/repos/sam_c
    sync-type: git
    sync-uri: https://github.com/gentoo-mirror/sam_c.git
    masters: gentoo
    volatile: False

Installed sets: @emacs
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=broadwell -mabm -maes --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=4096 -fdiagnostics-color=always -frecord-gcc-switches"
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="-O2 -pipe -march=broadwell -mabm -maes --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=4096 -fdiagnostics-color=always -frecord-gcc-switches"
DISTDIR="/var/cache/distfiles"
EMERGE_DEFAULT_OPTS=" --jobs=1"
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="-O2 -pipe -march=broadwell -mabm -maes --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=4096 -fdiagnostics-color=always -frecord-gcc-switches"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance binpkg-signing buildpkg config-protect-if-modified distlocks ebuild-locks fixlafiles gpg-keepalive ipc-sandbox mount-sandbox multilib-strict network-sandbox news parallel-fetch parallel-install pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=broadwell -mabm -maes --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=4096 -fdiagnostics-color=always -frecord-gcc-switches"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="C.UTF8"
LDFLAGS="-O2 -pipe -march=broadwell -mabm -maes --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=4096 -fdiagnostics-color=always -frecord-gcc-switches -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,--defsym=__gentoo_check_ldflags__=0 -Wl,-z,pack-relative-relocs"
LEX="flex"
LINGUAS="en en_GB"
MAKEOPTS="-j32 -l32"
PKGDIR="/var/cache/binpkgs"
PORTAGE_COMPRESS="xz"
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 target-cpu=broadwell -C link-arg=-Wl,-z,pack-relative-relocs"
SHELL="/bin/bash"
USE="X a52 aac acl acpi activities aes alsa amd64 avx avx2 bluetooth branding bzip2 cairo caps cdda cdr cet cli crypt dbus declarative dist-kernel dri dts dvd dvdr emacs encode exif f16c flac fma3 fortran gdbm gif gles2 gmp graphite gtk gui hardened hunspell iconv icu ipv6 iwd jit jpeg kde kwallet lcms libnotify libtirpc mad mmx mmxext mng modules-compress mp3 mp4 mpeg multilib ncurses networkmanager nptl ogg opengl openmp pam pango pclmul pcre pdf pic pie pipewire plasma png policykit popcnt ppds pulseaudio qml qt5 rdrand readline screencast sdl seccomp semantic-desktop smartcard sound spell sse sse2 sse3 sse4_1 sse4_2 ssl ssp ssse3 startup-notification svg system-av1 system-binutils system-boost system-bootstrap system-cairo system-clang system-digest system-ffmpeg system-harfbuzz system-heimdal system-icu system-jpeg system-jsoncpp system-leveldb system-libevent system-libs system-libvpx system-libyaml system-lz4 system-mitkrb5 system-sqlite system-ssl system-tbb system-uulib system-webp system-zlib systemd test-rust threads tiff truetype udev udisks unicode upower usb verify-sig vorbis vulkan wayland widgets x264 xattr xcb xft xml xtpax xv xvid zlib" ABI_X86="64" ADA_TARGET="gnat_2021" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio 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 ntrip navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="efi-64" INPUT_DEVICES="libinput" KERNEL="linux" L10N="en en-GB" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" 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" QEMU_SOFTMMU_TARGETS="x86_64 aarch64 arm" QEMU_USER_TARGETS="x86_64 aarch64 arm" RUBY_TARGETS="ruby31" VIDEO_CARDS="intel i965 iris" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto 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_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, SIZE, STRINGS, STRIP, YACC, YFLAGS
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-04 07:11:55 UTC
Created attachment 881450 [details]
emerge -p -uvDU @world

If I re-run emerge -p -uvDU @world, I get kde-frameworks/syntax-highlighted queued still, rather than dev-qt/qtxmlpatterns first:
```
$ emerge -p -uvDU @world

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

Calculating dependencies  ... done!
Dependency resolution took 22.39 s (backtrack: 1/20).

[ebuild     U  ] kde-frameworks/syntax-highlighting-5.113.0:5/5.113::gentoo [5.110.0:5/5.110::gentoo] USE="-debug -doc -test" 0 KiB
[...]
[ebuild     U  ] dev-qt/qtgui-5.15.11-r2:5/5.15.11::gentoo [5.15.10-r2:5/5.15.10::gentoo] USE="X accessibility* dbus egl jpeg libinput png udev vulkan wayland -debug -eglfs -evdev -gles2-only -ibus -linuxfb -test -tslib -tuio -vnc" 0 KiB
[ebuild     U  ] dev-qt/qtwayland-5.15.11-r1:5/5.15.11::gentoo [5.15.10-r6:5/5.15.10::gentoo] USE="-compositor% -debug -test (-X%*) (-vulkan%*)" 0 KiB
[ebuild     U  ] dev-qt/qtwidgets-5.15.11-r1:5/5.15::gentoo [5.15.10-r3:5/5.15::gentoo] USE="X dbus gtk png -debug -gles2-only -test" 0 KiB
[ebuild     U  ] dev-qt/qtx11extras-5.15.11:5/5.15::gentoo [5.15.10:5/5.15::gentoo] USE="-debug -test" 0 KiB
[ebuild     U  ] kde-plasma/kwayland-5.113.0:5/5.113::gentoo [5.110.0:5/5.110::gentoo] USE="-debug -doc -test" 0 KiB
[ebuild     U  ] dev-qt/qtdeclarative-5.15.11-r2:5/5.15::gentoo [5.15.10-r3:5/5.15::gentoo] USE="jit vulkan widgets -debug -gles2-only -localstorage -test" 0 KiB
[ebuild     U  ] kde-frameworks/kguiaddons-5.113.0:5/5.113::gentoo [5.110.0:5/5.110::gentoo] USE="X dbus wayland -debug -doc (-kf6compat) -test" 0 KiB
[ebuild     U  ] dev-qt/qtsvg-5.15.11:5/5.15::gentoo [5.15.10:5/5.15::gentoo] USE="-debug -test" 0 KiB
[ebuild     U  ] kde-plasma/kwayland-integration-5.27.10:5::gentoo [5.27.8:5::gentoo] USE="-debug" 0 KiB
[ebuild     U  ] dev-qt/qtprintsupport-5.15.11:5/5.15::gentoo [5.15.10:5/5.15::gentoo] USE="cups -debug -gles2-only -test" 0 KiB
[ebuild     U  ] kde-frameworks/kidletime-5.113.0:5/5.113::gentoo [5.110.0:5/5.110::gentoo] USE="X wayland -debug -doc -xscreensaver" 0 KiB
[ebuild     U  ] dev-qt/qtopengl-5.15.11:5/5.15::gentoo [5.15.10:5/5.15::gentoo] USE="-debug -gles2-only -test" 0 KiB
[ebuild     U  ] kde-apps/kate-23.08.3:5::gentoo [23.04.3:5::gentoo] USE="-debug -handbook" 0 KiB
[ebuild     U  ] kde-frameworks/kconfigwidgets-5.113.0:5/5.113::gentoo [5.110.0:5/5.110::gentoo] USE="man -debug -designer -doc -test" 0 KiB
[ebuild     U  ] dev-qt/linguist-tools-5.15.11:5::gentoo [5.15.10:5::gentoo] USE="qml -debug -test" 0 KiB
[ebuild     U  ] dev-qt/qtmultimedia-5.15.11:5/5.15::gentoo [5.15.10:5/5.15::gentoo] USE="alsa gstreamer* pulseaudio qml widgets -debug -gles2-only -openal -test" 0 KiB
[ebuild     U  ] dev-qt/qtgraphicaleffects-5.15.11:5::gentoo [5.15.10:5::gentoo] USE="-debug -test" 0 KiB
[ebuild     U  ] dev-qt/qtquickcontrols-5.15.11:5::gentoo [5.15.10:5::gentoo] USE="widgets -debug -test" 0 KiB
[ebuild     U  ] kde-plasma/layer-shell-qt-5.27.10:5::gentoo [5.27.8:5::gentoo] USE="-debug" 0 KiB
[ebuild  N     ] dev-qt/qtwebchannel-5.15.11:5/5.15::gentoo  USE="qml -debug -test" 0 KiB
[ebuild     U  ] dev-qt/designer-5.15.11:5/5.15::gentoo [5.15.10:5/5.15::gentoo] USE="declarative -debug -test" 0 KiB
[ebuild     U  ] dev-qt/qtxmlpatterns-5.15.11:5::gentoo [5.15.10:5::gentoo] USE="qml -debug -test" 0 KiB
[...]
```
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-04 07:13:49 UTC
Created attachment 881451 [details]
emerge_debug.xz

I was expecting to see a runtime cycle in the --debug output but there doesn't seem to be a relevant one.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-04 07:24:06 UTC
(In reply to Sam James from comment #2)
> Created attachment 881451 [details]
> emerge_debug.xz
> 
> I was expecting to see a runtime cycle in the --debug output but there
> doesn't seem to be a relevant one.

```
Parent:    (kde-frameworks/syntax-highlighting-5.113.0:5/5.113::gentoo, ebuild scheduled for merge)
Depstring: >=dev-qt/qtdeclarative-5.15.9:5 >=dev-qt/qtgui-5.15.9:5 >=dev-qt/qtnetwork-5.15.9:5 >=dev-qt/qtxmlpatterns-5.15.9:5 dev-qt/qtcore:5
Priority:  buildtime
Candidates: ['>=dev-qt/qtdeclarative-5.15.9:5', '>=dev-qt/qtgui-5.15.9:5', '>=dev-qt/qtnetwork-5.15.9:5', '>=dev-qt/qtxmlpatterns-5.15.9:5', 'dev-qt/qtcore:5']
   ebuild: dev-qt/qtxmlpatterns-5.15.11::gentoo

[...]

Child:         (dev-qt/qtxmlpatterns-5.15.11:5/5::gentoo, ebuild scheduled for merge) USE="qml -debug -test" ABI_X86="(64)"
Parent Dep:    >=dev-qt/qtxmlpatterns-5.15.9:5 required by (kde-frameworks/syntax-highlighting-5.113.0:5/5.113::gentoo, ebuild scheduled for merge)

Exiting... (kde-frameworks/syntax-highlighting-5.113.0:5/5.113::gentoo, ebuild scheduled for merge)
```

and
```
(kde-frameworks/syntax-highlighting-5.113.0:5/5.113::gentoo, ebuild scheduled for merge) depends on
  (dev-qt/qtdeclarative-5.15.11-r2:5/5.15::gentoo, ebuild scheduled for merge) (buildtime)
  (dev-qt/qtgui-5.15.11-r2:5/5.15.11::gentoo, ebuild scheduled for merge) (buildtime)
  (dev-qt/qtnetwork-5.15.11-1:5/5.15::gentoo, installed) (buildtime)
  (kde-frameworks/kf-env-5-2:5/5::gentoo, installed) (runtime)
  (dev-qt/qtcore-5.15.11-r1-1:5/5.15.11::gentoo, installed) (buildtime)
  (dev-qt/qtxmlpatterns-5.15.11:5/5::gentoo, ebuild scheduled for merge) (buildtime)
  (dev-lang/perl-5.38.2-r1-1:0/5.38::gentoo, installed) (buildtime)
  (dev-qt/linguist-tools-5.15.11:5/5::gentoo, ebuild scheduled for merge) (buildtime)
  (app-alternatives/ninja-1-1:0/0::gentoo, installed) (buildtime)
  (dev-util/cmake-3.27.7-1:0/0::gentoo, installed) (buildtime)
  (dev-libs/libpcre2-10.42-r1-3:0/3::gentoo, installed) (buildtime)
  (kde-frameworks/extra-cmake-modules-5.113.0-1:0/0::gentoo, installed) (buildtime)
(dev-qt/qtxmlpatterns-5.15.11:5/5::gentoo, ebuild scheduled for merge) depends on
  (dev-qt/qtcore-5.15.11-r1-1:5/5.15.11::gentoo, installed) (buildtime)
  (dev-qt/qtnetwork-5.15.11-1:5/5.15::gentoo, installed) (buildtime)
  (dev-qt/qtdeclarative-5.15.11-r2:5/5.15::gentoo, ebuild scheduled for merge) (buildtime)
  (dev-lang/perl-5.38.2-r1-1:0/5.38::gentoo, installed) (buildtime)
  (virtual/pkgconfig-2-r1-2:0/0::gentoo, installed) (buildtime)
```
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-04 09:43:22 UTC
Came up on the forums too at https://forums.gentoo.org/viewtopic-t-1166369.html.

Not been able to make my testcase reproduce it yet.
Comment 5 Zac Medico gentoo-dev 2024-01-04 22:20:59 UTC
(In reply to Sam James from comment #2)
> Created attachment 881451 [details]
> emerge_debug.xz

The log shows a bunch of single node runtime cycles like this, so find_smallest_cycle is definitely misbehaving:

runtime cycle digraph (1 nodes):

(kde-frameworks/syntax-highlighting-5.113.0:5/5.113::gentoo, ebuild scheduled for merge) (no children)

runtime cycle leaf: (kde-frameworks/syntax-highlighting-5.113.0:5/5.113::gentoo, ebuild scheduled for merge)
Comment 6 Zac Medico gentoo-dev 2024-01-04 23:26:42 UTC
Can you test https://github.com/gentoo/portage/pull/1229 to see if that helps? Maybe it's not the best fix, but it might suffice until we come up with a better way to make find_smallest_cycle behave.
Comment 7 Zac Medico gentoo-dev 2024-01-04 23:46:57 UTC
Using a stage3 I found these cycles related to your USE=emacs setting:

 * Error: circular dependencies:

(dev-util/desktop-file-utils-0.27:0/0::gentoo, ebuild scheduled for merge) depends on
 (app-editors/emacs-29.1-r6:29/29::gentoo, ebuild scheduled for merge) (buildtime)
  (x11-libs/gtk+-3.24.38:3/3::gentoo, ebuild scheduled for merge) (buildtime)
   (dev-util/desktop-file-utils-0.27:0/0::gentoo, ebuild scheduled for merge) (runtime)

It might be possible to break this cycle
by applying any of the following changes:
- dev-util/desktop-file-utils-0.27 (Change USE: -emacs)
- app-editors/emacs-29.1-r6 (Change USE: -gui)
- app-editors/emacs-29.1-r6 (Change USE: -gtk)

(dev-util/ninja-1.11.1-r3:0/0::gentoo, ebuild scheduled for merge) depends on
 (app-editors/emacs-29.1-r6:29/29::gentoo, ebuild scheduled for merge) (runtime)
  (media-libs/lcms-2.15:2/2::gentoo, ebuild scheduled for merge) (buildtime)
   (app-alternatives/ninja-1:0/0::gentoo, ebuild scheduled for merge) (buildtime)
    (dev-util/ninja-1.11.1-r3:0/0::gentoo, ebuild scheduled for merge) (runtime)

It might be possible to break this cycle
by applying any of the following changes:
- app-alternatives/ninja-1 (Change USE: +samurai -reference)
- dev-util/ninja-1.11.1-r3 (Change USE: -emacs)
- app-editors/emacs-29.1-r6 (Change USE: -lcms)

(gnome-base/librsvg-2.56.3:2/2::gentoo, ebuild scheduled for merge) depends on
 (dev-util/desktop-file-utils-0.27:0/0::gentoo, ebuild scheduled for merge) (runtime)
  (app-editors/emacs-29.1-r6:29/29::gentoo, ebuild scheduled for merge) (buildtime)
   (gnome-base/librsvg-2.56.3:2/2::gentoo, ebuild scheduled for merge) (buildtime)

It might be possible to break this cycle
by applying any of the following changes:
- app-editors/emacs-29.1-r6 (Change USE: -svg)
- app-editors/emacs-29.1-r6 (Change USE: -gui)
- dev-util/desktop-file-utils-0.27 (Change USE: -emacs)
Comment 8 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-05 02:40:15 UTC
Created attachment 881487 [details]
diff of output before/after

(In reply to Zac Medico from comment #6)
> Can you test https://github.com/gentoo/portage/pull/1229 to see if that
> helps? Maybe it's not the best fix, but it might suffice until we come up
> with a better way to make find_smallest_cycle behave.

Unfortunately no meaningful difference I think.
Comment 9 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-05 02:45:52 UTC
(if needed I can probably give ssh to a container with the same env or tarball it up, but obv. it'll be big)
Comment 10 Larry the Git Cow gentoo-dev 2024-01-05 09:39:14 UTC
The bug has been referenced in the following commit(s):

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

commit b5340fc8a3a71cca6161fddfbcf9db982965b7ee
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-01-05 09:38:32 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-01-05 09:38:32 +0000

    dev-util/desktop-file-utils: move Emacs files to app-emacs/desktop-entry-mode
    
    Bug: https://bugs.gentoo.org/921333
    Signed-off-by: Sam James <sam@gentoo.org>

 .../desktop-file-utils-0.27-r1.ebuild              | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

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

commit 50a7f72871ffc4a535cf555aaf49ce95eb67d710
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-01-05 09:35:57 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-01-05 09:37:20 +0000

    app-emacs/desktop-entry-mode: new package split out from dev-util/desktop-file-utils[emacs], add 0.27
    
    Split out from dev-util/desktop-file-utils[emacs] to help break a circular dep
    with USE=emacs:
    ```
    (dev-util/desktop-file-utils-0.27:0/0::gentoo, ebuild scheduled for merge) depends on
     (app-editors/emacs-29.1-r6:29/29::gentoo, ebuild scheduled for merge) (buildtime)
      (x11-libs/gtk+-3.24.38:3/3::gentoo, ebuild scheduled for merge) (buildtime)
       (dev-util/desktop-file-utils-0.27:0/0::gentoo, ebuild scheduled for merge) (runtime)
    
    It might be possible to break this cycle
    by applying any of the following changes:
    - dev-util/desktop-file-utils-0.27 (Change USE: -emacs)
    - app-editors/emacs-29.1-r6 (Change USE: -gui)
    - app-editors/emacs-29.1-r6 (Change USE: -gtk)
    ```
    
    Bug: https://bugs.gentoo.org/921333
    Signed-off-by: Sam James <sam@gentoo.org>

 app-emacs/desktop-entry-mode/Manifest              |  1 +
 .../desktop-entry-mode-0.27.ebuild                 | 24 ++++++++++++++++++++++
 .../files/50desktop-entry-mode-gentoo.el           |  5 +++++
 app-emacs/desktop-entry-mode/metadata.xml          | 13 ++++++++++++
 4 files changed, 43 insertions(+)

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

commit aac64dad7bd5e8e6fcc4e63baff0f54807712280
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-01-05 09:11:36 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-01-05 09:37:19 +0000

    dev-util/ninja: move Emacs files to app-emacs/ninja-mode
    
    Bug: https://bugs.gentoo.org/921333
    Signed-off-by: Sam James <sam@gentoo.org>

 dev-util/ninja/ninja-1.11.1-r4.ebuild | 118 ++++++++++++++++++++++++++++++++++
 dev-util/ninja/ninja-9999.ebuild      |  25 ++-----
 2 files changed, 124 insertions(+), 19 deletions(-)

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

commit 4ff501f192595dcce7ca90809c1285bfadd8915b
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2024-01-05 09:09:28 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2024-01-05 09:37:12 +0000

    app-emacs/ninja-mode: new package split out from dev-util/ninja[emacs], add 1.11.1
    
    Split out from dev-util/ninja[emacs] to help break a circular dep
    with USE=emacs:
    ```
    (dev-util/ninja-1.11.1-r3:0/0::gentoo, ebuild scheduled for merge) depends on
     (app-editors/emacs-29.1-r6:29/29::gentoo, ebuild scheduled for merge) (runtime)
      (media-libs/lcms-2.15:2/2::gentoo, ebuild scheduled for merge) (buildtime)
       (app-alternatives/ninja-1:0/0::gentoo, ebuild scheduled for merge) (buildtime)
        (dev-util/ninja-1.11.1-r3:0/0::gentoo, ebuild scheduled for merge) (runtime)
    
    It might be possible to break this cycle
    by applying any of the following changes:
    - app-alternatives/ninja-1 (Change USE: +samurai -reference)
    - dev-util/ninja-1.11.1-r3 (Change USE: -emacs)
    - app-editors/emacs-29.1-r6 (Change USE: -lcms)
    ```
    
    Bug: https://bugs.gentoo.org/921333
    Signed-off-by: Sam James <sam@gentoo.org>

 app-emacs/ninja-mode/Manifest                 |  1 +
 app-emacs/ninja-mode/metadata.xml             | 18 ++++++++++++++++++
 app-emacs/ninja-mode/ninja-mode-1.11.1.ebuild | 19 +++++++++++++++++++
 3 files changed, 38 insertions(+)
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-05 10:06:56 UTC
(In reply to Larry the Git Cow from comment #10)
These don't seem to help as-is here (via just the ebuild metadata) but I don't want to merge them in case the bug goes away.
Comment 12 Zac Medico gentoo-dev 2024-01-05 16:36:24 UTC
Since kde-frameworks/syntax-highlighting actually has an soname dependency on libQt5XmlPatterns.so.5, changing its dev-qt/qtxmlpatterns dependency to a slot-operator dependency would be simple way to increase the dependency priority so that find_smallest_cycle will give a better result.

As it is, find_smallest_cycle sees a bunch of dependencies of similar priority, so it's not really clear which node to choose. If we increase he priority of a runtime + buildtime dep to be stronger than a plain buildtime dep, then it will provide some more contrast. However, we'll have to merge the DEPEND and RDEPEND DepPriority instances into a single instance that has both runtime and buildtime attributes set to True.
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-07 08:53:00 UTC
(In reply to Zac Medico from comment #12)
> Since kde-frameworks/syntax-highlighting actually has an soname dependency
> on libQt5XmlPatterns.so.5, changing its dev-qt/qtxmlpatterns dependency to a
> slot-operator dependency would be simple way to increase the dependency
> priority so that find_smallest_cycle will give a better result.
> 

dev-qt/* has by policy <subslot> meaning private ABI unfortunately..
Comment 14 Zac Medico gentoo-dev 2024-01-07 14:42:42 UTC
Now I've realized that since the "satisfied" attribute of the DepPriority can be an overriding factor in the find_smallest_cycle behavior, it is essential that we include a model for broken dependencies in the calculation of the "satisfied" attribute.
Comment 15 Zac Medico gentoo-dev 2024-01-07 21:57:40 UTC
In order to model the broken dependencies, we'll have to start by creating a dependency graph for the initial installed state (like emerge --depclean does), and then update the effective state after each package is selected for merge in the merge order calculation. The DepPriority "satisfied" attribute, instead of being a constant boolean, will be a dynamic object that is linked to the effective state of installed packages at a given moment during the merge order calculation.
Comment 16 Zac Medico gentoo-dev 2024-01-08 08:23:42 UTC
In https://github.com/gentoo/portage/pull/1231 I've extended the _calc_depclean function to support a new dep_check action that can be used to check for broken dependencies of installed packages.

Since it will be a lot of work to fully account for broken dependencies, it is tempting to first implement an approximate fix that only solves the problem for dependencies that are initially broken, and does not account for those that break as a result of the update process. However, maybe it's better to avoid this kind of approximation because it will not account for dependencies that become satisfied as a result of the update process, and can therefore trigger "false positive" circular dependency errors.
Comment 17 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-08 08:30:05 UTC
(In reply to Zac Medico from comment #16)
> In https://github.com/gentoo/portage/pull/1231 I've extended the
> _calc_depclean function to support a new dep_check action that can be used
> to check for broken dependencies of installed packages.
> 
> Since it will be a lot of work to fully account for broken dependencies, it
> is tempting to first implement an approximate fix that only solves the
> problem for dependencies that are initially broken, and does not account for
> those that break as a result of the update process.

i.e. that'd fix the 'resume' case, but not the original breakage (which I wasn't able to capture)?

The problem is that the larger the depgraph, the more likely things will go wrong, and with large upgrades where python-exec changes USE flags for example, resuming isn't always possible (your 'emerge' gets bricked partway through).

> However, maybe it's
> better to avoid this kind of approximation because it will not account for
> dependencies that become satisfied as a result of the update process, and
> can therefore trigger "false positive" circular dependency errors.

Could you elaborate on that last bit? I don't get yet when they'd show up
Comment 18 Zac Medico gentoo-dev 2024-01-08 08:50:14 UTC
(In reply to Sam James from comment #17)
> > However, maybe it's
> > better to avoid this kind of approximation because it will not account for
> > dependencies that become satisfied as a result of the update process, and
> > can therefore trigger "false positive" circular dependency errors.
> 
> Could you elaborate on that last bit? I don't get yet when they'd show up

Suppose that you unmerge sys-devel/llvm as a way to trigger some breakage for testing purposes, and it breaks the corresponding dependency dev-lang/rust.

Then suppose that you have USE=system-bootstrap enabled for dev-lang/rust, and you have masked dev-lang/rust-bin. Now if you try to perform a world update, and we have some approximate logic that says your installed dev-lang/rust is broken and can't satisfy dependencies, then you'll get a "false positive" circular dependency error if a new version of dev-lang/rust is pulled in. The approximation does not account for the fact that your installed dev-lang/rust becomes un-broken as soon as the world update installs your missing sys-devel/llvm package. On the bright side, circular dependency backtracking might temporarily mask the dev-lang/rust update, allowing a successful calculation that installs sys-devel/llvm and un-breaks dev-lang/rust.
Comment 19 Larry the Git Cow gentoo-dev 2024-01-08 08:58:34 UTC
The bug has been referenced in the following commit(s):

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

commit 4b885b9ca063c990b1e218c73a786e9d434717e8
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2024-01-08 06:04:37 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2024-01-08 08:08:51 +0000

    _calc_depclean: add dep_check action
    
    Add a dep_check action which can be used to check the
    dependencies of all installed packages. The plan is for depgraph
    to use this action to check for broken dependencies prior to the
    merge order calculation. The new frozen_config parameter will
    allow depgraph to pass a shared frozen config to _calc_depclean.
    
    The result of the dep_check action becomes stale as soon as there
    is any change to the installed packages. So, in order to account
    for dependencies that may become broken or satisfied during the
    process of updating installed packages, the merge order
    calculation will need to refresh the dep_check calculation for
    every merge order choice that it makes. This refresh will need
    to be optimized to identify the portion of the graph that would
    become stale due to a given change, so that it can avoid
    unnecessary repetition of work.
    
    Bug: https://bugs.gentoo.org/921333
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/actions.py                           | 21 ++++++-
 lib/_emerge/depgraph.py                          |  7 ++-
 lib/portage/tests/resolver/ResolverPlayground.py | 43 ++++++++++++--
 lib/portage/tests/resolver/meson.build           |  1 +
 lib/portage/tests/resolver/test_broken_deps.py   | 76 ++++++++++++++++++++++++
 5 files changed, 138 insertions(+), 10 deletions(-)
Comment 20 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-01-08 09:16:55 UTC
(In reply to Zac Medico from comment #18)
(thanks!)