From 7a18df8aab1638622ab93fd3203930399c680544 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 09:46:55 -0300 Subject: A tag write refuses NUL and the other control characters; a Dump that fails says so A NUL written into a tag went into the dump, which the host then could not write, and Dump said nothing: a success that wrote nothing. Tag writes, the workspace's, a column's and a pane's, refuse control characters but tab and newline, DEL, C1 and bytes not UTF-8, EINVAL; and Dump reports any failure of its own instead of swallowing it. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/ninep/ctl.zig') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index d9a479fe..2958fc38 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -2026,6 +2026,17 @@ test "a served-tree pane spoils no Grep, and Look . from a gone directory is ENO try testing.expectStringStartsWith(looked.reply.ename, "look: /tmp/pardes-no-such-dir-zz: no such directory"); } +test "a tag write refuses NUL and the other control characters" { + const p = try withFile(testing.allocator, "x\n"); + defer p.deinit(); + for ([_]u64{ @intFromEnum(tree.TopFile.tag), tree.Node.ofCol(pardes.layout.columnSerial(p, 0), .tag), Node.of(serialOf(p), .tag) }) |node| { + const refused = wr(p, node, " a\x00b"); + try testing.expectEqual(E.INVAL, refused.errno()); + try testing.expectStringStartsWith(refused.reply.ename, "invalid tag text"); + try testing.expectEqual(E.INVAL, wr(p, node, " \x7f").errno()); + } +} + test "size is monotonic: growing is never refused, and a size once taken is taken again" { const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 60 }); defer p.deinit(); -- cgit v1.3