From 501aab04c33c6ee23503d8d72a4ac225b9be1acb Mon Sep 17 00:00:00 2001 From: Michael Daniels Date: Wed, 6 May 2026 09:46:35 -0400 Subject: [PATCH 1/2] file: add patches Fixes https://github.com/NixOS/nixpkgs/pull/514964#issuecomment-4367185856 --- ...Revert-previous-and-always-set-offse.patch | 26 +++++++++++++++++++ pkgs/tools/misc/file/default.nix | 2 ++ 2 files changed, 28 insertions(+) create mode 100644 pkgs/tools/misc/file/0002-PR-725-inliniac-Revert-previous-and-always-set-offse.patch diff --git a/pkgs/tools/misc/file/0002-PR-725-inliniac-Revert-previous-and-always-set-offse.patch b/pkgs/tools/misc/file/0002-PR-725-inliniac-Revert-previous-and-always-set-offse.patch new file mode 100644 index 000000000000..ff405c446597 --- /dev/null +++ b/pkgs/tools/misc/file/0002-PR-725-inliniac-Revert-previous-and-always-set-offse.patch @@ -0,0 +1,26 @@ +From c54605718190ad8fe9c25cb475f1f32ca7cd54f7 Mon Sep 17 00:00:00 2001 +From: Christos Zoulas +Date: Sun, 12 Apr 2026 22:15:14 +0000 +Subject: [PATCH] PR/725: inliniac: Revert previous and always set offset. + +--- + src/softmagic.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/src/softmagic.c b/src/softmagic.c +index 9aaf8b3e..7cf7c798 100644 +--- a/src/softmagic.c ++++ b/src/softmagic.c +@@ -1577,8 +1577,7 @@ normal: + ms->offset = offset; + ms->eoffset = 0; + } else { +- if (b->fd != -1) +- ms->offset = ms->eoffset + offset; ++ ms->offset = ms->eoffset + offset; + } + } + if ((ms->flags & MAGIC_DEBUG) != 0) { +-- +2.51.2 + diff --git a/pkgs/tools/misc/file/default.nix b/pkgs/tools/misc/file/default.nix index dd856e5aef20..ae27a481b38f 100644 --- a/pkgs/tools/misc/file/default.nix +++ b/pkgs/tools/misc/file/default.nix @@ -39,6 +39,8 @@ stdenv.mkDerivation (finalAttrs: { # Vendored patch because using fetchpatch is impossible for a package in # this part of the bootstrap chain. ./0001-PR-745-streamout-Don-t-flush-when-trying-to-set-nega.patch + # Fixes breakage of python3Packages.python-magic and xdg-utils + ./0002-PR-725-inliniac-Revert-previous-and-always-set-offse.patch ]; strictDeps = true; From 29355bc4e7115956771301968abbbd4c787d20f1 Mon Sep 17 00:00:00 2001 From: Adam Thompson-Sharpe Date: Wed, 6 May 2026 12:10:44 -0400 Subject: [PATCH 2/2] python3Packages.python-magic: fix parquet tests for file 5.47 Edits the test to accept outputs from file 5.47 in addition to older versions. (cherry picked from commit 42aab0171bd46512ac3bb651b139827cc7e771c6) --- .../python-modules/python-magic/default.nix | 3 +++ .../python-magic/fix-parquet-test.patch | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 pkgs/development/python-modules/python-magic/fix-parquet-test.patch diff --git a/pkgs/development/python-modules/python-magic/default.nix b/pkgs/development/python-modules/python-magic/default.nix index b0aeb1264a38..adcbc9e547da 100644 --- a/pkgs/development/python-modules/python-magic/default.nix +++ b/pkgs/development/python-modules/python-magic/default.nix @@ -38,6 +38,9 @@ buildPythonPackage rec { url = "https://github.com/ahupp/python-magic/commit/3d2405ca80cd39b2a91decd26af81dcf181390a4.patch"; hash = "sha256-HRsnO9MGfMD9BkJdC4SrEFQ1OZEaXpwakXFLoaCPK94="; }) + + # Fix test failures due to modified output in file 5.47 + ./fix-parquet-test.patch ]; preCheck = '' diff --git a/pkgs/development/python-modules/python-magic/fix-parquet-test.patch b/pkgs/development/python-modules/python-magic/fix-parquet-test.patch new file mode 100644 index 000000000000..6062b28d30ca --- /dev/null +++ b/pkgs/development/python-modules/python-magic/fix-parquet-test.patch @@ -0,0 +1,20 @@ +--- a/test/python_magic_test.py ++++ b/test/python_magic_test.py +@@ -93,7 +93,7 @@ class MagicTest(unittest.TestCase): + 'magic._pyc_': ('application/octet-stream', 'text/x-bytecode.python', 'application/x-bytecode.python'), + 'test.pdf': 'application/pdf', + 'test.gz': ('application/gzip', 'application/x-gzip'), +- 'test.snappy.parquet': 'application/octet-stream', ++ 'test.snappy.parquet': ('application/octet-stream', 'application/vnd.apache.parquet'), + 'text.txt': 'text/plain', + b'\xce\xbb'.decode('utf-8'): 'text/plain', + b'\xce\xbb': 'text/plain', +@@ -123,7 +123,7 @@ class MagicTest(unittest.TestCase): + ': Sun Jun 29 01:32:52 2008, from Unix, truncated' + ), + 'text.txt': 'ASCII text', +- 'test.snappy.parquet': ('Apache Parquet', 'Par archive data'), ++ 'test.snappy.parquet': ('Apache Parquet', 'Apache Parquet file', 'Par archive data'), + }, buf_equals_file=False) + finally: + del os.environ['TZ']