summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 09:52:33 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commita72d0c6650242a9b02858de7020e9a4ae387ebba (patch)
tree8f3d44da4e32ad85bf7abf52c2852dbe62a7904f /src/ninep/ctl.zig
parentad3403adb72e3457eb76d6b3fc91cf8df3d738ae (diff)
downloadpardes-a72d0c6650242a9b02858de7020e9a4ae387ebba.tar.gz
pardes-a72d0c6650242a9b02858de7020e9a4ae387ebba.zip
A name shows its own backslash as \\, and a terminal tag never carries a raw newline
With `\n` for a newline and `\xNN` for a bad byte, a name holding a backslash and an n read back as one holding a newline. Names in /index, the log and a terminal's tag now double their own backslashes; and a terminal's directory with a newline no longer breaks its tag. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 2958fc38..2b256b1e 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -1999,6 +1999,13 @@ test "/index shows a name as the log does: a newline in it is \\n, controls spac
try testing.expect(std.mem.indexOf(u8, index, "/tmp/two\\nlines \\xff ") != null);
try testing.expectEqual(@as(usize, 1), std.mem.count(u8, index, "\n"));
try testing.expectEqual(@as(u64, index.len), call(p, .{ .tag = 1, .op = .getattr, .node = @intFromEnum(tree.TopFile.index) }).reply.attr.size);
+ // Its tag never carries the raw newline either.
+ const tag = rd(p, Node.of(serialOf(p), .tag), 0, 4096).bytes;
+ try testing.expect(std.mem.indexOf(u8, tag, "/tmp/two\\nlines") != null);
+ // A backslash of the name's own is doubled: `\n` written in a name
+ // reads back unlike a newline.
+ p.setCwd(term, "/tmp/back\\nslash");
+ try testing.expect(std.mem.indexOf(u8, rd(p, @intFromEnum(tree.TopFile.index), 0, 4096).bytes, "/tmp/back\\\\nslash") != null);
}
test "a served-tree pane spoils no Grep, and Look . from a gone directory is ENOENT, not /virtual/" {