From b48e3ae9c265a554e31dca9aa0fcce8c287b0a71 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Thu, 3 Aug 2023 23:21:21 +0100 Subject: [PATCH 1/2] file: 5.44 -> 5.45 Changes: https://github.com/file/file/compare/FILE5_44...FILE5_45 --- pkgs/tools/misc/file/32-bit-time_t.patch | 38 ++++++++++++++++++++++++ pkgs/tools/misc/file/default.nix | 17 ++++------- pkgs/tools/misc/file/pyzip.patch | 36 ---------------------- 3 files changed, 43 insertions(+), 48 deletions(-) create mode 100644 pkgs/tools/misc/file/32-bit-time_t.patch delete mode 100644 pkgs/tools/misc/file/pyzip.patch diff --git a/pkgs/tools/misc/file/32-bit-time_t.patch b/pkgs/tools/misc/file/32-bit-time_t.patch new file mode 100644 index 00000000000..19c595215d6 --- /dev/null +++ b/pkgs/tools/misc/file/32-bit-time_t.patch @@ -0,0 +1,38 @@ +https://github.com/file/file/commit/218fdf813fd5ccecbb8887a1b62509cd1c6dd3a1.patch + +From 218fdf813fd5ccecbb8887a1b62509cd1c6dd3a1 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +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 */ diff --git a/pkgs/tools/misc/file/default.nix b/pkgs/tools/misc/file/default.nix index 45f5ed90577..589e5071da9 100644 --- a/pkgs/tools/misc/file/default.nix +++ b/pkgs/tools/misc/file/default.nix @@ -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; diff --git a/pkgs/tools/misc/file/pyzip.patch b/pkgs/tools/misc/file/pyzip.patch deleted file mode 100644 index 57f9e7ef8b6..00000000000 --- a/pkgs/tools/misc/file/pyzip.patch +++ /dev/null @@ -1,36 +0,0 @@ -From dc71304b3b1fd2ed5f7098d59fb7f6ef10cfdc85 Mon Sep 17 00:00:00 2001 -From: Christos Zoulas -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 - -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 From f0c74d421c7b089535ed437672caaa58af84eb13 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 5 Aug 2023 09:09:08 +0100 Subject: [PATCH 2/2] Update pkgs/tools/misc/file/default.nix Co-authored-by: Adam Joseph <54836058+amjoseph-nixpkgs@users.noreply.github.com> --- pkgs/tools/misc/file/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/tools/misc/file/default.nix b/pkgs/tools/misc/file/default.nix index 589e5071da9..20082bd6194 100644 --- a/pkgs/tools/misc/file/default.nix +++ b/pkgs/tools/misc/file/default.nix @@ -21,7 +21,7 @@ stdenv.mkDerivation rec { patches = [ # Upstream patch to fix 32-bit tests. - # WIll be included in 5.46+ releases. + # Will be included in 5.46+ releases. ./32-bit-time_t.patch ];