| ... | @@ -3569,20 +3569,25 @@ pub fn astGenFile(mod: *Module, file: *File) !void { | ... | @@ -3569,20 +3569,25 @@ pub fn astGenFile(mod: *Module, file: *File) !void { |
| 3569 | // If another process is already working on this file, we will get the cached | 3569 | // If another process is already working on this file, we will get the cached |
| 3570 | // version. Likewise if we're working on AstGen and another process asks for | 3570 | // version. Likewise if we're working on AstGen and another process asks for |
| 3571 | // the cached file, they'll get it. | 3571 | // the cached file, they'll get it. |
| 3572 | const cache_file = zir_dir.createFile(&digest, .{ | 3572 | const cache_file = while (true) { |
| 3573 | .read = true, | 3573 | break zir_dir.createFile(&digest, .{ |
| 3574 | .truncate = false, | 3574 | .read = true, |
| 3575 | .lock = lock, | 3575 | .truncate = false, |
| 3576 | }) catch |err| switch (err) { | 3576 | .lock = lock, |
| 3577 | error.NotDir => unreachable, // no dir components | 3577 | }) catch |err| switch (err) { |
| 3578 | error.InvalidUtf8 => unreachable, // it's a hex encoded name | 3578 | error.NotDir => unreachable, // no dir components |
| 3579 | error.BadPathName => unreachable, // it's a hex encoded name | 3579 | error.InvalidUtf8 => unreachable, // it's a hex encoded name |
| 3580 | error.NameTooLong => unreachable, // it's a fixed size name | 3580 | error.BadPathName => unreachable, // it's a hex encoded name |
| 3581 | error.PipeBusy => unreachable, // it's not a pipe | 3581 | error.NameTooLong => unreachable, // it's a fixed size name |
| 3582 | error.WouldBlock => unreachable, // not asking for non-blocking I/O | 3582 | error.PipeBusy => unreachable, // it's not a pipe |
| 3583 | error.FileNotFound => unreachable, // no dir components | 3583 | error.WouldBlock => unreachable, // not asking for non-blocking I/O |
| 3584 | | 3584 | // There are no dir components, so you would think that this was |
| 3585 | else => |e| return e, // Retryable errors are handled at callsite. | 3585 | // unreachable, however we have observed on macOS two processes racing |
| | 3586 | // to do openat() with O_CREAT manifest in ENOENT. |
| | 3587 | error.FileNotFound => continue, |
| | 3588 | |
| | 3589 | else => |e| return e, // Retryable errors are handled at callsite. |
| | 3590 | }; |
| 3586 | }; | 3591 | }; |
| 3587 | defer cache_file.close(); | 3592 | defer cache_file.close(); |
| 3588 | | 3593 | |