diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-30 21:06:51 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-30 22:03:33 -0300 |
| commit | c07baa7bf83039600a54b261eaae7fdd4d673768 (patch) | |
| tree | 36377f2eabd9b3cee349d8bd1cf552b3866732f2 | |
| parent | d00c40694dc239854263616f710b4a197d25d145 (diff) | |
| download | pardes-c07baa7bf83039600a54b261eaae7fdd4d673768.tar.gz pardes-c07baa7bf83039600a54b261eaae7fdd4d673768.zip | |
builtins: Tty9p is a word of every hosted build, not a Linux build's alone, so a build's words, the rows of its Help, are the same on FreeBSD: a Linux client of a box session made SPC ?'s +Help with one row more than its session's and joined again (`pane 4.file.content`, and `.splice` over a +Help made again: two of the box soak's three divergences); whether its host is Linux is the authority's answer (tape.authority), so a replica of a FreeBSD session refuses Tty9p as its session does; test/cross_replay.py's session runs Help (a FreeBSD tape replayed here diverged at its pane's content)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
| -rw-r--r-- | src/builtins.zig | 5 | ||||
| -rw-r--r-- | src/builtins_json.zig | 2 | ||||
| -rw-r--r-- | src/config.zig | 2 | ||||
| -rw-r--r-- | src/exec.zig | 10 | ||||
| -rw-r--r-- | test/cross_replay.py | 7 |
5 files changed, 18 insertions, 8 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index b101e34d..38a4d835 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1487,8 +1487,11 @@ pub const Tty = struct { }; /// A Linux terminal with the current session mounted through kernel v9fs. +/// A word of every hosted build, Linux's or not: a build's words are its +/// Help's rows, which a replica of another build's session makes as its +/// session did (a Linux client of a FreeBSD one diverged at SPC ?). pub const Tty9p = struct { - pub const enabled = pardes.hosted and @import("builtin").os.tag == .linux; + pub const enabled = pardes.hosted; pub fn run(c: Ctx) void { exec.spawnV9fsTty(c.p, c.id); } diff --git a/src/builtins_json.zig b/src/builtins_json.zig index 489f1e22..3402b2ee 100644 --- a/src/builtins_json.zig +++ b/src/builtins_json.zig @@ -74,7 +74,7 @@ pub fn write(w: *std.Io.Writer) !void { test "docs/typ/builtins-<platform>.json is what the registry says now" { // a terminal build checks its file, a window build its own; both are - // Linux builds' lists (Tty9p is Linux's) + // Linux builds' lists if (comptime @import("builtin").os.tag != .linux) return error.SkipZigTest; const file = switch (pardes.platform) { .tty => "builtins-tty.json", diff --git a/src/config.zig b/src/config.zig index ebca14ea..c1f1981c 100644 --- a/src/config.zig +++ b/src/config.zig @@ -2283,7 +2283,7 @@ const doc_typ = struct { for (std.enums.values(Builtin)) |b| if (leader_path.get(b)) |p| if (std.mem.eql(u8, p, path[0..n])) return true; for (leader_args) |la| if (std.mem.eql(u8, la.path, path[0..n])) return true; - // A word this build leaves out (Tty9p off Linux) keeps its leader in the other's. + // A word this build leaves out keeps its leader in the other's. var buf: [96]u8 = undefined; const needle = std.fmt.bufPrint(&buf, "\"leader\": \"{s}\"", .{k}) catch return false; return std.mem.indexOf(u8, other_build, needle) != null; diff --git a/src/exec.zig b/src/exec.zig index c5218279..af312c45 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -409,14 +409,20 @@ pub fn spawnTty(p: *Pardes, from: usize) ?*Pane { } pub fn spawnV9fsTty(p: *Pardes, from: usize) void { - if (comptime !hosted or @import("builtin").os.tag != .linux) + if (comptime !hosted) return p.reportError(from, "Tty9p", error.LinuxRequired); + // The session's host's and its 9P server's: a replica, of another + // build too (a Linux client of a FreeBSD session), has their answers. + if (!pardes.tape.authority(onLinux, .{})) return p.reportError(from, "Tty9p", error.LinuxRequired); - // The 9P server's: a replica has the authority's answer. if (!pardes.tape.authority(servesSocket, .{p})) return p.reportError(from, "Tty9p", error.SessionSocketRequired); _ = spawnTtyWithMount(p, from, true); } +fn onLinux() bool { + return @import("builtin").os.tag == .linux; +} + fn servesSocket(p: *Pardes) bool { return p.fs.socket_path.len != 0; } diff --git a/test/cross_replay.py b/test/cross_replay.py index 9ce7d152..21367ca1 100644 --- a/test/cross_replay.py +++ b/test/cross_replay.py @@ -20,8 +20,9 @@ Restore of a dump that is not there (errors the host reports, anyerrors). It greps and finds, as a script does, which a 9P write runs on the loop: its reads are a tape site (a replica of a session a script greps in read no file and diverged). And it holds what a digest must name the same in -every build: a +LocationsConfig, whose origin is a Builtin, and a file -pane renamed (H19: no Linux client could join a FreeBSD session so). +every build: a +LocationsConfig, whose origin is a Builtin, a file +pane renamed (H19: no Linux client could join a FreeBSD session so), and +a +Help, which lists the build's words (Tty9p was a Linux build's alone). """ import os import shutil @@ -75,7 +76,7 @@ def record(binary, out): started.append(int(status['pid'])) pane = next(int(row.split()[0]) for row in c.read('/index').splitlines() if row.split()[1] == b'text') for line in (f'Look {root / "fifo"}', f'Look {root / "dir"}', f'Save {root / "a.txt" / "x"}', - f'Restore {root / "nothing.dump"}', 'Grep hello', 'Find txt', 'LocationsConfig'): + f'Restore {root / "nothing.dump"}', 'Grep hello', 'Find txt', 'LocationsConfig', 'Help'): try: c.write(f'/pane/{pane}/exec', line.encode() + b'\n') except Exception: |
