diff --git a/pkgs/by-name/li/libarchive/fix-darwin-tmpdir-handling.patch b/pkgs/by-name/li/libarchive/fix-darwin-tmpdir-handling.patch new file mode 100644 index 000000000000..3e88c15dbdf2 --- /dev/null +++ b/pkgs/by-name/li/libarchive/fix-darwin-tmpdir-handling.patch @@ -0,0 +1,22 @@ +From 87bbe8ec8d343c70ae42ccb9606ec80ad73ceffb Mon Sep 17 00:00:00 2001 +From: Emily +Date: Tue, 29 Jul 2025 16:53:15 +0100 +Subject: [PATCH] Fix setup_mac_metadata when TMPDIR does not end with a slash + +--- + libarchive/archive_read_disk_entry_from_file.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libarchive/archive_read_disk_entry_from_file.c b/libarchive/archive_read_disk_entry_from_file.c +index 19d049770b..87389642db 100644 +--- a/libarchive/archive_read_disk_entry_from_file.c ++++ b/libarchive/archive_read_disk_entry_from_file.c +@@ -364,7 +364,7 @@ setup_mac_metadata(struct archive_read_disk *a, + tempdir = _PATH_TMP; + archive_string_init(&tempfile); + archive_strcpy(&tempfile, tempdir); +- archive_strcat(&tempfile, "tar.md.XXXXXX"); ++ archive_strcat(&tempfile, "/tar.md.XXXXXX"); + tempfd = mkstemp(tempfile.s); + if (tempfd < 0) { + archive_set_error(&a->archive, errno, diff --git a/pkgs/by-name/li/libarchive/package.nix b/pkgs/by-name/li/libarchive/package.nix index 640914afd9a0..a3e0d592c26e 100644 --- a/pkgs/by-name/li/libarchive/package.nix +++ b/pkgs/by-name/li/libarchive/package.nix @@ -48,6 +48,11 @@ stdenv.mkDerivation (finalAttrs: { url = "https://github.com/libarchive/libarchive/commit/489d0b8e2f1fafd3b7ebf98f389ca67462c34651.patch?full_index=1"; hash = "sha256-r+tSJ+WA0VKCjg+8MfS5/RqcB+aAMZ2dK0YUh+U1q78="; }) + # Fix the tests on Darwin when `$TMPDIR` does not end with a slash + # and its parent directory is not writable by the build user, as on + # Nix ≥ 2.30.0 and Lix ≥ 2.91.2, ≥ 2.92.2, ≥ 2.93.1. + # + ./fix-darwin-tmpdir-handling.patch ]; outputs = [