From 156e6ef349e56439234f33f9b3a3c867d59aa37d Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Sun, 4 Oct 2020 00:04:40 +0200 Subject: 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. --- gnu/packages/commencement.scm | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'gnu') 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 \" +#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"))) -- cgit 1.4.1