|
Florian Festi |
0b0796 |
From 2df8008d22b58f87fe665de0fa8c5bbeb4b4a3d8 Mon Sep 17 00:00:00 2001
|
|
Florian Festi |
0b0796 |
From: Michal Domonkos <mdomonko@redhat.com>
|
|
Florian Festi |
0b0796 |
Date: Wed, 17 May 2023 12:39:47 +0200
|
|
Florian Festi |
0b0796 |
Subject: [PATCH] Enable large file support on 32-bit systems again
|
|
Florian Festi |
0b0796 |
|
|
Florian Festi |
0b0796 |
Replace 32-bit sizes in types like off_t with 64-bits when building on
|
|
Florian Festi |
0b0796 |
32-bit architectures, to enable large file support there.
|
|
Florian Festi |
0b0796 |
|
|
Florian Festi |
0b0796 |
This fixes a nasty regression introduced in the cmake transition. As
|
|
Florian Festi |
0b0796 |
autotools would set this flag to 64 automatically for us, applications
|
|
Florian Festi |
0b0796 |
linking against librpm (such as libdnf, librepo, libsolv or drpm) are
|
|
Florian Festi |
0b0796 |
already adapted to that and are also building with the value of 64
|
|
Florian Festi |
0b0796 |
(explicitly, we never exported this flag through pkg-config ourselves).
|
|
Florian Festi |
0b0796 |
However, us suddenly expecting 32-bits in those types on 32-bit systems
|
|
Florian Festi |
0b0796 |
can blow up badly e.g. in functions that take an off_t parameter, like
|
|
Florian Festi |
0b0796 |
Fseek().
|
|
Florian Festi |
0b0796 |
|
|
Florian Festi |
0b0796 |
There perhaps aren't that many low-level users of librpm but drpm is one
|
|
Florian Festi |
0b0796 |
such example where exactly this happens when built against our current
|
|
Florian Festi |
0b0796 |
master. It calls headerRead(), leading to Fseek() which receives a
|
|
Florian Festi |
0b0796 |
64-bit offset parameter where it expects a 32-bit one, thus silently
|
|
Florian Festi |
0b0796 |
overwriting the following parameter from 1 to 0 (SEEK_CUR to SEEK_SET)
|
|
Florian Festi |
0b0796 |
which messes up the whole reading sequence in drpm's rpm_read(),
|
|
Florian Festi |
0b0796 |
producing a failure in drpm's test suite that doesn't make any sense at
|
|
Florian Festi |
0b0796 |
first sight.
|
|
Florian Festi |
0b0796 |
|
|
Florian Festi |
0b0796 |
While at it, also export the flag through pkg-config so that anyone
|
|
Florian Festi |
0b0796 |
linking against librpm is now guaranteed to work correctly even if they
|
|
Florian Festi |
0b0796 |
don't set the flag themselves (kudos to Petr Pisar for suggesting this).
|
|
Florian Festi |
0b0796 |
---
|
|
Florian Festi |
0b0796 |
CMakeLists.txt | 1 +
|
|
Florian Festi |
0b0796 |
rpm.pc.in | 2 +-
|
|
Florian Festi |
0b0796 |
2 files changed, 2 insertions(+), 1 deletion(-)
|
|
Florian Festi |
0b0796 |
|
|
Florian Festi |
0b0796 |
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
Florian Festi |
0b0796 |
index b006ed34e..dc28fd547 100644
|
|
Florian Festi |
0b0796 |
--- a/CMakeLists.txt
|
|
Florian Festi |
0b0796 |
+++ b/CMakeLists.txt
|
|
Florian Festi |
0b0796 |
@@ -52,6 +52,7 @@ set(CMAKE_SHARED_MODULE_PREFIX "")
|
|
Florian Festi |
0b0796 |
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
|
Florian Festi |
0b0796 |
include(GNUInstallDirs)
|
|
Florian Festi |
0b0796 |
add_compile_definitions(_GNU_SOURCE)
|
|
Florian Festi |
0b0796 |
+add_definitions(-D_FILE_OFFSET_BITS=64)
|
|
Florian Festi |
0b0796 |
|
|
Florian Festi |
0b0796 |
function(makemacros)
|
|
Florian Festi |
0b0796 |
set(prefix ${CMAKE_INSTALL_PREFIX})
|
|
Florian Festi |
0b0796 |
diff --git a/rpm.pc.in b/rpm.pc.in
|
|
Florian Festi |
0b0796 |
index 46d42e7a3..791303e17 100644
|
|
Florian Festi |
0b0796 |
--- a/rpm.pc.in
|
|
Florian Festi |
0b0796 |
+++ b/rpm.pc.in
|
|
Florian Festi |
0b0796 |
@@ -11,6 +11,6 @@ URL: @CMAKE_PROJECT_HOMEPAGE_URL@
|
|
Florian Festi |
0b0796 |
Requires: popt
|
|
Florian Festi |
0b0796 |
Requires.private: @ZSTD_REQUIRES@
|
|
Florian Festi |
0b0796 |
# Conflicts:
|
|
Florian Festi |
0b0796 |
-Cflags: -I${includedir}
|
|
Florian Festi |
0b0796 |
+Cflags: -I${includedir} -D_FILE_OFFSET_BITS=64
|
|
Florian Festi |
0b0796 |
Libs: -L${libdir} -lrpm -lrpmio
|
|
Florian Festi |
0b0796 |
Libs.private: -lpopt -lrt -lpthread @WITH_LZMA_LIB@ @WITH_BZ2_LIB@ @WITH_ZLIB_LIB@ @LUA_LIBS@
|
|
Florian Festi |
0b0796 |
--
|
|
Florian Festi |
0b0796 |
2.40.1
|
|
Florian Festi |
0b0796 |
|