Skip to content

Commit

Permalink
Always use long filesizes and the "new" non-cpio payload format on v6
Browse files Browse the repository at this point in the history
Switching to the long tags implicitly changes to the "new" payload
format which in v4 was used only for packages with >= 4GB files.
It's noteworthy how much smaller the payload is: the new format has
much less overhead due to not carrying duplicate metadata.

Also noteworthy is that we still cannot change the name of the payload
format stored in the header, as doing so would cause a gratuitous
incompatibility with rpm >= 4.12 which can handle the payload format
just fine. So rpmlib(LargeFiles) dependency remains the means to track
the actual payload - as an acute observer will note, the number of
dependencies in the dump grows by one.
  • Loading branch information
pmatilai committed Apr 4, 2024
1 parent 8b25d02 commit a93bf67
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 106 deletions.
7 changes: 4 additions & 3 deletions build/files.c
Original file line number Diff line number Diff line change
Expand Up @@ -1176,8 +1176,8 @@ static void genCpioListAndHeader(FileList fl, Package pkg, int isSrc)
headerPutString(h, RPMTAG_FILEGROUPNAME,
rpmstrPoolStr(fl->pool, flp->gname));

/* Only use 64bit filesizes tag if required. */
if (fl->largeFiles) {
/* Use 64bit filesizes always on v6, on older only if required. */
if (pkg->rpmver >= 6 || fl->largeFiles) {
rpm_loff_t rsize64 = (rpm_loff_t)flp->fl_size;
headerPutUint64(h, RPMTAG_LONGFILESIZES, &rsize64, 1);
(void) rpmlibNeedsFeature(pkg, "LargeFiles", "4.12.0-1");
Expand Down Expand Up @@ -1280,7 +1280,8 @@ static void genCpioListAndHeader(FileList fl, Package pkg, int isSrc)
}
pkg->dpaths[npaths] = NULL;

if (totalFileSize < UINT32_MAX) {
/* Use 64bit sizes always on v6, on older only if required. */
if (pkg->rpmver < 6 && totalFileSize < UINT32_MAX) {
rpm_off_t totalsize = totalFileSize;
headerPutUint32(h, RPMTAG_SIZE, &totalsize, 1);
} else {
Expand Down
Loading

0 comments on commit a93bf67

Please sign in to comment.