summaryrefslogtreecommitdiff
path: root/src/ninep/tree.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 14:37:21 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitd678a63e0abf2ba8994225a9f0fd0047fee4025a (patch)
tree9c1a13fe7895ec162e9ee24de2913f2375375241 /src/ninep/tree.zig
parent25c847e28ae77f5c648d423d64011736f55eda4a (diff)
downloadpardes-d678a63e0abf2ba8994225a9f0fd0047fee4025a.tar.gz
pardes-d678a63e0abf2ba8994225a9f0fd0047fee4025a.zip
Every catch unreachable, orelse unreachable and syscall assert outside tests is a real refusal or says why it cannot fire
A sweep for round 23's crash: a run's answer (pty/run) was bufPrint'd into 48 bytes with catch unreachable, so a foreground program's long name (macOS gives up to 32 bytes) panicked; it now cuts at the room, keeping its newline, in 96 bytes. The rest were numbers into buffers sized for them, a braille codepoint, pthread calls on the queue's own mutex, and pdf_view's resolved outline entries: each now carries a one-line comment saying why it cannot fire. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/tree.zig')
-rw-r--r--src/ninep/tree.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig
index 8c0e74a6..d6f4211b 100644
--- a/src/ninep/tree.zig
+++ b/src/ninep/tree.zig
@@ -515,6 +515,7 @@ fn attrOf(p: *Pardes, target: Target) ?Reply.Attr {
.col => |c| {
if (layout.columnBySerial(p, c.serial) == null) return null;
return .{
+ // unreachable: a u32 serial fits node_name (16)
.name = if (c.file == .dir) (std.fmt.bufPrint(&p.fs.node_name, "{d}", .{c.serial}) catch unreachable) else c.file.fileName(),
.node = Node.ofCol(c.serial, c.file),
.dir = c.file == .dir,
@@ -537,6 +538,7 @@ fn attrOf(p: *Pardes, target: Target) ?Reply.Attr {
const pn = p.panes[id].?;
if (t.file.inPty() and !pn.isTerminal()) return null;
return .{
+ // unreachable: a u32 serial fits node_name (16)
.name = if (t.file == .dir) (std.fmt.bufPrint(&p.fs.node_name, "{d}", .{t.serial}) catch unreachable) else t.file.fileName(),
.node = Node.of(t.serial, t.file),
.dir = t.file.isDir(),
@@ -582,6 +584,7 @@ fn topSize(p: *Pardes, f: TopFile) u64 {
if (p.header_focus) break :focus 0;
const pn = p.panes[p.active] orelse break :focus 0;
var digits: [16]u8 = undefined;
+ // unreachable: a u32 serial and a newline fit 16
break :focus (std.fmt.bufPrint(&digits, "{d}\n", .{pn.serial}) catch unreachable).len;
},
};
@@ -691,6 +694,7 @@ fn readdir(p: *Pardes, req: Req, target: Target) Reply {
continue;
}
var buf: [16]u8 = undefined;
+ // unreachable: a u32 serial fits 16
const name = std.fmt.bufPrint(&buf, "{d}", .{serial}) catch unreachable;
stageDirent(out, p.gpa, Node.of(serial, .dir), true, name);
}
@@ -702,6 +706,7 @@ fn readdir(p: *Pardes, req: Req, target: Target) Reply {
}
var buf: [16]u8 = undefined;
const serial = layout.columnSerial(p, c);
+ // unreachable: a u32 serial fits 16
stageDirent(out, p.gpa, Node.ofCol(serial, .dir), true, std.fmt.bufPrint(&buf, "{d}", .{serial}) catch unreachable);
},
else => return Reply.fail(req.tag, E.NOTDIR),