From ceafb6588256d6439ab06740b469e109eaa2a22f Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Tue, 20 Sep 2022 15:52:31 -0700 Subject: [PATCH] Compile with large-file support (LFS) This adds preprocessor defines for _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64 and a few others, fixing a bug that was reported on gitter. This prevents issues when running fish on 32 bit systems that have filesystems with 64 bit inodes. --- CHANGELOG.rst | 1 + CMakeLists.txt | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index de6c42ed8..82933403e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -76,6 +76,7 @@ Resolved in 3.6.0 - Fish calls external commands via the given path again instead of always making it absolute. This can be seen e.g. when you run a bash script and check ``$0`` (:issue:`9143`). - ``printf`` no longer tries to interpret the first argument as an option (:issue:`9132`). - ``string repeat`` no longer allocates the entire output at once, instead using chunks. This needs less memory and has less of a delay with long strings. Also it was possible to make fish crash by making it allocate more memory than the system had. (:issue:`9124`) +- On 32-bit systems, globs like ``*`` might fail to print certain files, due to missing large file support. This has been fixed by enabling large file support. Completions ^^^^^^^^^^^ diff --git a/CMakeLists.txt b/CMakeLists.txt index f85b1e50e..5dbfd8844 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,12 @@ add_compile_options(-fno-exceptions) # Undefine NDEBUG to keep assert() in release builds. add_definitions(-UNDEBUG) +# Enable large files on GNU. +add_definitions(-D_LARGEFILE_SOURCE + -D_LARGEFILE64_SOURCE + -D_FILE_OFFSET_BITS=64 + -D_ATFILE_SOURCE) + # Hide the CMake Rules directories in Xcode projects. source_group("CMake Rules" REGULAR_EXPRESSION "^$")