diff --git a/BRANCH_TODO b/BRANCH_TODO index 9665ba3d0e..a579d4a5eb 100644 --- a/BRANCH_TODO +++ b/BRANCH_TODO @@ -1,4 +1,3 @@ - * docs are failing to build * MachO LLD linking * WASM LLD linking * audit the CLI options for stage2 diff --git a/src/Cache.zig b/src/Cache.zig index 425c6407a3..dff6f7e38e 100644 --- a/src/Cache.zig +++ b/src/Cache.zig @@ -528,14 +528,15 @@ pub const Manifest = struct { } pub fn writeManifest(self: *Manifest) !void { - assert(self.manifest_file != null); + const manifest_file = self.manifest_file.?; if (!self.manifest_dirty) return; - var encoded_digest: [hex_digest_len]u8 = undefined; var contents = std.ArrayList(u8).init(self.cache.gpa); - var writer = contents.writer(); defer contents.deinit(); + const writer = contents.writer(); + var encoded_digest: [hex_digest_len]u8 = undefined; + for (self.files.items) |file| { _ = std.fmt.bufPrint(&encoded_digest, "{x}", .{file.bin_digest}) catch unreachable; try writer.print("{d} {d} {d} {s} {s}\n", .{ @@ -547,7 +548,8 @@ pub const Manifest = struct { }); } - try self.manifest_file.?.pwriteAll(contents.items, 0); + try manifest_file.setEndPos(contents.items.len); + try manifest_file.pwriteAll(contents.items, 0); self.manifest_dirty = false; }