RPM file format questions

Jordan Sissel jls at semicomplete.com
Sun Feb 19 07:23:45 UTC 2012


Howdy!

I am implementing a library for reading and writing RPM files. I've used
the rpm source and from max-rpm[1] as documentation on the file format.

[1] http://www.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html

I'm thus far able to happily read older RPMs from,CentOS5 and Fedora 10
(and earlier). I am not able to correctly read RPMs from CentOS 6 and
Fedora 11 (and beyond)

The problem seems to be around the length of each header section (signature
and regular header). With older RPMs, my calculation correctly computes the
length, but for newer rpms (Fedora 11+ and CentOS6+) I am usually short by
4 bytes.

This causes me a problem because I'll read the Signature header and fail
when reading the next header because I'm 4 bytes behind the actual start of
the next header.

I have wrangled it down to a small example script that can read older rpms
but fails on newer ones as described. I have also included some data and
output as well in a gist found here:

https://gist.github.com/1862256

If you have any pointers on how I'm reading these newer RPM files
incorrectly, I'd love to know :)

-Jordan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-list/attachments/20120218/b3e04a12/attachment.html>


More information about the Rpm-list mailing list