summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2020-10-04 00:04:40 +0200
committerDanny Milosavljevic <dannym@scratchpost.org>2020-10-04 00:05:55 +0200
commit156e6ef349e56439234f33f9b3a3c867d59aa37d (patch)
treef56c1a4c49cc197a208fc38abc6da0a54275470a /gnu
parent6d513b776a449fdb5c7c50b33060a5476edf61cb (diff)
downloadguix-156e6ef349e56439234f33f9b3a3c867d59aa37d.tar.gz
gnu: glibc-mesboot0: Catch all cases of a glibc user not requesting 64-bit
offsets and then using readdir regardless.

* gnu/packages/commencement.scm (glibc-mesboot0)[arguments]#<:phases>[patch-dirent]:
Catch all cases of a glibc user not requesting 64-bit offsets and then using
readdir regardless.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/commencement.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm
index e5a4caa95c..85293139b8 100644
--- a/gnu/packages/commencement.scm
+++ b/gnu/packages/commencement.scm
@@ -1398,6 +1398,26 @@ ac_cv_c_float_format='IEEE (little-endian)'
            ,(string-append "--prefix=" out)))
        #:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'patch-dirent
+           (lambda _
+             ;; See package "glibc" for why this is necessary.
+             (let ((port (open-file "dirent/dirent.h" "a")))
+               (display "
+#ifndef _LIBC
+#if __SIZEOF_LONG__ < 8
+#ifndef __USE_FILE_OFFSET64
+#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 32
+#warning \"Using -D_FILE_OFFSET_BITS=32 and using readdir is a bad idea, see <https://bugzilla.kernel.org/show_bug.cgi?id=205957>\"
+#else
+#undef readdir
+#define readdir @READDIR_WITHOUT_FILE_OFFSET64_IS_A_REALLY_BAD_IDEA@
+#endif
+#endif
+#endif
+#endif
+" port)
+               (close-port port))
+               #t))
          (add-after 'unpack 'apply-boot-patch
            (lambda* (#:key inputs #:allow-other-keys)
              (and (let ((patch (assoc-ref inputs "boot-patch")))