Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 891137 - sys-apps/portage: doesn't merge repeated identical || (... ) any-of dependency blocks
Summary: sys-apps/portage: doesn't merge repeated identical || (... ) any-of dependenc...
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:
 
Reported: 2023-01-16 16:03 UTC by Sam James
Modified: 2023-01-17 11:39 UTC (History)
4 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 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-01-16 16:03:01 UTC
See https://forums.gentoo.org/viewtopic-t-1160727.html and bug 891133.

Portage ends up having extremely slow performance with repeated identical any-of || ( ...) blocks:
```
$ diff -ruN ed-1.{18,19}
--- ed-1.18	2023-01-13 08:28:35.632365180 +0000
+++ ed-1.19	2023-01-13 08:29:28.822655700 +0000
@@ -1,13 +1,13 @@
-BDEPEND=sys-apps/texinfo || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip app-arch/pdlzip app-arch/lzip ) || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip app-arch/pdlzip app-arch/lzip ) || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip app-arch/pdlzip app-arch/lzip ) || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip app-arch/pdlzip app-arch/lzip ) || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip app-arch/pdlzip app-arch/lzip ) verify-sig? ( sec-keys/openpgp-keys-antoniodiazdiaz ) verify-sig? ( app-crypt/gnupg >=app-portage/gemato-16 )
+BDEPEND=sys-apps/texinfo || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip app-arch/pdlzip app-arch/lzip ) || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip app-arch/pdlzip app-arch/lzip ) || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip app-arch/pdlzip app-arch/lzip ) || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip app-arch/pdlzip app-arch/lzip ) || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip app-arch/pdlzip app-arch/lzip ) || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip app-arch/pdlzip app-arch/lzip ) || ( >=app-arch/xz-utils-5.4.0 app-arch/plzip app-arch/pdlzip app-arch/lzip ) verify-sig? ( sec-keys/openpgp-keys-antoniodiazdiaz ) verify-sig? ( app-crypt/gnupg >=app-portage/gemato-16 )
 DEFINED_PHASES=configure unpack
 DESCRIPTION=Your basic line editor
-EAPI=7
+EAPI=8
 HOMEPAGE=https://www.gnu.org/software/ed/
-INHERIT=toolchain-funcs unpacker verify-sig
+INHERIT=edo toolchain-funcs unpacker verify-sig
 IUSE=verify-sig
-KEYWORDS=~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris
+KEYWORDS=~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris
 LICENSE=GPL-2+
 SLOT=0
-SRC_URI=mirror://gnu/ed/ed-1.18.tar.lz verify-sig? ( mirror://gnu/ed/ed-1.18.tar.lz.sig )
-_eclasses_=toolchain-funcs	ec8bbc28394c7305b43ea07164bd8f5f	multilib	5ca4e49abed8e3a2f7b56920eadee157	multiprocessing	b4e253ab22cef7b1085e9b67c7a3b730	unpacker	8bbea377a8dd2b5d5c8bc0d834ae6157	verify-sig	afb98fe4696292e4234ce36713fd4e9e
-_md5_=bf63ad1b4806a01a7000e3fe6ce90271
+SRC_URI=mirror://gnu/ed/ed-1.19.tar.lz https://download.savannah.gnu.org/releases/ed/ed-1.19.tar.lz verify-sig? ( mirror://gnu/ed/ed-1.19.tar.lz.sig https://download.savannah.gnu.org/releases/ed/ed-1.19.tar.lz.sig )
+_eclasses_=edo	c0eb9cbe6b0bd01fcb4918f12598a4d3	toolchain-funcs	ec8bbc28394c7305b43ea07164bd8f5f	multilib	5ca4e49abed8e3a2f7b56920eadee157	multiprocessing	b4e253ab22cef7b1085e9b67c7a3b730	unpacker	8bbea377a8dd2b5d5c8bc0d834ae6157	verify-sig	afb98fe4696292e4234ce36713fd4e9e
+_md5_=3f460bcb7087cbbadf886cad16e886c9
```

With bad ed:
```
$ emerge -v1 -p sys-apps/ed
These are the packages that would be merged, in order:
Calculating dependencies... done!
Dependency resolution took 79.72 s.
[ebuild   R    ] sys-apps/ed-1.19::gentoo  USE="verify-sig" 0 KiB
Total: 1 package (1 reinstall), Size of downloads: 0 KiB
```

With good ed, it takes <7s.
Comment 1 Larry the Git Cow gentoo-dev 2023-01-16 16:05:15 UTC
The bug has been referenced in the following commit(s):

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

commit 2575ec6caaa80ed8d3c9361312c797837c7c2ec3
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-01-16 16:04:22 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-01-16 16:05:08 +0000

    sys-apps/ed: workaround unpacker.eclass/Portage dep resolution bug
    
    1. unpacker_src_uri_depends doesn't flatten the deps (bug #891133) and emits
    several || ( ... ) blocks (4).
    
    2. Portage doesn't handle several repeated identical || ( ...) blocks correctly
    and takes ages to resolve (bug #891137). It should merge them together.
    
    Bug: https://bugs.gentoo.org/891137
    Bug: https://bugs.gentoo.org/891133
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/ed/{ed-1.19.ebuild => ed-1.19-r1.ebuild} | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)