diff options
| -rw-r--r-- | src/look.zig | 5 | ||||
| -rw-r--r-- | test/fs.py | 4 |
2 files changed, 9 insertions, 0 deletions
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); } @@ -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'') |
