Skip to content

Commit c53a556

Browse files
committed
std.build.WriteFileStep: fix regression in this branch
This branch makes WriteFileStep use the same hashing algorithm as our cache system, reducing the divergence between zig build and the cache system.
1 parent 01e34c1 commit c53a556

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

lib/std/build/ConfigHeaderStep.zig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ fn make(step: *Step) !void {
135135
self.output_dir = try std.fs.path.join(gpa, &[_][]const u8{
136136
self.builder.cache_root, "o", &hash_basename,
137137
});
138-
139138
var dir = std.fs.cwd().makeOpenPath(self.output_dir, .{}) catch |err| {
140139
std.debug.print("unable to make path {s}: {s}\n", .{ self.output_dir, @errorName(err) });
141140
return err;

lib/std/build/WriteFileStep.zig

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,15 @@ fn make(step: *Step) !void {
8282
}
8383
var digest: [16]u8 = undefined;
8484
hash.final(&digest);
85-
var hash_basename: [64]u8 = undefined;
85+
var hash_basename: [digest.len * 2]u8 = undefined;
8686
_ = std.fmt.bufPrint(
8787
&hash_basename,
8888
"{s}",
8989
.{std.fmt.fmtSliceHexLower(&digest)},
9090
) catch unreachable;
91+
9192
self.output_dir = try fs.path.join(self.builder.allocator, &[_][]const u8{
92-
self.builder.cache_root,
93-
"o",
94-
&hash_basename,
93+
self.builder.cache_root, "o", &hash_basename,
9594
});
9695
var dir = fs.cwd().makeOpenPath(self.output_dir, .{}) catch |err| {
9796
std.debug.print("unable to make path {s}: {s}\n", .{ self.output_dir, @errorName(err) });

0 commit comments

Comments
 (0)