4

These steps are from a box running CentOS 6.5. I merely tried converting a RPM package to a CPIO archive and was surprised to find files listed in the RPM but absent from the archive. Here are the steps taken.

List out paths in the RPM:

$ rpm -qlp sssd-1.9.2-82.4.el6_4.x86_64.rpm | sort > rpm.lst

Convert the RPM to a CPIO archive:

$ rpm2cpio sssd-1.9.2-82.4.el6_4.x86_64.rpm > sssd-1.9.2-82.4.el6_4.x86_64.cpio

Save the list of files in the archive. The sed filter is required to remove leading dot entries from pathnames. This is not required for the RPM listing.

$ cpio -i -t < sssd-1.9.2-82.4.el6_4.x86_64.cpio | sed -e 's|^.||' | sort > cpio.lst

Finally, the diff showing missing files:

$ diff -u cpio.lst rpm.lst

--- cpio.lst        2015-07-16 19:54:06.020494348 +0530
+++ rpm.lst         2015-07-16 19:53:38.012494371 +0530
@@ -2,6 +2,7 @@
 /etc/rc.d/init.d/sssd
 /etc/rwtab.d/sssd
 /etc/sssd
+/etc/sssd/sssd.conf
 /usr/bin/sss_ssh_authorizedkeys
 /usr/bin/sss_ssh_knownhostsproxy
 /usr/lib64/ldb/modules/ldb/memberof.so
@@ -102,6 +103,8 @@
 /var/lib/sss
 /var/lib/sss/db
 /var/lib/sss/mc
+/var/lib/sss/mc/group
+/var/lib/sss/mc/passwd
 /var/lib/sss/pipes
 /var/lib/sss/pipes/private
 /var/lib/sss/pubconf

Why are there files present in the RPM but missing in the CPIO archive? My interest was especially in /etc/sssd/sssd.conf because I wanted to look at a sample config file. We are using a sssd package that is older then the one coming from CentOS. I repeated the steps above with the package from CentOS. The result was the same.

pdp
  • 778
  • 1
  • 7
  • 16

2 Answers2

2

Those files are empty files, therefore, they're not included into cpio archive, but are listed in rpm, even after you install rpm and if you'll check it with rpm -V sssd - it will have normal output, because it's listed in rpmdb that way, even when files are deleted, here is snippet from SRPM: enter image description here

p.s. very interesting case!

GioMac
  • 4,544
  • 4
  • 27
  • 41
2

The entry for sssd.conf from the sssd spec file is:

%ghost %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sssd/sssd.conf

Quoting from Maximum RPM about the %ghost directive:

By adding this directive to the line containing a file, RPM will know about the ghosted file, but will not add it to the package. However it still needs to be in the buildroot.

Therefore, rpm2cpio that is part of the same package as rpm skips ghost files when converting to a CPIO archive.

tejus
  • 174
  • 1
  • 1
  • 10