Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions pkgs/tools/misc/file/32-bit-time_t.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
https://github.com/file/file/commit/218fdf813fd5ccecbb8887a1b62509cd1c6dd3a1.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 */
17 changes: 5 additions & 12 deletions pkgs/tools/misc/file/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,22 @@

stdenv.mkDerivation rec {
pname = "file";
version = "5.44";
version = "5.45";

src = fetchurl {
urls = [
"https://astron.com/pub/file/${pname}-${version}.tar.gz"
"https://distfiles.macports.org/file/${pname}-${version}.tar.gz"
];
sha256 = "sha256-N1HH+6jbyDHLjXzIr/IQNUWbjOUVXviwiAon0ChHXzs=";
hash = "sha256-/Jf1ECm7DiyfTjv/79r2ePDgOe6HK53lwAKm0Jx4TYI=";
};

outputs = [ "out" "dev" "man" ];

patches = [
# Backport fix to identification for pyzip files.
# Needed for strip-nondeterminism.
# https://salsa.debian.org/reproducible-builds/strip-nondeterminism/-/issues/20
./pyzip.patch

# Backport fix for --uncompress always detecting contents as "empty"
(fetchurl {
url = "https://gitweb.gentoo.org/repo/gentoo.git/plain/sys-apps/file/files/file-5.44-decompress-empty.patch?h=dfc57da515a2aaf085bea68267cc727f1bfaa691";
hash = "sha256-fUzRQAlLWczBmR5iA1Gk66mHjP40MJcMdgCtm2+u1SQ=";
})
# Upstream patch to fix 32-bit tests.
# Will be included in 5.46+ releases.
./32-bit-time_t.patch
];

strictDeps = true;
Expand Down
36 changes: 0 additions & 36 deletions pkgs/tools/misc/file/pyzip.patch

This file was deleted.