From 2d9f40667197ac775d5215ffd164c800f83cab4c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 12:35:40 -0300 Subject: A pattern with a newline and an anchor mvzr would misread is refused EINVAL, as the doc says Its words named no malformed input, so 9ns read the refusal as EIO, and Edit's failed EIO directly. It now says bad regular expression: ..., and Edit's failure with those words is EINVAL too. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/ninep/ctl.zig') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 978ce707..b79b1ab8 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -250,7 +250,10 @@ pub fn captured(p: *Pardes, req: Req, id: usize, exec: bool, text: []const u8, i /// there (`no such`, `not found`, the words 9ns reads as ENOENT too), else /// EIO. fn failureErrno(failure: []const u8) u16 { - return if (std.mem.indexOf(u8, failure, "no such") != null or std.mem.indexOf(u8, failure, "not found") != null) E.NOENT else E.IO; + if (std.mem.indexOf(u8, failure, "no such") != null or std.mem.indexOf(u8, failure, "not found") != null) return E.NOENT; + // A pattern refused (Edit's too) is malformed input, as 9ns reads it. + if (std.mem.indexOf(u8, failure, "bad regular expression") != null) return E.INVAL; + return E.IO; } pub fn resultsLen(p: *Pardes) u64 { -- cgit v1.3