Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-25005

DNF repo cost option is working the oposite way as described in man

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Normal Normal
    • rhel-9.5
    • CentOS Stream 8
    • dnf
    • dnf-4.14.0-10.el9
    • None
    • None
    • rhel-sst-cs-software-management
    • ssg_core_services
    • 10
    • 12
    • None
    • Yes
    • Red Hat Enterprise Linux
    • None
    • Bug Fix
    • Hide
      .`dnf reinstall` now respects a cost of the repositories when reinstalling a package

      Previously, if you reinstalled a package available in multiple repositories, the package was not reinstalled from a repository with the lowest cost. With this update, the DNF tool supplies packages from all repositories to a dependency solver if the packages have the equal `name-epoch-version-release-architecture` identifier. As a result, the `dnf reinstall` command now respects the cost of the repositories.
      Show
      .`dnf reinstall` now respects a cost of the repositories when reinstalling a package Previously, if you reinstalled a package available in multiple repositories, the package was not reinstalled from a repository with the lowest cost. With this update, the DNF tool supplies packages from all repositories to a dependency solver if the packages have the equal `name-epoch-version-release-architecture` identifier. As a result, the `dnf reinstall` command now respects the cost of the repositories.
    • Done
    • x86_64
    • None

      What were you trying to do that didn't work?

      According to DNF Configuration Reference (man dnf.conf), a repository with a lowest cost should be picked when the priorities are equal.

      cost integer
      The relative cost of accessing this repository, defaulting to 1000. This value is compared when the priorities of two repositories are the same. The repository with the lowest cost is picked. It is useful to make the library prefer on-disk repositories to remote ones.The relative cost of accessing this repository, defaulting to 1000. This value is compared when the priorities of two repositories are the same. The repository with the lowest cost is picked. It is useful to make the library prefer on-disk repositories to remote ones.

      However, DNF is picking the repository with the highest cost.

      Please provide the package NVR for which bug is seen:

      dnf-4.7.0-19

      How reproducible:

      Steps to reproduce

      1. Mirror a repo locally (I mirrored appstream)
      1. Create a local_appstream repo with a lower cost than default (1000)
        [local_appstream]
        name=Local CentOS Stream $releasever - AppStream
        baseurl=file:///dnf/CentOS8/appstream/
        gpgkey=file:///dnf/CentOS8/RPM-GPG-KEY-centosofficial
        gpgcheck=1
        enabled=1
        cost=900

        **
         

      1. Try to install a package available in appstream/local_appstream. DNF should pick the package from local_appstream (lowest cost), but picks it from appstream.
        [root@localhost ~]# dnf install wget
        Last metadata expiration check: 0:00:01 ago on Thu 16 Nov 2023 05:51:58 PM -03.
        Dependencies resolved.
        ==============================================================================================================================================================================================================
         Package                                    Architecture                                 Version                                                    Repository                                           Size
        ==============================================================================================================================================================================================================
        Reinstalling:
         wget                                       x86_64                                       1.19.5-11.el8                                           appstream                                       734 k
        
        Transaction Summary
        ==============================================================================================================================================================================================================
        
        Total download size: 734 k
        Installed size: 2.8 M
        Is this ok [y/N]: N
        Operation aborted.
      1. Change the cost of the local repo to a value higher than default.
      [local_appstream]
      name=Local CentOS Stream $releasever - AppStream
      baseurl=file:///dnf/CentOS8/appstream/
      gpgkey=file:///dnf/CentOS8/RPM-GPG-KEY-centosofficial
      gpgcheck=1
      enabled=1
      cost=1100

      **

      1. Try to install the same package. DNF now picks the package from local_appstream.
        [root@localhost ~]# dnf install wget
        Last metadata expiration check: 0:00:01 ago on Thu 16 Nov 2023 05:51:58 PM -03.
        Dependencies resolved.
        ==============================================================================================================================================================================================================
         Package                                   Architecture                                Version                                                 Repository                                                Size
        ==============================================================================================================================================================================================================
        Reinstalling:
         wget                                      x86_64                                      1.19.5-11.el8                                        local_appstream                                      734 k
        
        Transaction Summary
        ==============================================================================================================================================================================================================
        
        Total download size: 734 k
        Installed size: 2.8 M
        Is this ok [y/N]: N
        Operation aborted.

      Expected results

      DNF should treat the cost option as described in man documentation, or the documentation should be updated to reflect the software behaviour.

      Actual results

      DNF repo cost option is working the oposite way as described in man documentation.

              rhn-support-ppisar Petr Pisar
              gergelim Matheus Hernandes (Inactive)
              packaging-team-maint packaging-team-maint
              Eva Mrakova Eva Mrakova
              Mariya Pershina Mariya Pershina
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Created:
                Updated:
                Resolved: