RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1022028 - package count doesn't match with actual packages in repodata
Summary: package count doesn't match with actual packages in repodata
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: createrepo
Version: 7.0
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Valentina Mukhamedzhanova
QA Contact: Karel Srot
URL:
Whiteboard:
Depends On: 1022001
Blocks: 578256
TreeView+ depends on / blocked
 
Reported: 2013-10-22 14:07 UTC by Daniel Mach
Modified: 2014-09-09 09:11 UTC (History)
8 users (show)

Fixed In Version: createrepo-0.9.9-23.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1022001
: 1596211 (view as bug list)
Environment:
Last Closed: 2014-06-13 09:40:56 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Make sure the "packages" attribute is always correct. (2.84 KB, patch)
2013-10-23 10:02 UTC, Zdeněk Pavlas
no flags Details | Diff

Description Daniel Mach 2013-10-22 14:07:40 UTC
+++ This bug was initially created as a clone of Bug #1022001 +++

Package version:
createrepo-0.10-1.fc21.noarch

How to reproduce:
1) create a file list with existing packages
2) append a line with package that does not exist
3) run $ createrepo -i <package-list> .


zegrep '<package |packages=' repodata/*primary*xml*
<metadata xmlns="http://linux.duke.edu/metadata/common" xmlns:rpm="http://linux.duke.edu/metadata/rpm" packages="3">
<package type="rpm">
<package type="rpm">

Header says 3 packages while there are just 2 of them in metadata.

Comment 1 Zdeněk Pavlas 2013-10-23 08:42:14 UTC
We'd like to create XML files in one pass, and since the package count is saved first, updating it when some of the RPM files could not be processed is not trivial.  I see three possible solutions:

a) add an extra stat() pass in "createrepo -i" case, and remove non-existing files from the list. Then we'll use the correct package count. However, this won't work 100% .. eg zero-sized *.rpm files fail too late.

b) re-compress all three *.xml files when some RPMs could not be processed, updating the "packages" attribute. It involves some re-parsing of the XML data, and is pretty ugly. However, (when it works) it covers all failure modes.

c) do some sanity checking on the file list first, then run as usual. When some files could not be processed, don't try to fix up the package count. exit with an error instead.

IMO viable solution is implementing either b or a+c.  If all you want to handle is "file not found", then a+c is probably better (although I've implemented b already).

Comment 2 Daniel Mach 2013-10-23 09:59:13 UTC
What about following:
* scan for all files (no stat) from package list (verify they're on disk)
* set packages=<package count>
* if a package fails to read
  * report error
  * don't write new repodata
  * exit with non-0 exit code

Comment 3 Zdeněk Pavlas 2013-10-23 10:02:40 UTC
Created attachment 815304 [details]
Make sure the "packages" attribute is always correct.

Comment 4 Zdeněk Pavlas 2013-10-23 10:07:17 UTC
The patch above checks all local files specified with -i option to be readable first. When some rpms fail after the "packages" count has been already written, it's a fatal error ($? == 1).

Comment 5 Zdeněk Pavlas 2014-01-15 16:29:30 UTC
We can merge the upstream patch.

commit 84a237f6a2e661879147e1ee5f9a2be984267991
Author: Zdenek Pavlas <zpavlas>
Date:   Wed Oct 23 11:42:02 2013 +0200

    Make sure the "packages" attribute is always correct. BZ 1022001
    
    We create XML files in one pass and the package count is stored
    first. We need the count to be correct, so when a package is
    being skipped, it must be a fatal error.

Comment 9 Ludek Smid 2014-06-13 09:40:56 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


Note You need to log in before you can comment on or make changes to this bug.