rpm-software-management / dnf

Package manager based on libdnf and libsolv. Replaces YUM.
GNU General Public License v2.0
1.24k stars 416 forks source link

Invalid repoquery --location output for EPEL 10 buildroots #2130

Closed praiskup closed 1 month ago

praiskup commented 1 month ago

Reproducer:

$ options=( --disablerepo '*' --enablerepo hell --repofrompath=hell,https://kojipkgs.fedoraproject.org/repos/epel10.0-build/latest/x86_64 repoquery --location )
$ dnf-3 "${options[@]}" | grep util-linux
Added hell repo from https://kojipkgs.fedoraproject.org/repos/epel10.0-build/latest/x86_64
Last metadata expiration check: 0:03:39 ago on po 16. září 2024, 13:51:44.
https://kojipkgs.fedoraproject.org/repos/epel10.0-build/latest/x86_64/Packages/util-linux-2.40.2-4.el10.x86_64.rpm
https://kojipkgs.fedoraproject.org/repos/epel10.0-build/latest/x86_64/Packages/util-linux-core-2.40.2-4.el10.x86_64.rpm

These are non-existing files ^^^, and dnf5 repoquery behaves correctly:

$ dnf5 "${options[@]}" | grep util-linux
https://infrastructure.fedoraproject.org/repo/centos/centos-10/BaseOS/x86_64/os/Packages/util-linux-2.40.2-4.el10.x86_64.rpm
https://infrastructure.fedoraproject.org/repo/centos/centos-10/BaseOS/x86_64/os/Packages/util-linux-core-2.40.2-4.el10.x86_64.rpm

Installed packages:

$ rpm -qa | grep -e libsolv -e dnf 
dnfdaemon-0.3.22-3.fc41.noarch
python3-dnfdaemon-0.3.22-3.fc41.noarch
dnf-plugin-diff-1.1-21.fc41.noarch
libsolv-0.7.30-1.fc41.x86_64
libdnf5-5.2.5.0-2.fc41.x86_64
libdnf-0.73.3-1.fc41.x86_64
python3-libdnf-0.73.3-1.fc41.x86_64
libdnf5-cli-5.2.5.0-2.fc41.x86_64
dnf5-5.2.5.0-2.fc41.x86_64
dnf-data-4.21.1-1.fc41.noarch
python3-dnf-4.21.1-1.fc41.noarch
python3-dnf-plugins-core-4.9.0-1.fc41.noarch
dnf-plugins-core-4.9.0-1.fc41.noarch
libsolv-devel-0.7.30-1.fc41.x86_64
libsolv-tools-base-0.7.30-1.fc41.x86_64
libsolv-tools-0.7.30-1.fc41.x86_64
libdnf-devel-0.73.3-1.fc41.x86_64
dnf-utils-4.9.0-1.fc41.noarch
python3-dnf-plugins-extras-common-4.1.2-3.fc41.noarch
dnf5-plugins-5.2.5.0-2.fc41.x86_64
python3-libdnf5-5.2.5.0-2.fc41.x86_64
libdnf-plugin-subscription-manager-1.29.41-1.fc41.x86_64
dnfdragora-2.1.5-7.fc41.noarch
dnfdaemon-selinux-0.3.22-3.fc41.noarch
m-blaha commented 1 month ago

The issue is valid. When printing remote locations of the package, dnf4 (unlike dnf5) does not take into account the base url from the repository metadata. This is how the location of the util-linux package looks like in metadata:

<location xml:base="https://infrastructure.fedoraproject.org/repo/centos/centos-10/BaseOS/x86_64/os" href="Packages/util-linux-2.40.2-4.el10.x86_64.rpm"/>

dnf5 correctly uses xml:base from the metadata, dnf4 ignores it and concatenates the href of the package with the url of the repository.

m-blaha commented 1 month ago

Here is part of the dnf5 code to get package's remote location: https://github.com/rpm-software-management/dnf5/blob/a1a66ce16363d46dbd7a02604b816e2ceeb74d0e/libdnf5/rpm/package.cpp#L350-L356

And this is the equivalent in dnf4 which does not take base url into account: https://github.com/rpm-software-management/dnf/blob/f519e602a70ce6d3494a9d9d70464187eb9c263e/dnf/package.py#L292-L303