authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-02-13 17:05:21-08:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-02-14 09:34:15+01:00
logf996d28666e7d562b6a18e9f80fe31a3463456d0
tree71a93aa03b23429488dfa7396bcb914ed3cd68df
parent017228de89ef2ea4ed229c4eea62317826a909b6

fetch: use tmp dir inside zig-pkg/

Using the tmp dir of the local .zig-cache/ could result in error.CrossDevice if the user chose a non-default local cache path. closes #31148

1 files changed, 2 insertions(+), 4 deletions(-)

src/Package/Fetch.zig+2-4
......@@ -684,15 +684,13 @@ fn runResource(
684684
685685 const arena = f.arena.allocator();
686686 const eb = &f.error_bundle;
687 const s = fs.path.sep_str;
688 const local_cache_root = job_queue.local_cache;
689687 const rand_int = r: {
690688 var x: u64 = undefined;
691689 io.random(@ptrCast(&x));
692690 break :r x;
693691 };
694 const tmp_dir_sub_path = "tmp" ++ s ++ std.fmt.hex(rand_int);
695 const tmp_directory_path = try local_cache_root.join(arena, tmp_dir_sub_path);
692 const tmp_dir_sub_path = ".tmp-" ++ std.fmt.hex(rand_int);
693 const tmp_directory_path = try job_queue.root_pkg_path.join(arena, tmp_dir_sub_path);
696694
697695 const package_sub_path = blk: {
698696 var tmp_directory: Cache.Directory = .{