From 4d57197f0135c292750731dd19a6df542378135d Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 10:16:45 -0300 Subject: A look at a path not there under a peer's mount is a miss, the write answered, as any path to no file is It failed the write with the peer's "file does not exist". A file not found, here or through a mount, is now said and logged as a miss. Co-Authored-By: Claude Opus 5.5 --- src/look.zig | 5 +++++ test/fs.py | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/look.zig b/src/look.zig index 19b320f9..115dabe1 100644 --- a/src/look.zig +++ b/src/look.zig @@ -1251,6 +1251,11 @@ test "a miss names a long path by its start and its end, its middle given up to fn lookOpenFailed(p: *Pardes, id: usize, path: []const u8, err: anyerror) void { if (@import("Messages.zig").dialReason(err) != null) return p.reportError(id, path, err); var cut: [miss_path_cap + "…".len]u8 = undefined; + // Not there, on a peer's mount as on this host: a miss, the write + // answered, as any path to no file is. + const remote_missing = if (comptime pardes.hosted) err == error.Remote and std.mem.indexOf(u8, @import("9p_io.zig").Client.lastSaid(), "not exist") != null else false; + if (err == error.FileNotFound or err == error.NotFound or remote_missing) + return missed(p, id, "{s}: no such file", .{missText(path, &cut)}); var said: [miss_path_cap + 16]u8 = undefined; p.reportError(id, std.fmt.bufPrint(&said, "look: {s}", .{missText(path, &cut)}) catch "look", err); } diff --git a/test/fs.py b/test/fs.py index 424a67e2..8eed2e29 100644 --- a/test/fs.py +++ b/test/fs.py @@ -1132,6 +1132,10 @@ def test(binary, quic=False): remote.write(f'/pane/{opened}/exec', b'Save\n') assert large_path.read_bytes() == edited assert client.read('/os' + str(large_path)) == edited + # A path not there under a peer's mount is a miss, as any + # path to no file is: the write answered, the err logged. + remote.write('/look', b'/n/peer/os' + str(root / 'no-such-file.txt').encode() + b'\n') + assert b'no such file' in remote.read('/log') with session(binary, root, 'runtime') as (remote, own_address): control = new_pane(remote, b'') -- cgit v1.3