Bug 1793950

Summary: dnf shows different package count for appstream repository than what is specified in the repository metadata
Product: Red Hat Enterprise Linux 8 Reporter: Kaushik Sajjan Agarwal <kagarwal>
Component: dnfAssignee: Jaroslav Mracek <jmracek>
Status: CLOSED ERRATA QA Contact: Luca Berton <lberton>
Severity: high Docs Contact:
Priority: high    
Version: 8.1CC: amatej, james.antill, jblazek, kkohli, lberton, msunil, saydas, swm-qe
Target Milestone: rcKeywords: Triaged
Target Release: 8.0Flags: pm-rhel: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: dnf-4.2.17-1.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-04-28 16:49:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Kaushik Sajjan Agarwal 2020-01-22 10:41:10 UTC
Description of problem:
dnf shows different package count for appstream repository than what is specified in the repository metadata

Version-Release number of selected component (if applicable):
RHEL 8 and 8.1 i.e. when I set the release version of the system to 8 or 8.1 via subscription-manager command

How reproducible:
Always

Steps to Reproduce:
1. Register and subscribe an RHEL 8 host with Customer Portal.
2. Execute the following commands as displayed below:
   # subscription-manager release --set 8.1
   # rm -rf /var/cache/dnf/
   # dnf repolist -v
   # dnf makecache
   # cd /var/cache/dnf/rhel-8-for-x86_64-appstream-rpms-c3f9f3c2a72c7eef/repodata/
   # zcat b7a940a2fa344c1b956e00ff3458a9c5ee4ebea5bfac336e4ca3d5f7d06ee40a-primary.xml.gz | head | grep "metadata packages"
   # zgrep -c '<package ' b7a940a2fa344c1b956e00ff3458a9c5ee4ebea5bfac336e4ca3d5f7d06ee40a-primary.xml.gz


Actual results: 

1. dnf shows the package count as 8444:
   
---
Repo-id      : rhel-8-for-x86_64-appstream-rpms
Repo-name    : Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs)
Repo-revision: 1579574131
Repo-updated : Tue 21 Jan 2020 08:05:31 AM IST
Repo-pkgs    : 8,444
Repo-size    : 15 G
Repo-baseurl : https://cdn.redhat.com/content/dist/rhel8/8.1/x86_64/appstream/os
Repo-expire  : 86,400 second(s) (last: Wed 22 Jan 2020 03:01:17 PM IST)
Repo-filename: /etc/yum.repos.d/redhat.repo
---

2. But when I download the metadata, it shows a different count of packages inside metadata:

---
[root@rhel8-15 repodata]# zcat b7a940a2fa344c1b956e00ff3458a9c5ee4ebea5bfac336e4ca3d5f7d06ee40a-primary.xml.gz | head | grep "metadata packages"
<metadata packages="9234" xmlns="http://linux.duke.edu/metadata/common" xmlns:rpm="http://linux.duke.edu/metadata/rpm"><package type="rpm">
 
[root@rhel8-15 repodata]# zgrep -c '<package ' b7a940a2fa344c1b956e00ff3458a9c5ee4ebea5bfac336e4ca3d5f7d06ee40a-primary.xml.gz
9234
---



Expected results:

Both dnf and repository metadata should reflect the same package count.


Additional info:

Due to this problem, if the same repository will be synced in Red hat Satellite, Satellite GUI shows the incorrect count i.e. 9234 whereas the RHEL 8 client of the same Red Hat Satellite shows 8444 package count for appstream.

Comment 2 Jaroslav Mracek 2020-01-27 18:48:26 UTC
The problem is with excluded packages by configuration and modules. To resolve the issue we provide additional information Repo-pkgs and Repo-available-pkgs. Repo-pkgs provides number of all packages. See bellow. The problem is resolved by https://github.com/rpm-software-management/dnf/pull/1535.

Repo-id            : updates-modular
Repo-name          : Fedora Modular 31 - x86_64 - Updates
Repo-revision      : 1580003078
Repo-updated       : Sun 26 Jan 2020 02:46:11 AM CET
Repo-pkgs          : 2,456
Repo-available-pkgs: 139
Repo-size          : 2.4 G
Repo-metalink      : https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f31&arch=x86_64
  Updated          : Mon 27 Jan 2020 02:23:21 PM CET
Repo-baseurl       : rsync://ftp.fi.muni.cz/pub/linux/fedora/linux/updates/31/Modular/x86_64/ (121 more)
Repo-expire        : 21,600 second(s) (last: Mon 27 Jan 2020 02:23:21 PM CET)
Repo-filename      : /etc/yum.repos.d/fedora-updates-modular.repo

Comment 3 Jaroslav Mracek 2020-01-28 14:14:30 UTC
CI-tests: https://github.com/rpm-software-management/ci-dnf-stack/pull/695

Comment 4 Jaroslav Mracek 2020-01-28 14:21:17 UTC
Do you need any additional information, rpm build with the patch for testing or anything else?

Comment 15 errata-xmlrpc 2020-04-28 16:49:13 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1823