| ... | ... | @@ -188,11 +188,13 @@ pub const CacheHash = struct { |
| 188 | 188 | }; |
| 189 | 189 | |
| 190 | 190 | var iter = mem.tokenize(line, " "); |
| 191 | const size = iter.next() orelse return error.InvalidFormat; |
| 191 | 192 | const inode = iter.next() orelse return error.InvalidFormat; |
| 192 | 193 | const mtime_nsec_str = iter.next() orelse return error.InvalidFormat; |
| 193 | 194 | const digest_str = iter.next() orelse return error.InvalidFormat; |
| 194 | 195 | const file_path = iter.rest(); |
| 195 | 196 | |
| 197 | cache_hash_file.stat.size = fmt.parseInt(u64, size, 10) catch return error.InvalidFormat; |
| 196 | 198 | cache_hash_file.stat.inode = fmt.parseInt(fs.File.INode, inode, 10) catch return error.InvalidFormat; |
| 197 | 199 | cache_hash_file.stat.mtime = fmt.parseInt(i64, mtime_nsec_str, 10) catch return error.InvalidFormat; |
| 198 | 200 | base64_decoder.decode(&cache_hash_file.bin_digest, digest_str) catch return error.InvalidFormat; |
| ... | ... | @@ -216,10 +218,11 @@ pub const CacheHash = struct { |
| 216 | 218 | defer this_file.close(); |
| 217 | 219 | |
| 218 | 220 | const actual_stat = try this_file.stat(); |
| 221 | const size_match = actual_stat.size == cache_hash_file.stat.size; |
| 219 | 222 | const mtime_match = actual_stat.mtime == cache_hash_file.stat.mtime; |
| 220 | 223 | const inode_match = actual_stat.inode == cache_hash_file.stat.inode; |
| 221 | 224 | |
| 222 | | if (!mtime_match or !inode_match) { |
| 225 | if (!size_match or !mtime_match or !inode_match) { |
| 223 | 226 | self.manifest_dirty = true; |
| 224 | 227 | |
| 225 | 228 | cache_hash_file.stat = actual_stat; |
| ... | ... | @@ -392,7 +395,7 @@ pub const CacheHash = struct { |
| 392 | 395 | |
| 393 | 396 | for (self.files.items) |file| { |
| 394 | 397 | base64_encoder.encode(encoded_digest[0..], &file.bin_digest); |
| 395 | | try outStream.print("{} {} {} {}\n", .{ file.stat.inode, file.stat.mtime, encoded_digest[0..], file.path }); |
| 398 | try outStream.print("{} {} {} {} {}\n", .{ file.stat.size, file.stat.inode, file.stat.mtime, encoded_digest[0..], file.path }); |
| 396 | 399 | } |
| 397 | 400 | |
| 398 | 401 | try self.manifest_file.?.pwriteAll(contents.items, 0); |
| ... | ... | @@ -451,17 +454,10 @@ fn isProblematicTimestamp(fs_clock: i128) bool { |
| 451 | 454 | // to detect precision of seconds, because looking at the zero bits in base |
| 452 | 455 | // 2 would not detect precision of the seconds value. |
| 453 | 456 | const fs_sec = @intCast(i64, @divFloor(fs_clock, std.time.ns_per_s)); |
| 454 | | var fs_nsec = @intCast(i64, @mod(fs_clock, std.time.ns_per_s)); |
| 457 | const fs_nsec = @intCast(i64, @mod(fs_clock, std.time.ns_per_s)); |
| 455 | 458 | var wall_sec = @intCast(i64, @divFloor(wall_clock, std.time.ns_per_s)); |
| 456 | 459 | var wall_nsec = @intCast(i64, @mod(wall_clock, std.time.ns_per_s)); |
| 457 | 460 | |
| 458 | | if (std.Target.current.os.tag == .linux) { |
| 459 | | // TODO As a temporary measure while we figure out how to solve |
| 460 | | // https://github.com/ziglang/zig/issues/6082, we cut the granularity of nanoseconds |
| 461 | | // by a large amount. |
| 462 | | fs_nsec &= @as(i64, -1) << 23; |
| 463 | | } |
| 464 | | |
| 465 | 461 | // First make all the least significant zero bits in the fs_clock, also zero bits in the wall clock. |
| 466 | 462 | if (fs_nsec == 0) { |
| 467 | 463 | wall_nsec = 0; |