Enable large file support on 32-bit Linux - #9481
Conversation
On 32-bit Linux, off_t and related types default to 32 bits. In the 0.28.x branch, stat() can return EOVERFLOW when an inode number exceeds UINT32_MAX. FileIo::size() converts that error to SIZE_MAX, causing misleading mmap() ENOMEM and vector max_size() failures. Define _FILE_OFFSET_BITS=64 for CMake and Meson builds.
|
32-bit Linux is obsolete, so I don't think it's a good idea to add extra complexity to our build system to support it. I'd prefer to improve the error handling in the code. Is this the code that's causing the problem? Lines 205 to 211 in dc9364b We should probably let that exception go up to the main function and exit with an error message. |
|
Thanks. We’ll keep |
|
@geri1701: Is this a real issue for nixpkgs? I'm sorry, I just assumed that this was one of those issues that was found by AI and doesn't actually impact anyone in practice. I think we can consider this if it's a genuine issue for nixpkgs. Please could you share a link to the issue where that's being discussed? |
Yes, it affected Exiv2’s tests in a sandboxed i686 package build, not during normal use: https://redirect.github.com/NixOS/nixpkgs/pull/538986 |
On 32-bit Linux,
stat()in the 0.28.x branch can returnEOVERFLOWwhen an inode number exceedsUINT32_MAX.FileIo::size()converts that error toSIZE_MAX, which causes misleadingmmap()ENOMEMandstd::vector::max_size()failures.This defines
_FILE_OFFSET_BITS=64for 32-bit Linux in both CMake and Meson builds.mainalso usesfseeko()andftello(), so it benefits from 64-bit file offsets. The patch applies unchanged to0.28.x.Verification:
main: all 6 CTest suites pass serially on i686 and x86_640.28.9: all 5 CTest suites pass on i686 and x86_64