Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 918683 - Portage doesn't install net-misc/curl dependencies with binpkgs
Summary: Portage doesn't install net-misc/curl dependencies with binpkgs
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
Depends on: 916977
Blocks: gentoo-binhost
  Show dependency tree
 
Reported: 2023-11-28 04:25 UTC by Sam James
Modified: 2023-12-05 16:39 UTC (History)
1 user (show)

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


Attachments
bug.sh (file_918683.txt,3.46 KB, text/plain)
2023-11-28 04:25 UTC, Sam James
Details
log.txt.xz (log.txt.xz,44.01 KB, application/x-xz)
2023-11-28 04:34 UTC, Sam James
Details
bug.sh (file_918683.txt,1.40 KB, text/plain)
2023-11-28 04:39 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 2023-11-28 04:25:51 UTC
Created attachment 875858 [details]
bug.sh

I've been trying to add a Gentoo image to Meson's CI but the build keeps failing [0] with a broken curl:
"""
#10 1670.3 /usr/bin/x86_64-pc-linux-gnu-g++ -O2 -pipe -Wl,-O1 -Wl,--as-needed CMakeFiles/cmake.dir/cmakemain.cxx.o CMakeFiles/cmake.dir/cmcmd.cxx.o -o ../bin/cmake  libCMakeLib.a ../Utilities/std/libcmstd.a kwsys/libcmsys.a -ldl /usr/lib64/libcurl.so /usr/lib64/libexpat.so /usr/lib64/libjsoncpp.so /usr/lib64/libarchive.so /usr/lib64/librhash.so /usr/lib64/libuv.so /usr/lib64/libz.so 
#10 1670.3 /usr/libexec/gcc/x86_64-pc-linux-gnu/ld: warning: libnghttp2.so.14, needed by /usr/lib64/libcurl.so, not found (try using -rpath or -rpath-link)
#10 1670.3 /usr/libexec/gcc/x86_64-pc-linux-gnu/ld: /usr/lib64/libcurl.so: undefined reference to `nghttp2_http2_strerror'
#10 1670.3 /usr/libexec/gcc/x86_64-pc-linux-gnu/ld: /usr/lib64/libcurl.so: undefined reference to `nghttp2_session_del'
#10 1670.3 /usr/libexec/gcc/x86_64-pc-linux-gnu/ld: /usr/lib64/libcurl.so: undefined reference to `nghttp2_session_get_remote_settings'
[...]
"""

net-misc/curl gets merged (binary), then dev-util/cmake gets bulit (from source) which fails because one of the built curl's dependencies (net-libs/nghttp2) is missing.

The build script is using the new binhost where all of the entries in Packages for net-misc/curl have nghttp2 as a dependency, so I don't think it's an automagic dep issue.

I think Portage might be being confused by a cycle of cmake->curl->nghttp2->cmake, although we can see it used a net-misc/curl binary in the full log [1], so that theory might be wrong.

To reproduce it, I've just had this work locally:
```
$ docker run -it gentoo/stage3:desktop bash
$ bash bug.sh # (attached)
```

[0] https://github.com/thesamesam/meson/actions/runs/6999284651/job/19038382546#step:4:3311
[1] https://pipelinesghubeus10.actions.githubusercontent.com/tcrinyu6wR4B6DX1StaPpYlvlpGKkoXQ6dlYwOJ5N50RN0gJ38/_apis/pipelines/1/runs/100/signedlogcontent/2?urlExpires=2023-11-28T03%3A53%3A51.8017185Z&urlSigningMethod=HMACV1&urlSignature=zAtWUpgivaUE8Y5OQMI6569ryVHEkI9hQJJ202j8Zto%3D
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-28 04:34:53 UTC
Created attachment 875859 [details]
log.txt.xz

sorry, the CI log expires (obvious from the url, doh), so use this attachment
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-28 04:39:56 UTC
Created attachment 875860 [details]
bug.sh

OK, made bug.sh a lot smaller.

The merge order is clearly wrong:
```
[binary   R   ] net-misc/iputils-20221126-r1-6
[binary   R   ] dev-db/sqlite-3.43.2-6
[binary   R   ] app-crypt/libb2-0.98.1-r3-1
[binary   R   ] sys-libs/pam-1.5.3-1
[binary   R   ] net-misc/curl-8.4.0-8
[ebuild     U ] dev-util/cmake-3.27.8 [3.26.5-r2]
[ebuild  N    ] net-libs/nghttp2-1.57.0
[binary   R   ] app-portage/portage-utils-0.96.1-9

 * IMPORTANT: 14 news items need reading for repository 'gentoo'.
 * Use eselect news read to view new items.
```
Comment 3 Eli Schwartz 2023-11-28 04:55:33 UTC
bleurgh, nghttp2 uses cmake to build.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-28 05:34:47 UTC
Testcase at https://github.com/gentoo/portage/pull/1193.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-28 05:36:52 UTC
We should consider the existing dev-util/cmake as sufficient for nghttp2 and instead do:
1. net-libs/nghttp2-1.57.0
2. net-misc/curl-8.4.0 (binary)
3. dev-util/cmake-3.27.8 (upgrade, we didn't need to do this first as we already had a CMake installed)
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-11-28 06:01:33 UTC
Zac, it looks like 9206d5a75ecd2d9ae0fe63e57d28aa8061b5927e ('find_smallest_cycle: Increase ignore_priority to find smaller cycles') helps here if I reapply it, but https://github.com/gentoo/portage/pull/1192 doesn't...
Comment 7 Larry the Git Cow gentoo-dev 2023-11-28 22:26:06 UTC
The bug has been referenced in the following commit(s):

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

commit 2e298ea7ba36801a1cfba6e4cbfc16a7c05ee73d
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-11-28 06:22:44 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-11-28 22:07:46 +0000

    DepPriority{Normal,Satisfied}Range: strengthen _ignore_runtime for runtime slot operators
    
    In the reported bug, net-misc/curl gets merged (binary), then dev-util/cmake gets
    bulit (from source) which fails because one of the built curl's dependencies
    (net-libs/nghttp2) is missing:
    ```
    [binary   R    ] net-misc/curl-8.4.0::test_repo  USE="http2%*" 0 KiB
    [ebuild     U  ] dev-util/cmake-3.27.8::test_repo [3.26.5-r2::test_repo] 0 KiB
    [ebuild  N     ] net-libs/nghttp2-1.57.0::test_repo  0 KiB
    ```
    
    Zac had the idea [0] of strengthening _ignore_runtime to consider runtime slot deps
    as well, so we now get:
    ```
    [ebuild     U  ] dev-util/cmake-3.27.8::test_repo [3.26.5-r2::test_repo] 0 KiB
    [ebuild  N     ] net-libs/nghttp2-1.57.0::test_repo  0 KiB
    [binary   R    ] net-misc/curl-8.4.0::test_repo  USE="http2%*" 0 KiB
    ```
    
    For DepPrioritySatisfiedRange, we now allow ignoring the dep if:
    * it's either a satisfied runtime slot dep, or it's not a runtime slot dep at all, and
    * the dep is satisfied or it's optional/not a build time dep.
    
    (i.e. we now prevent ignoring the slot dep unless it's satisfied.)
    
    For DepPriorityNormalRange, we now allow ignoring the dep if:
    * it's not a runtime slot dep, and
    * it's optional, or
    * it's not a buildtime dep.
    
    (i.e. we now prevent ignoring the slot dep.)
    
    We then realise we can't ignore curl's dep on nghttp2 and come up with a better order.
    
    [0] https://github.com/gentoo/portage/pull/1193#issuecomment-1829178126
    
    Bug: https://bugs.gentoo.org/918683
    Thanks-to: Zac Medico <zmedico@gentoo.org>
    Signed-off-by: Sam James <sam@gentoo.org>

 lib/_emerge/DepPriorityNormalRange.py                       |  8 +++++++-
 lib/_emerge/DepPrioritySatisfiedRange.py                    | 13 +++++++++++--
 .../tests/resolver/test_runtime_cycle_merge_order.py        |  9 ++++-----
 3 files changed, 22 insertions(+), 8 deletions(-)

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

commit 2b02d8f5495cd5004c294f87beb365fd490018bd
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-11-28 05:33:56 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-11-28 22:07:46 +0000

    tests: add runtime cycle test case with binpkgs
    
    In the reported bug, net-misc/curl gets merged (binary), then dev-util/cmake gets
    bulit (from source) which fails because one of the built curl's dependencies
    (net-libs/nghttp2) is missing:
    ```
    [binary   R    ] net-misc/curl-8.4.0::test_repo  USE="http2%*" 0 KiB
    [ebuild     U  ] dev-util/cmake-3.27.8::test_repo [3.26.5-r2::test_repo] 0 KiB
    [ebuild  N     ] net-libs/nghttp2-1.57.0::test_repo  0 KiB
    ```
    
    We should consider the existing dev-util/cmake as sufficient for nghttp2 and instead do:
    1. net-libs/nghttp2-1.57.0
    2. net-misc/curl-8.4.0 (binary)
    3. dev-util/cmake-3.27.8 (upgrade, we didn't need to do this first as we already had a CMake installed)
    
    Bug: https://bugs.gentoo.org/918683
    Signed-off-by: Sam James <sam@gentoo.org>

 .../resolver/test_runtime_cycle_merge_order.py     | 145 +++++++++++++++++++++
 1 file changed, 145 insertions(+)
Comment 8 Larry the Git Cow gentoo-dev 2023-11-29 19:56:43 UTC
The bug has been referenced in the following commit(s):

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

commit ec938c4599e3250d6fd38b9f381d57376bd66df6
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-11-29 15:57:09 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-11-29 19:56:19 +0000

    Account for runtime_slot_op in DepPriority sort for digraph.debug_print()
    
    Since 2e298ea7ba36, the digraph.debug_print() output may not
    display runtime_slot_op when appropriate, since it relies
    on DepPriority sort order to determine which priority is
    most relevant to display. Adjust DepPriority sort order to
    account for this, which makes the debug output for
    AlternativesGzipTestCase display runtime_slot_op where
    appropriate:
    
    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_slot_op)
    (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)
    
    Bug: https://bugs.gentoo.org/918683
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/_emerge/DepPriority.py | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
Comment 9 Larry the Git Cow gentoo-dev 2023-12-01 03:03:28 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(+)