From dd6a3c2c367cee12a8e2da81e7da6a2c8f3103d5 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 23:20:19 -0300 Subject: Round 39's small ones: a name write past its one line is refused by that write; Get and Edit's e load over a scratch under 100 bytes unasked, as Del closes it; Putall saves a Zerox pair once; bare Tab on the root ctl says the width as from a pane, and a ctl check of Tab no longer sets it; a directory read is "is a directory" (EISDIR), an unreadable file "permission denied" (EACCES), Incl of a file "not a directory" (ENOTDIR), and a device "not a regular file", never read to the stream limit Co-Authored-By: Claude Opus 5.5 --- src/ninep/tree.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/ninep/tree.zig') diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig index 1990d09e..c78a1aa2 100644 --- a/src/ninep/tree.zig +++ b/src/ninep/tree.zig @@ -1270,6 +1270,16 @@ fn writeLines(p: *Pardes, req: Req, target: Target) Reply { data = data[nl + 1 ..]; if (data.len == 0) return .{ .tag = req.tag, .written = @intCast(req.data.len) }; } + // One name an open, on one line: anything after its newline, in this + // write or a later one, is refused by the write that brings it, never + // left to rename the pane again at the close (`printf 'a\nb' > name`). + if (target == .pane and target.pane.file == .name) { + const past_newline = if (std.mem.indexOfScalar(u8, data, '\n')) |nl| nl + 1 < data.len else false; + if (o.named or past_newline) { + o.pending.clearRetainingCapacity(); + return failText(req.tag, E.INVAL, "invalid file name: one name a write, on one line"); + } + } o.pending.appendSlice(p.gpa, data) catch return Reply.fail(req.tag, E.NOMEM); // A line runs when its newline comes, or, the last one, when its open // is let go (release). Nothing is inferred from a write's size: a mount -- cgit v1.3