diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 17:17:29 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | d1955996ce192df9e2dc4e150f204d6af53179e3 (patch) | |
| tree | 340446a1c2494b2c410f3f992068eb6ec0f6254d /src/builtins.zig | |
| parent | 3d0d5e5de54611a88826600365bf0849d9ac4871 (diff) | |
| download | pardes-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/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index 6aabba8d..6688d05f 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -666,7 +666,11 @@ pub const Restore = struct { pub const scope: Scope = .session; pub const takes_arg = true; pub fn run(c: Ctx) void { - const path = c.arg orelse (c.p.last_dump orelse return c.p.reportFailure(c.id, "Restore: no dump yet; name one")); + const typed = c.arg orelse (c.p.last_dump orelse return c.p.reportFailure(c.id, "Restore: no dump yet; name one")); + // The file it reads, whole (`~`, the DumpDir, the directory it runs + // in): what the log's `restore` record and every message name. + var full_buf: [4096]u8 = undefined; + const path = if (comptime pardes.hosted) @import("fs.zig").restorePath(typed, c.p.settings.dump_dir.get(), &full_buf) else typed; if (path.len > c.p.restore_buf.len) return c.p.reportFailure(c.id, "Restore: that name is too long"); // A dump that cannot be read is said now, and fails a ctl write: the // host reads it only after this step, where nobody hears. First, |
