diff --git a/archivesize.diff b/archivesize.diff new file mode 100644 index 0000000..90b8887 --- /dev/null +++ b/archivesize.diff @@ -0,0 +1,50 @@ +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; + } + diff --git a/rpm.changes b/rpm.changes index 5f9e8ee..49d0beb 100644 --- a/rpm.changes +++ b/rpm.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu Sep 18 13:40:43 CEST 2014 - mls@suse.de + +- cherry-pick archivesize fix from upstream + new patch: archivesize.diff + ------------------------------------------------------------------- Tue Sep 16 13:55:09 CEST 2014 - mls@suse.de diff --git a/rpm.spec b/rpm.spec index 0933e83..96e576b 100644 --- a/rpm.spec +++ b/rpm.spec @@ -128,6 +128,7 @@ Patch85: brp-compress-no-img.patch Patch92: find-lang-python.patch Patch93: weakdepscompat.diff Patch94: checksepwarn.diff +Patch95: archivesize.diff Patch6464: auto-config-update-aarch64-ppc64le.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build # @@ -215,7 +216,7 @@ rm -f rpmdb/db.h %patch -P 60 -P 61 -P 65 -P 66 -P 67 -P 68 -P 69 %patch -P 70 -P 71 -P 73 -P 74 -P 75 -P 76 -P 77 -P 78 -P 79 %patch -P 85 -%patch -P 92 -P 93 -P 94 +%patch -P 92 -P 93 -P 94 -P 95 %ifarch aarch64 ppc64le %patch6464