summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2023-12-17 21:08:35 +0200
committerEfraim Flashner <efraim@flashner.co.il>2023-12-17 21:08:35 +0200
commit568787bf6a5b093121e6c73948884cf3d572929b (patch)
tree9f7d8b8221eb320d0acdecddb685136c32a81781
parente440df2a23b72bf7c1bf03d7c0774e0c66b39dea (diff)
gnu: file: Fix building on 32-bit systems.
* gnu/packages/file.scm (file)[source]: Add patch. * gnu/packages/patches/file-32bit-time.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. Change-Id: I9511769647147eb79db2babaaa606816d77fadad
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/file.scm3
-rw-r--r--gnu/packages/patches/file-32bit-time.patch40
3 files changed, 43 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index ff2f82a23a..b296b5520e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1176,6 +1176,7 @@ dist_patch_DATA = \
%D%/packages/patches/fifengine-swig-compat.patch \
%D%/packages/patches/fifo-map-fix-flags-for-gcc.patch \
%D%/packages/patches/fifo-map-remove-catch.hpp.patch \
+ %D%/packages/patches/file-32bit-time.patch \
%D%/packages/patches/findutils-localstatedir.patch \
%D%/packages/patches/firebird-riscv64-support-pt1.patch \
%D%/packages/patches/firebird-riscv64-support-pt2.patch \
diff --git a/gnu/packages/file.scm b/gnu/packages/file.scm
index c5cdc1d7c0..016572f120 100644
--- a/gnu/packages/file.scm
+++ b/gnu/packages/file.scm
@@ -38,7 +38,8 @@
version ".tar.gz"))
(sha256
(base32
- "10jdg2fd19h2q3jrsaw7xqwy1w3qyvdfzzrv9sgjq3mv548gb5zw"))))
+ "10jdg2fd19h2q3jrsaw7xqwy1w3qyvdfzzrv9sgjq3mv548gb5zw"))
+ (patches (search-patches "file-32bit-time.patch"))))
(build-system gnu-build-system)
;; When cross-compiling, this package depends upon a native install of
diff --git a/gnu/packages/patches/file-32bit-time.patch b/gnu/packages/patches/file-32bit-time.patch
new file mode 100644
index 0000000000..671bcfdf66
--- /dev/null
+++ b/gnu/packages/patches/file-32bit-time.patch
@@ -0,0 +1,40 @@
+Upstream uses CVS, this is taken from the Github mirror
+https://github.com/file/file/commit/218fdf813fd5ccecbb8887a1b62509cd1c6dd3a1.patch
+https://sources.debian.org/src/file/1%3A5.45-2/debian/patches/1690555105.FILE5_45-1-g218fdf81.deal-with-32-bit-time-t.patch/
+
+From 218fdf813fd5ccecbb8887a1b62509cd1c6dd3a1 Mon Sep 17 00:00:00 2001
+From: Christos Zoulas <christos@zoulas.com>
+Date: Fri, 28 Jul 2023 14:38:25 +0000
+Subject: [PATCH] deal with 32 bit time_t
+
+---
+ src/file.h | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/src/file.h b/src/file.h
+index 2e0494d2f..78f574ea1 100644
+--- a/src/file.h
++++ b/src/file.h
+@@ -27,7 +27,7 @@
+ */
+ /*
+ * file.h - definitions for file(1) program
+- * @(#)$File: file.h,v 1.247 2023/07/27 19:40:22 christos Exp $
++ * @(#)$File: file.h,v 1.248 2023/07/28 14:38:25 christos Exp $
+ */
+
+ #ifndef __file_h__
+@@ -159,9 +159,11 @@
+ /*
+ * Dec 31, 23:59:59 9999
+ * we need to make sure that we don't exceed 9999 because some libc
+- * implementations like muslc crash otherwise
++ * implementations like muslc crash otherwise. If you are unlucky
++ * to be running on a system with a 32 bit time_t, then it is even less.
+ */
+-#define MAX_CTIME CAST(time_t, 0x3afff487cfULL)
++#define MAX_CTIME \
++ CAST(time_t, sizeof(time_t) > 4 ? 0x3afff487cfULL : 0x7fffffffULL)
+
+ #define FILE_BADSIZE CAST(size_t, ~0ul)
+ #define MAXDESC 64 /* max len of text description/MIME type */