rpm5 & ts.hdrFromFdno from .hdr file

Jeffrey Johnson n3npq at me.com
Sun May 19 00:53:43 CEST 2013


On May 18, 2013, at 5:12 PM, Elan Ruusamäe wrote:

> On 05/18/2013 08:58 PM, Jeffrey Johnson wrote:
>>> >header is extracted from this repodata info:
>>> >
>>> >    <rpm:header-range start="368" end="7947"/>
>>> >
>>> >perhaps those offsets are incorrect?
>>> >
>> Heh: offsets being different.
> so, i found rpm5 has the offsets stored in headers already, and those give the same offsets out, which seem to be correct (compared to what rpm/yum on fedora does)
> 
> # ./hw5.py blockdev-2.22.2-4.i686.rpm
> st: 368, end: 7947
> START: 368, END: 7947, SIZE: 7579
> Wrote: blockdev-2.22.2-4.i686.rpm.rpm5.hdr
> 

Well I'm not at all surprised that the offsets are identical since nothing
has explicitly changed in a header format since like forever.

There are several implicit contextual changes to the data that is loosely called a "header".

1) RPM always added 16b of magic when writing a header to disk in a package. YUM
originally wrote metadata headers without the magic, and I suspect that is/was the
code that is in anaconda when yum support was merged in.

From memory, the 16b of magic are always added in @rpm5.org code to make a "header" less complex
(because a unchanged/immutable data blob).

2) signature tags are appended to what is called a "immutable header region" in the header
object when a header is loaded so that all metadata can be accessed from a single object.

I don't know what/why anaconda is re-exporting header metadata to a file: but added
tags MUST be removed to re-create the metadata header blob exactly as it was in
the original *.rpm for multiple export/import operations. The data blob is also allocated
using mmap(2) with PROT_READ protections to prevent changes.

So what is the exact issue you are trying to solve? AFAIK anaconda
tools cannot read a header using rpm-python from RPM5?

73 de Jeff



More information about the pld-devel-en mailing list