summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-30 17:17:29 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commitd1955996ce192df9e2dc4e150f204d6af53179e3 (patch)
tree340446a1c2494b2c410f3f992068eb6ec0f6254d /src/ninep
parent3d0d5e5de54611a88826600365bf0849d9ac4871 (diff)
downloadpardes-d1955996ce192df9e2dc4e150f204d6af53179e3.tar.gz
pardes-d1955996ce192df9e2dc4e150f204d6af53179e3.zip
A Restore logs and names the whole path of the dump it reads, not the name as typed
`Restore x.dump.zon` read the DumpDir's x.dump.zon but logged `restore x.dump.zon`, and `~/d.zon` logged the tilde. A follower could not tell which file was restored. The builtin now resolves the name once (fs.restorePath: `~` expanded, a relative name the DumpDir's when one is there, else the current directory's) and hands that path to the host, which reads it and logs `restore <path>`. Its messages name it too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/ctl.zig16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index aebd07e2..fdc83da8 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -2589,6 +2589,22 @@ test "a focus moved over 9P tells the programs that asked for focus reports, as
try testing.expectEqualStrings("\x1b[O\x1b[I", moved.pty_buf[0..moved.pty_len]);
}
+test "a Restore of a name in the DumpDir asks for, and logs, the whole path it reads" {
+ if (comptime !pardes.hosted) return error.SkipZigTest;
+ const p = try withFile(testing.allocator, "x\n");
+ defer p.deinit();
+ try pardes.dump.dumpState(p);
+ var tmp = testing.tmpDir(.{});
+ defer tmp.cleanup();
+ try tmp.dir.writeFile(testing.io, .{ .sub_path = "x.dump.zon", .data = p.dump_out.? });
+ var buf: [4096]u8 = undefined;
+ const dir = buf[0..try tmp.dir.realPath(testing.io, &buf)];
+ try testing.expect(p.settings.dump_dir.set(dir));
+ try testing.expectEqual(Status.ok, wr(p, @intFromEnum(tree.TopFile.ctl), "Restore x.dump.zon\n").reply.status);
+ var want: [4200]u8 = undefined;
+ try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{s}/x.dump.zon", .{dir}), p.restore_req.?);
+}
+
test "a line starting with # runs as nothing at an exec or a ctl, silently" {
const p = try withFile(testing.allocator, "x\n");
defer p.deinit();