summaryrefslogtreecommitdiff
path: root/src/ninep/pane.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 09:54:20 -0300
committerGabriel Schneider <[email protected]>2026-10-01 10:16:45 -0300
commitcaa8ed077e8b9b67d18f18b3ec46891bd8d310a7 (patch)
tree05c09ee65e1a68aacffd90b137690d5b39ed9457 /src/ninep/pane.zig
parenteda60572013d046d08e253e5847a0ba588c10339 (diff)
downloadpardes-caa8ed077e8b9b67d18f18b3ec46891bd8d310a7.tar.gz
pardes-caa8ed077e8b9b67d18f18b3ec46891bd8d310a7.zip
A command line runs when its newline comes, or at its open's close, never because a write was short: a long line cut by a mount is one line
A write shorter than its message, and not a multiple of 4096, was taken as whole, its tail a line. 9ns cuts a FUSE write of up to 512 KiB into 65512-byte Twrites, the last one short, so a 600 KiB `Edit ,c/.../` arrived cut and its tail ran as an unknown control message; the 1 MiB refusal failed the same way. Each open now holds a partial line until its newline, or its release, which ends the last line; an Edit block is whole when it closes, as before. A name write with a NUL still fails its write at once. selfmount writes a 600 KiB Edit line and a 1.1 MiB line through a real 9ns mount; building.typ says how lines are cut. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/pane.zig')
-rw-r--r--src/ninep/pane.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig
index 48c2888e..e2ec31d1 100644
--- a/src/ninep/pane.zig
+++ b/src/ninep/pane.zig
@@ -914,7 +914,7 @@ fn writeFlag(p: *Pardes, req: Req, pane: *Pane, file: PaneFile) Reply {
/// (editors/acme/xfid.c:650-652). A blank inside a name is taken here, as
/// pardes names files with spaces; one at either end is refused, not
/// quietly cut off, so the name a script wrote is the name it gets.
-const e_name_char = "bad character in file name";
+pub const e_name_char = "bad character in file name";
/// Why `name` is not one file name, with the reason, or null: a newline, a
/// control byte, DEL or a C1 control (U+0080-U+009F), a blank at either
@@ -1566,10 +1566,10 @@ test "a name cut across writes is one name, applied once at its newline or its c
_ = call(p, .{ .tag = 2, .op = .write, .node = node, .handle = h, .data = "me.txt\n" });
try testing.expectEqualStrings("/tmp/pardes-name.txt", nameOf(p, p.panes[p.paneBySerial(serial).?].?));
_ = call(p, .{ .tag = 3, .op = .release, .node = node, .handle = h, .opened = true });
- // No newline, the whole write: applied at once, on its own open.
+ // No newline: held, whatever the write's size, and applied at the close.
const h3 = call(p, .{ .tag = 1, .op = .open, .node = node, .omode = 1 }).reply.handle;
_ = call(p, .{ .tag = 2, .op = .write, .node = node, .handle = h3, .data = "/tmp/pardes-closed.txt" });
- try testing.expectEqualStrings("/tmp/pardes-closed.txt", nameOf(p, p.panes[p.paneBySerial(serial).?].?));
+ try testing.expectEqualStrings("/tmp/pardes-name.txt", nameOf(p, p.panes[p.paneBySerial(serial).?].?));
_ = call(p, .{ .tag = 3, .op = .release, .node = node, .handle = h3, .opened = true });
try testing.expectEqualStrings("/tmp/pardes-closed.txt", nameOf(p, p.panes[p.paneBySerial(serial).?].?));
}