authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-10-14 13:34:03-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-10-14 17:42:15-07:00
log35c2541cf9924cdcccf666afb173320fd610e9ef
tree143a8b191abc2b8bb321f58bb8e69ba43ec38a36
parent4a0cadf85b3dd751908158bd3703ea50456d7d8a

Maker: exempt forked packages from validateFingerprints

because they intentionally override multiple packages hashes to have the forked contents.

1 files changed, 12 insertions(+), 3 deletions(-)

lib/compiler/Maker.zig+12-3
......@@ -1398,7 +1398,7 @@ fn configure(graph: *Graph, options: ConfigureOptions) !ScannedConfig {
13981398 process.exit(0);
13991399 }
14001400
1401 try validateFingerprints(gpa, &job_queue);
1401 try validateFingerprints(gpa, &job_queue, &fork_set);
14021402
14031403 // Create the dependencies.zig file for configurer to
14041404 // obtain via `@import("@dependencies")`.
......@@ -1749,7 +1749,11 @@ const ValidFingerprintTable = std.array_hash_map.Custom(
17491749
17501750/// Ensure that the dependency tree did not have any fingerprint matches with the same semantic version but
17511751/// differing package hashes.
1752fn validateFingerprints(gpa: Allocator, job_queue: *const Fetch.JobQueue) !void {
1752fn validateFingerprints(
1753 gpa: Allocator,
1754 job_queue: *const Fetch.JobQueue,
1755 fork_set: *const Package.Fetch.JobQueue.ForkSet,
1756) !void {
17531757 var any_errors = false;
17541758
17551759 var table: ValidFingerprintTable = .empty;
......@@ -1757,8 +1761,13 @@ fn validateFingerprints(gpa: Allocator, job_queue: *const Fetch.JobQueue) !void
17571761
17581762 for (job_queue.table.keys(), job_queue.table.values()) |pkg_hash, fetch| {
17591763 if (!fetch.have_manifest) continue;
1764
1765 // Forked packages are exempt since they overide multiple package hashes to have the forked contents.
1766 const project_id: Package.ProjectId = .init(fetch.manifest.name, fetch.manifest.id);
1767 if (fork_set.containsAdapted(project_id, @as(Fetch.JobQueue.Fork.Adapter, .{}))) continue;
1768
17601769 const gop = try table.getOrPut(gpa, .{
1761 .project_id = .init(fetch.manifest.name, fetch.manifest.id),
1770 .project_id = project_id,
17621771 .version = fetch.manifest.version,
17631772 });
17641773 if (gop.found_existing) {