Bug 1054638 - Extracting single files does not work
Summary: Extracting single files does not work
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: cpio
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-17 07:34 UTC by Fabian Deutsch
Modified: 2014-01-17 09:03 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-17 07:51:38 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Fabian Deutsch 2014-01-17 07:34:17 UTC
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)
cpio-2.11-21.fc19.x86_64

How reproducible:
Alwas

Steps to Reproduce:
1. Run:
rpmls http://ovirt.org/releases/ovirt-release-el.noarch.rpm

2. Run
$ rpm2cpio http://ovirt.org/releases/ovirt-release-el.noarch.rpm | cpio -ivd etc/yum.repos.d/glusterfs-epel.repo
28 blocks

3. Run
$ rpm2cpio http://ovirt.org/releases/ovirt-release-el.noarch.rpm | cpio -ivd /etc/yum.repos.d/glusterfs-epel.repo  (leading /)
28 blocks

Actual results:
After 1. No file is extracted
After 2. No file is extracted

Expected results:
The selected file get's extracted

Additional info:

Comment 1 Fabian Deutsch 2014-01-17 07:36:39 UTC
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

[glusterfs-epel]
name=GlusterFS is a clustered file-system capable of scaling to several petabytes.
baseurl=http://download.gluster.org/pub/gluster/glusterfs/LATEST/EPEL.repo/epel-$releasever/$basearch/
....


It could be the correct behavior (as rpmls also showed the leading dot)

Comment 2 Pavel Raiskup 2014-01-17 07:51:38 UTC
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.

Comment 3 Pavel Raiskup 2014-01-17 09:03:53 UTC
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
  -rw-r--r--  /etc/yum.repos.d/el6-ovirt.repo
  -rw-r--r--  /etc/yum.repos.d/glusterfs-epel.repo
  drwxr-xr-x  /usr/share/doc/ovirt-release-el6-10
  -rw-r--r--  /usr/share/doc/ovirt-release-el6-10/ASL

But the content is:

  $ rpm2cpio ovirt-release-el.noarch.rpm | cpio -t
  ./etc/yum.repos.d/el6-ovirt.repo
  ./etc/yum.repos.d/glusterfs-epel.repo
  ./usr/share/doc/ovirt-release-el6-10
  ./usr/share/doc/ovirt-release-el6-10/ASL

---

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
  a/
  a/b/
  a/b/c
  ./a/
  ./a/b/
  ./a/b/c

  $ bsdtar -tf a.tar a/b/c
  a/b/c
  ./a/b/c

  $ bsdtar -tf a.tar ./a/b/c
  a/b/c
  ./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.

Pavel


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