Fix archive size tag missing cpio trailer size (RhBug:1142949) - Fixes regression from commit 7f84a126ab43f2d0163911100b4432364d0952a6 which causes archive size to be determined before closing the archive when closing actually writes the cpio trailer into the archive. Thus RPMTAG_ARCHIVESIZE (and RPMTAG_LONGARCHIVESIZE) are off by the cpio trailer size in all packages built with rpm 4.12.0 and pre-releases :( - Move rpmcpioFree() to rpmfiFree() to allow Tell() on the archive after closing it, swap to original order of things on build-side. index cfb24ef..28834dc 100644 --- build/pack.c +++ build/pack.c @@ -55,13 +55,13 @@ static int rpmPackageFilesArchive(rpmfiles fi, int isSrc, if (rc == RPMERR_ITER_END) rc = 0; - if (archiveSize) - *archiveSize = (rc == 0) ? rpmfiArchiveTell(archive) : 0; - /* Finish the payload stream */ if (!rc) rc = rpmfiArchiveClose(archive); + if (archiveSize) + *archiveSize = (rc == 0) ? rpmfiArchiveTell(archive) : 0; + rpmfiFree(archive); return rc; index 49fc2c4..384a6c9 100644 --- lib/rpmfi.c +++ lib/rpmfi.c @@ -1199,6 +1199,7 @@ rpmfi rpmfiFree(rpmfi fi) fi->fn = _free(fi->fn); fi->ofn = _free(fi->ofn); fi->found = _free(fi->found); + fi->archive = rpmcpioFree(fi->archive); free(fi); return NULL; @@ -1734,7 +1735,6 @@ int rpmfiArchiveClose(rpmfi fi) if (fi == NULL) return -1; int rc = rpmcpioClose(fi->archive); - fi->archive = rpmcpioFree(fi->archive); return rc; }