Commit b48e3ae9 authored by Sergei Trofimovich's avatar Sergei Trofimovich
Browse files
parent 0878b757
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
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 */
+5 −12
Original line number Diff line number Diff line
@@ -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;

pkgs/tools/misc/file/pyzip.patch

deleted100644 → 0
+0 −36
Original line number Diff line number Diff line
From dc71304b3b1fd2ed5f7098d59fb7f6ef10cfdc85 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Sat, 31 Dec 2022 20:24:08 +0000
Subject: [PATCH] pyzip improvements (FC Stegerman)

---
 magic/Magdir/archive | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/magic/Magdir/archive b/magic/Magdir/archive
index a706556d5..d58201e69 100644
--- a/magic/Magdir/archive
+++ b/magic/Magdir/archive
@@ -1,5 +1,5 @@
 #------------------------------------------------------------------------------
-# $File: archive,v 1.179 2022/12/21 15:50:59 christos Exp $
+# $File: archive,v 1.180 2022/12/31 20:24:08 christos Exp $
 # archive:  file(1) magic for archive formats (see also "msdos" for self-
 #           extracting compressed archives)
 #
@@ -1876,9 +1876,14 @@
 # https://en.wikipedia.org/wiki/ZIP_(file_format)#End_of_central_directory_record_(EOCD)
 # by Michal Gorny <mgorny@gentoo.org>
 -2	uleshort	0
->&-22	string	PK\005\006	Zip archive, with extra data prepended
+>&-22	string	PK\005\006
+# without #!
+>>0	string	!#!	Zip archive, with extra data prepended
 !:mime	application/zip
 !:ext zip/cbz
+# with #!
+>>0	string/w	#!\ 	a
+>>>&-1	string/T	x	%s script executable (Zip archive)
 
 # ACE archive (from http://www.wotsit.org/download.asp?f=ace)
 # by Stefan `Sec` Zehl <sec@42.org>