Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1250006

Summary: create archive failed on file XXX: cpio: Bad magic
Product: Red Hat Enterprise Linux 6 Reporter: Pavel Raiskup <praiskup>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED ERRATA QA Contact: Karel Srot <ksrot>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.6CC: lkardos
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rpm-4.8.0-48.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-05-11 00:53:52 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 Pavel Raiskup 2015-08-04 10:29:07 UTC
Reproducible by this src.rpm:
http://praiskup.fedorapeople.org/copr/rh-postgresql94-postgresql-9.4.4-2.el6.src.rpm

$ rpmbuild -vv --rebuild rh-postgresql94-postgresql-9.4.4-2.el6.src.rpm
...SNIP...
D: fini      100644  1 (   0,   0)       163 /home/praiskup/rpmbuild/BUILDROOT/rh-postgresql94-postgresql-9.4.4-2.el6.x86_64/opt/rh/rh-postgresql94/root/usr/share/doc/rh-postgresql94-postgresql-9.4.4/MISSING_FEATURES 
D: fini      100644  1 (   0,   0)      1209 /home/praiskup/rpmbuild/BUILDROOT/rh-postgresql94-postgresql-9.4.4-2.el6.x86_64/opt/rh/rh-postgresql94/root/usr/share/doc/rh-postgresql94-postgresql-9.4.4/README 
D: undo      100644  0 (   0,   0)         0 /home/praiskup/rpmbuild/BUILDROOT/rh-postgresql94-postgresql-9.4.4-2.el6.x86_64/opt/rh/rh-postgresql94/root/usr/share/doc/rh-postgresql94-postgresql-9.4.4/README.rpm-dist 
XZDIO:      59 writes,  1582164 total bytes in 0.243617 secs
error: create archive failed on file /home/praiskup/rpmbuild/BUILDROOT/rh-postgresql94-postgresql-9.4.4-2.el6.x86_64/opt/rh/rh-postgresql94/root/usr/share/doc/rh-postgresql94-postgresql-9.4.4/README.rpm-dist: cpio: Bad magic


RPM build errors:
    create archive failed on file /home/praiskup/rpmbuild/BUILDROOT/rh-postgresql94-postgresql-9.4.4-2.el6.x86_64/opt/rh/rh-postgresql94/root/usr/share/doc/rh-postgresql94-postgresql-9.4.4/README.rpm-dist: cpio: Bad magic
D: closed   db index       /var/lib/rpm/Providename
D: closed   db index       /var/lib/rpm/Name
D: closed   db index       /var/lib/rpm/Packages
$ ..

This is caused by '%doc %{_pkgdocdir}/README.rpm-dist' line in %files section.
If I do 'cp %{buildroot}%{_pkgdocdir}/README.rpm-dist ./' and then
I do '%doc README.rpm-dist' => this problem disappears and the package builds
fine.

Comment 2 Ľuboš Kardoš 2015-08-31 12:58:45 UTC
This bug was fixed in rpm-4.9.1 [1], but I am against backporting that patch into rpm-4.8.0 that is in rhel-6 because it caused many problems. But we can add at least a better error message that you can't have the %doc tag with relative path and file with absolute path into the document directory at the same time in a rpm file list.

[1] https://github.com/rpm-software-management/rpm/commit/2f6bfc99d01df941f6aaad8497150f82eeb75311

Comment 3 Ľuboš Kardoš 2015-12-01 13:07:21 UTC
Devel ack for improving the error message to be more clear what causes the problem.

Comment 10 errata-xmlrpc 2016-05-11 00:53:52 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://rhn.redhat.com/errata/RHBA-2016-0936.html