authorgravatar for techatrix@mailbox.orgTechatrix <techatrix@mailbox.org> 2026-06-23 17:48:27+02:00
committergravatar for techatrix@mailbox.orgTechatrix <techatrix@mailbox.org> 2026-07-03 19:33:58+02:00
log59451cce931230af873a6f789d9178cea70d73ea
tree6eee8d9d1e3618a96be30e73def3451ef8c49ec6
parentca8f037b34d642bfa5aff1047d36032efebe5284
signaturebadge-check Signed by SSH key SHA256:HYC3SjXQcAt6uwv9pu/6OoVQ2rUH8rb5zKiUHSe9uxk

std.Build.Cache: skip over prefixes that are the cwd

Any of the added cache prefixes may be the cwd itself. Skip them like the null prefix.

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

lib/std/Build/Cache.zig+3-5
...@@ -90,10 +90,8 @@ fn findPrefix(cache: *const Cache, file_path: []const u8) !PrefixedPath {...@@ -90,10 +90,8 @@ fn findPrefix(cache: *const Cache, file_path: []const u8) !PrefixedPath {
90fn findPrefixResolved(cache: *const Cache, resolved_path: []u8) !PrefixedPath {90fn findPrefixResolved(cache: *const Cache, resolved_path: []u8) !PrefixedPath {
91 const gpa = cache.gpa;91 const gpa = cache.gpa;
92 const cwd = cache.cwd;92 const cwd = cache.cwd;
93 const prefixes_slice = cache.prefixes();93 for (cache.prefixes(), 0..) |prefix, i| {
94 var i: u8 = 1; // Start at 1 to skip over checking the null prefix.94 const p = prefix.path orelse continue;
95 while (i < prefixes_slice.len) : (i += 1) {
96 const p = prefixes_slice[i].path.?;
97 const sub_path = getPrefixSubpath(gpa, cwd, p, resolved_path) catch |err| switch (err) {95 const sub_path = getPrefixSubpath(gpa, cwd, p, resolved_path) catch |err| switch (err) {
98 error.NotASubPath => continue,96 error.NotASubPath => continue,
99 else => |e| return e,97 else => |e| return e,
...@@ -101,7 +99,7 @@ fn findPrefixResolved(cache: *const Cache, resolved_path: []u8) !PrefixedPath {...@@ -101,7 +99,7 @@ fn findPrefixResolved(cache: *const Cache, resolved_path: []u8) !PrefixedPath {
101 // Free the resolved path since we're not going to return it99 // Free the resolved path since we're not going to return it
102 gpa.free(resolved_path);100 gpa.free(resolved_path);
103 return .{101 return .{
104 .prefix = i,102 .prefix = @intCast(i),
105 .sub_path = sub_path,103 .sub_path = sub_path,
106 };104 };
107 }105 }