From 0b07964453b0493cc4d9d8c2b0d53b216b227d7b Mon Sep 17 00:00:00 2001 From: Florian Festi Date: May 17 2023 12:11:41 +0000 Subject: Enable large file support on 32-bit systems again --- diff --git a/0001-Enable-large-file-support-on-32-bit-systems-again.patch b/0001-Enable-large-file-support-on-32-bit-systems-again.patch new file mode 100644 index 0000000..818f110 --- /dev/null +++ b/0001-Enable-large-file-support-on-32-bit-systems-again.patch @@ -0,0 +1,61 @@ +From 2df8008d22b58f87fe665de0fa8c5bbeb4b4a3d8 Mon Sep 17 00:00:00 2001 +From: Michal Domonkos +Date: Wed, 17 May 2023 12:39:47 +0200 +Subject: [PATCH] Enable large file support on 32-bit systems again + +Replace 32-bit sizes in types like off_t with 64-bits when building on +32-bit architectures, to enable large file support there. + +This fixes a nasty regression introduced in the cmake transition. As +autotools would set this flag to 64 automatically for us, applications +linking against librpm (such as libdnf, librepo, libsolv or drpm) are +already adapted to that and are also building with the value of 64 +(explicitly, we never exported this flag through pkg-config ourselves). +However, us suddenly expecting 32-bits in those types on 32-bit systems +can blow up badly e.g. in functions that take an off_t parameter, like +Fseek(). + +There perhaps aren't that many low-level users of librpm but drpm is one +such example where exactly this happens when built against our current +master. It calls headerRead(), leading to Fseek() which receives a +64-bit offset parameter where it expects a 32-bit one, thus silently +overwriting the following parameter from 1 to 0 (SEEK_CUR to SEEK_SET) +which messes up the whole reading sequence in drpm's rpm_read(), +producing a failure in drpm's test suite that doesn't make any sense at +first sight. + +While at it, also export the flag through pkg-config so that anyone +linking against librpm is now guaranteed to work correctly even if they +don't set the flag themselves (kudos to Petr Pisar for suggesting this). +--- + CMakeLists.txt | 1 + + rpm.pc.in | 2 +- + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b006ed34e..dc28fd547 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -52,6 +52,7 @@ set(CMAKE_SHARED_MODULE_PREFIX "") + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + include(GNUInstallDirs) + add_compile_definitions(_GNU_SOURCE) ++add_definitions(-D_FILE_OFFSET_BITS=64) + + function(makemacros) + set(prefix ${CMAKE_INSTALL_PREFIX}) +diff --git a/rpm.pc.in b/rpm.pc.in +index 46d42e7a3..791303e17 100644 +--- a/rpm.pc.in ++++ b/rpm.pc.in +@@ -11,6 +11,6 @@ URL: @CMAKE_PROJECT_HOMEPAGE_URL@ + Requires: popt + Requires.private: @ZSTD_REQUIRES@ + # Conflicts: +-Cflags: -I${includedir} ++Cflags: -I${includedir} -D_FILE_OFFSET_BITS=64 + Libs: -L${libdir} -lrpm -lrpmio + Libs.private: -lpopt -lrt -lpthread @WITH_LZMA_LIB@ @WITH_BZ2_LIB@ @WITH_ZLIB_LIB@ @LUA_LIBS@ +-- +2.40.1 + diff --git a/rpm.spec b/rpm.spec index 33d4699..8947a88 100644 --- a/rpm.spec +++ b/rpm.spec @@ -32,7 +32,7 @@ %global rpmver 4.18.90 #global snapver rc1 -%global baserelease 3 +%global baserelease 4 %global sover 10 %global oldsover 9 @@ -152,6 +152,7 @@ rpm-4.18.90-weak-user-group.patch 0001-Remove-second-share-dir-from-infodir-and-mandir.patch 0001-Add-pgpVerifySignature2-and-pgpPrtParams2.patch 0001-Fix-bzip2-detection.patch +0001-Enable-large-file-support-on-32-bit-systems-again.patch # These are not yet upstream rpm-4.7.1-geode-i686.patch @@ -647,7 +648,10 @@ fi %doc %{_defaultdocdir}/rpm/API/ %changelog -* Mo May 15 2023 Florian Festi - 4.18.90-3 +* Wed May 17 2023 Florian Festi - 4.18.90-4 +- Enable large file support on 32-bit systems again + +* Mon May 15 2023 Florian Festi - 4.18.90-3 - Fix libbzip2 detection * Thu May 11 2023 Florian Festi - 4.18.90-2