Description of problem:
According to http://www.rpm.org/max-rpm/s1-rpm-miscellania-rpm2cpio.html , cpio should be capable of extracting single files from a cpio archive, but the example iven doesn't work.
Version-Release number of selected component (if applicable):
$ rpm -qf $(which cpio)
Steps to Reproduce:
$ rpm2cpio http://ovirt.org/releases/ovirt-release-el.noarch.rpm | cpio -ivd etc/yum.repos.d/glusterfs-epel.repo
$ rpm2cpio http://ovirt.org/releases/ovirt-release-el.noarch.rpm | cpio -ivd /etc/yum.repos.d/glusterfs-epel.repo (leading /)
After 1. No file is extracted
After 2. No file is extracted
The selected file get's extracted
It seems to work if I append a leading "." to the path to be extracted:
$ rpm2cpio http://ovirt.org/releases/ovirt-release-el.noarch.rpm | cpio --to-stdout -iv ./etc/yum.repos.d/glusterfs-epel.repo
# Place this file in your /etc/yum.repos.d/ directory
name=GlusterFS is a clustered file-system capable of scaling to several petabytes.
It could be the correct behavior (as rpmls also showed the leading dot)
Thanks for the report. That is most probably problem in rpmls.
Try the rpm2cpio (or extract the CONTENTS.cpio other way) and then try to
look for the archive contents. E.g. cat CONTENTS.cpio | cpio -t
That shows you that the files are not stored absolutely inside.
Ok, I missed the point what is exactly a problem because we have probably
a little bit different rpmls versions (my is not showing leading dot):
$ rpmls ovirt-release-el.noarch.rpm
But the content is:
$ rpm2cpio ovirt-release-el.noarch.rpm | cpio -t
You want to make the './xx' be equivalent of 'xx' (in both archive contents and
parameters). So far, all archivers I am aware of distinguish between those
patterns inside archive. Just libarchive (bsdtar) takes those patterns in
arguments equivalently (but usual case is to compare verbatim):
$ bsdtar -cf a.tar a ./a
$ bsdtar -tf a.tar
$ bsdtar -tf a.tar a/b/c
$ bsdtar -tf a.tar ./a/b/c
But, for GNU cpio (same upstream as GNU tar), this is imo NOTABUG. Verbatim
comparison was always there. And in GNU tar that is also documented as
wanted (2.7 How to List Archives). But I'll rather ask upstream.