summaryrefslogtreecommitdiff
path: root/src/ninep/tree.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-28 10:26:47 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commit60e40675c82efd17aa6bf31bc66c3f8f3f918360 (patch)
tree1be23a1372c7383a2d37fe82ea6e8af9b91f488c /src/ninep/tree.zig
parentd9c6786e19567878e3c89ae212296ce941484096 (diff)
downloadpardes-60e40675c82efd17aa6bf31bc66c3f8f3f918360.tar.gz
pardes-60e40675c82efd17aa6bf31bc66c3f8f3f918360.zip
Addresses search a line at a time as sam does, say why they fail, and a failed addr leaves no address
addr's regexps ran mvzr over text[from..hi]: ^ and $ anchored only at the slice's ends, . matched newlines, the search never wrapped, and every failure read as bad address syntax. The regexps stay mvzr's, called the way sam searches (editors/acme/regx.c): one line per haystack, so ^ and $ fall at line boundaries and . never crosses a newline; a pattern naming \\n runs over the whole text with its . made [^\\n]; /re/ wraps unless limit is set, and ?re? takes the last match before the range. The ceiling (mvzr's first alternative, not sam's longest) is documented. A failed address says why (no match for regexp, address out of range, bad regular expression), and a failed write to addr leaves no address, so data and xdata refuse until the next good one instead of writing at the old range. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/tree.zig')
-rw-r--r--src/ninep/tree.zig2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/ninep/tree.zig b/src/ninep/tree.zig
index e9c6b8ea..3ce7e758 100644
--- a/src/ninep/tree.zig
+++ b/src/ninep/tree.zig
@@ -681,6 +681,8 @@ fn setattr(p: *Pardes, req: Req, target: Target) Reply {
if (req.truncate) switch (target) {
.pane => |t| {
const id = p.paneBySerial(t.serial) orelse return Reply.fail(req.tag, E.NOENT);
+ if ((t.file == .data or t.file == .xdata) and p.panes[id].?.fs.addr_failed)
+ return failText(req.tag, E.INVAL, pane.e_addr_failed);
if (pane.truncate(p, p.panes[id].?, t.file) != .ok) return Reply.fail(req.tag, E.NOMEM);
},
.top => {},