From ff3738b2fe8312b0a108cf7301ec99e1c4d0a24b Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 16:31:13 -0300 Subject: Mini with no argument is wrong #args, EINVAL; Find, Grep and Mini say their names capitalised Mini needs a file but did not say so, so a bare Mini ran and failed EIO. It now requires its argument, refused wrong #args (EINVAL) as every such word is. Its failures, Find's and Grep's start with the builtin's own name (Mini:, Find:, Grep:), as the others' do. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/ninep/ctl.zig') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 9d7557e6..7986333c 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1924,10 +1924,10 @@ test "Grep with no hit says grep: no match and opens nothing, a missing pane dir for (p.panes) |slot| count += @intFromBool(slot != null); const missed = wr(p, Node.of(serialOf(p), .exec), "Grep zzqqnomatchzz\n"); try testing.expectEqual(E.NOENT, missed.errno()); - try testing.expectEqualStrings("grep: pattern not found", missed.reply.ename); + try testing.expectEqualStrings("Grep: pattern not found", missed.reply.ename); const unfound = wr(p, Node.of(serialOf(p), .exec), "Find zzqqnomatchzz\n"); try testing.expectEqual(E.NOENT, unfound.errno()); - try testing.expectEqualStrings("find: name not found", unfound.reply.ename); + try testing.expectEqualStrings("Find: name not found", unfound.reply.ename); var after: usize = 0; for (p.panes) |slot| after += @intFromBool(slot != null); try testing.expectEqual(count, after); @@ -2244,6 +2244,14 @@ test "a failure said while a 9P write waits on it posts no msg, only the write's try testing.expect(p.fs.late_failure_len > 0); } +test "Mini with no argument is wrong #args, EINVAL, as every word that needs one" { + const p = try withFile(testing.allocator, "x\n"); + defer p.deinit(); + const r = wr(p, Node.of(serialOf(p), .ctl), "Mini\n"); + try testing.expectEqual(E.INVAL, r.errno()); + try testing.expectEqualStrings("wrong #args in control message \"Mini\"", r.reply.ename); +} + test "every EINVAL a write gets says why, in its err record too; DEL is a control character in a line" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); -- cgit v1.3