Browse Source

Cherry-pick "Deal with 32 bit time_t" to handle timestamps correctly

Christoph Biedl 9 months ago
parent
commit
fd2be0f779

+ 21 - 0
debian/patches/1690555105.FILE5_45-1-g218fdf81.deal-with-32-bit-time-t.patch

@@ -0,0 +1,21 @@
+Subject: Deal with 32 bit time_t
+Origin: FILE5_45-1-g218fdf81 <https://github.com/file/file/commit/FILE5_45-1-g218fdf81>
+Upstream-Author: Christos Zoulas <christos@zoulas.com>
+Date: Fri Jul 28 14:38:25 2023 +0000
+
+--- a/src/file.h
++++ b/src/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 */

+ 1 - 0
debian/patches/series

@@ -1,6 +1,7 @@
 # reverted upstream commits
 
 # cherry-picked commits. Keep in upstream's chronological order
+1690555105.FILE5_45-1-g218fdf81.deal-with-32-bit-time-t.patch
 
 # patches that should go upstream
 upstream.disable.att3b.patch