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

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

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • rhel-10.0.beta
    • rhel-10.0.beta
    • dnf
    • dnf-4.20.0-1.el10
    • None
    • None
    • sst_cs_software_management
    • ssg_core_services
    • 18
    • 20
    • None
    • Dev ack
    • False
    • No
    • Red Hat Enterprise Linux
    • None
    • Release Note Not Required
    • Hide
      Cause: Reinstalling a package available in multiple repositories only differing in a cost.
      Consequence: The package is not reinstalled from a repository with the lowest cost.
      Fix: DNF tool was fixed to supply packages from all repositories to a dependency solver in case the packages have equal name-epoch-version-release-architecture identifier.
      Result: "dnf reinstall" now respects a cost of the repositories.
      Show
      Cause: Reinstalling a package available in multiple repositories only differing in a cost. Consequence: The package is not reinstalled from a repository with the lowest cost. Fix: DNF tool was fixed to supply packages from all repositories to a dependency solver in case the packages have equal name-epoch-version-release-architecture identifier. Result: "dnf reinstall" now respects a cost of the repositories.
    • Proposed
    • 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
            Tomas Bajer Tomas Bajer
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: