rpm  5.4.15
hregions
Go to the documentation of this file.
1 /*! \page hregions Immutable header regions in rpm-4.0.1 and later
2 
3 The header data structure has changed in rpm-4.0.[12] to preserve the
4 original header from a package. The goal is to keep the original
5 header intact so that metadata can be verified separately from the
6 payload by the RHN up2date client and by the rpm command line verify
7 mode using signatures saved in the rpm database. I believe the change
8 is entirely forward and backward compatible, and will not require
9 any artifacts like changing the version number of packaging or
10 adding an "rpmlib(...)" tracking dependency. We'll see ...
11 
12 Here's a short description of the change. An rpm header has three sections:
13 \verbatim
14  1) intro (# entries in index, # bytes of data)
15  2) index 16 byte entries, one per tag, big endian
16  3) data tag values, properly aligned, big endian
17 \endverbatim
18 
19 Representing sections in the header (ignoring the intro) with
20 \verbatim
21  A,B,C index entries sorted by tag number
22  a,b,c variable length entry data
23  | boundary between index/data
24 \endverbatim
25 a header with 3 tag/value pairs (A,a) can be represented something like
26 \verbatim
27  ABC|abc
28 \endverbatim
29 
30 The change is to introduce a new tag that keeps track of a contiguous
31 region (i.e. the original header). Representing the boundaries with
32 square/angle brackets, an "immutable region" in the header thus becomes
33 \verbatim
34  [ABC|abc]
35 \endverbatim
36 or more generally (spaces added for clarity)
37 \verbatim
38  [ABC> QRS | <abc] qrs
39 \endverbatim
40 or with concatenated regions (not implemented yet)
41 \verbatim
42  [ABC> [DEF> QRS | <abc] <def] qrs
43 \endverbatim
44 or with nested regions (not implemented yet)
45 \verbatim
46  [ABC [DEF>> QRS | <<abc] def] qrs
47 \endverbatim
48 
49 \todo Either concatenated/nested regions may be used to implement
50 a metarpm, aka a package of packages, dunno how, when, or even if, yet.
51 
52 What complicates the above is legacy issues, as various versions of rpm
53 have added/deleted/modified entries in the header freely. Thus, representing
54 altered tag entries/data with a '.', there is a need to preserve deleted
55 information something like
56 
57 \verbatim
58  [A.C> QRS XYZ | <a.c] qrs xyz
59 \endverbatim
60 
61 \note This is basically the change that replaces the filename with
62  a {dirname,basename,dirindex} triple between rpm-3.x and rpm-4.x.
63 
64 or
65 
66 \verbatim
67  [AB.> QRS D | <ab.] qrs d
68 \endverbatim
69 
70 \note The header is no longer sorted because of replacing Cc with Dd.
71 
72 and yet permit retrieval of the original
73 
74 \verbatim
75  [ABC|abc]
76 \endverbatim
77 
78 region. PITA, really.
79 
80 What made header regions trickier yet is the desire to have an implementation
81 that is both backward and forward compatible. I won't bore you with the
82 tedious details.
83 
84 However, even after doing regressions against supported Red Hat releases,
85 there's a Great Big Universe of rpm packages out there, and I'm *very*
86 interested in hearing (as bug reports against rpm at http://bugzilla.redhat.com)
87 about any and all problems with header regions in rpm-4.0.1.
88 
89 */