Skip to content

Commit 628fec4

Browse files
committed
std.Build.Cache: handle ENOENT on createFile race
There are no dir components, so you would think that this was unreachable, however we have observed on macOS two processes racing to do openat() with O_CREAT manifest in ENOENT.
1 parent ba050c1 commit 628fec4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lib/std/Build/Cache.zig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,10 @@ pub const Manifest = struct {
439439
self.manifest_file = manifest_file;
440440
self.have_exclusive_lock = true;
441441
} else |err| switch (err) {
442-
error.WouldBlock => {
442+
// There are no dir components, so you would think that this was
443+
// unreachable, however we have observed on macOS two processes racing
444+
// to do openat() with O_CREAT manifest in ENOENT.
445+
error.WouldBlock, error.FileNotFound => {
443446
self.manifest_file = try self.cache.manifest_dir.openFile(&manifest_file_path, .{
444447
.lock = .Shared,
445448
});

0 commit comments

Comments
 (0)