summaryrefslogtreecommitdiff
path: root/core/ninep
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-19 05:01:46 -0300
committerGabriel Schneider <[email protected]>2026-11-19 05:54:00 -0300
commit5b857bb55fae0a220f54b140bc1b46c3efb991bb (patch)
treeb7dc6411697229b6e26486f6e306f1c5d599ea30 /core/ninep
parent0a9546f1d206f4ab55063e1c26c668e9626b3929 (diff)
downloadpardes-5b857bb55fae0a220f54b140bc1b46c3efb991bb.tar.gz
pardes-5b857bb55fae0a220f54b140bc1b46c3efb991bb.zip
core: the session's facts are the core's state, read once at its start (the reorganisation's 12b, the design round's step 3; the user's ruling P16 and the lean put with P17: a far client's `~`, default shell and "is this shell installed" are the session's): its home (`~`) and the shell its terminals run when no `Shell` is set ($SHELL if executable, else /bin/sh) are fields beside `session_dir`, `session_home` and `session_shell` (working names, the user's to rule), each read once with `session_dir` by Pardes.readSessionFacts (tape.value(.env): a replay of the boot reads the session's answers), at the session's start and after a load of a dump made before they were dumped, and carried by the dump; `sessionDir` no longer fills itself at first use (it was filled at the start already), and a client's step reads the session's, never its own machine's: Pardes.expandHome (`~` the session's home; `~user` a passwd read, taped, as before) at Save, a tag's name, Theme's path, Get, Incl, a Look of `~/x`, a 9P name and pager, Dump's path, sam's B, e, r and w (sam_edit.World.home) and DumpDir's check (config.Runtime.apply takes the home); bare `Shell`, the shell a terminal runs, the settings report and its 9P twins read `session_shell`; "is this shell installed" (Shell <bin>, Term <bin>, a 9P exec) is a question to the session's disk, tape.site, so far away it waits a round trip instead of answering from the client's machine and rolling back; deleted: the value reads at config.defaultShell (now the process's read, made at the start alone) and at Core.sessionDir, and the tape's `cwd` tag (the directory is read under `env` at the start); fs.expandHome stays for this process's own home, the launcher's (runtime/main.zig) and the state file's directory and a Restore's name (the session's side: a client's Restore waits, its replay reads the tape); the tape's shape changes (`cwd` gone, `shell` a site), so the semantics word moves (the tape's shape now hashes the sites too: it did not see a site gone or added, and this change alone left it as it was), adacca2db2b39264 -> 517cd1c276996a3c: an old build and a new refuse each other's clients, in words; a test at the end of core/replica.zig (a joined client's own `Look ~/x`, bare `Shell` and Tutor, a word run in the session's directory, record no `env` read; the client's shell and directory are the session's), shown failing on the change before (`Look ~/x` read the environment); not handled: a Restore of a dump carries that dump's facts (as `session_dir` did); tui core-test 833/976 (143 skipped), shell-test 1011/1014, pane-test 183/184, behaviour-test 275/275 and --replay 275/275, process-test 2 of 144 failed (lspcomplete, lspcompletemoved, the base's; hscroll flaked once), replicas --clients 5 diverged 0 unequal 0 deltas wrong 0 quiet differ 0 at 30/80/207 ms, stopped 89/73/108, gui unit-test 1609/1613 (its perf check's BaselineHarnessMismatch the base's), daemon.py plain, --far, --games, --window-clients pass; gate-w seam-b-3 against tree1: 77/77 frames byte-identical in Debug, its unit-test 1609/1613, perfab corpus2x +0.095% (pictures identical in all 10 runs), perfops 97 counts within 0.1% (largest +0.0198%, body-appends on longline)
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/ninep')
-rw-r--r--core/ninep/ctl.zig8
-rw-r--r--core/ninep/pane.zig2
-rw-r--r--core/ninep/pty.zig2
3 files changed, 6 insertions, 6 deletions
diff --git a/core/ninep/ctl.zig b/core/ninep/ctl.zig
index 2b26c3e2..81600582 100644
--- a/core/ninep/ctl.zig
+++ b/core/ninep/ctl.zig
@@ -571,7 +571,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ?
.callstack_depth => arg.len == 0 or (std.fmt.parseInt(u8, arg, 10) catch 0) -% 1 < pardes.lsp.callstack_max_depth,
else => probe: {
var probe = p.settings;
- break :probe probe.apply(setting, if (arg.len > 0) arg else null);
+ break :probe probe.apply(setting, if (arg.len > 0) arg else null, p.sessionHome());
},
};
if (takes) return null;
@@ -638,7 +638,7 @@ fn writeSettingsFor(p: *Pardes, s: *const config.Runtime, w: *std.Io.Writer, cap
.locations = located.buffered(),
.theme_name = p.theme().name,
.theme_file = pardes.colors.loadedThemeFile(p),
- .compiled_default_shell = config.defaultShell(),
+ .compiled_default_shell = p.sessionShell(),
.default_dump_dir = pardes.dump.defaultDirectory(&dump_dir) orelse "",
.capabilities = caps,
.state = s,
@@ -669,7 +669,7 @@ pub fn writePager(p: *Pardes, req: Req) Reply {
// `~` is home, and `/tmp/../etc` is `/etc`: the +Pager is named in the
// directory it is, as any other pane's name is.
var home_buf: [4096]u8 = undefined;
- const typed = pardes.filesystem.expandHome(std.mem.trim(u8, line, " \t"), &home_buf);
+ const typed = p.expandHome(std.mem.trim(u8, line, " \t"), &home_buf);
const dir = if (typed.len > 0 and typed[0] == '/') std.Io.Dir.path.resolvePosix(p.scratch.allocator(), &.{typed}) catch typed else typed;
// A directory that is there, or none (the session's): never a +Pager
// named into one missing, nor a relative one quietly taken for none.
@@ -1771,7 +1771,7 @@ test "after a ThemeFile the root ctl and DumpConfig say ThemeFile and its path,
.platform = @tagName(pardes.platform),
.theme_name = p.theme().name,
.theme_file = pardes.colors.loadedThemeFile(p),
- .compiled_default_shell = config.defaultShell(),
+ .compiled_default_shell = p.sessionShell(),
.hover_delay_frames = config.look_preview_delay_frames,
.native_images = false,
.capabilities = builtins.capabilities,
diff --git a/core/ninep/pane.zig b/core/ninep/pane.zig
index b940bdd6..16d7762a 100644
--- a/core/ninep/pane.zig
+++ b/core/ninep/pane.zig
@@ -894,7 +894,7 @@ fn writeName(p: *Pardes, req: Req, id: usize, pane: *Pane) Reply {
// Words 9ns maps to EINVAL, as every refusal of a name here.
if (fileOf(pane) == null) return tree.failText(req.tag, E.INVAL, unnamed(pane));
var home_buf: [4096]u8 = undefined;
- const full = std.Io.Dir.path.resolvePosix(p.scratch.allocator(), &.{ pardes.Pardes.paneDir(pane), fs.expandHome(name, &home_buf) }) catch
+ const full = std.Io.Dir.path.resolvePosix(p.scratch.allocator(), &.{ pardes.Pardes.paneDir(pane), p.expandHome(name, &home_buf) }) catch
return Reply.fail(req.tag, E.NOMEM);
if (!std.Io.Dir.path.isAbsolute(full) or full.len >= 4096) return tree.failText(req.tag, E.INVAL, "invalid file name: longer than a path may be");
// A directory (`~`, `/`, `foo/`) is no file to name a pane after: a
diff --git a/core/ninep/pty.zig b/core/ninep/pty.zig
index a66d9f23..0fd75aa2 100644
--- a/core/ninep/pty.zig
+++ b/core/ninep/pty.zig
@@ -66,7 +66,7 @@ pub fn writeCtl(p: *Pardes, req: Req, id: usize) Reply {
// interpreter is not: refused, and the running shell kept.
const bin = pane.shell orelse p.shellBin();
var why: [320]u8 = undefined;
- if (pardes.tape.value(.shell, @import("dev").host_io.Shell.refusal, .{ bin[0..@min(bin.len, 200)], &why })) |refused|
+ if (pardes.tape.site(.shell, null, @import("dev").host_io.Shell.refusal, .{ bin[0..@min(bin.len, 200)], &why })) |refused|
return tree.failText(req.tag, E.NOENT, std.fmt.bufPrint(&p.fs.ename, "exec: {s}", .{refused[0..@min(refused.len, 300)]}) catch &p.fs.ename); // cut to ename's 320
};
if (verb(p, id, line, apply)) |why| return tree.failText(req.tag, E.INVAL, why);