From 7cf2c9947ce0a5529b15835b7e1eecb30a2e68c2 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 14:06:59 -0300 Subject: Not-found failures say it once, in plain words: grep: pattern not found, callers not found The ENOENT that 9ns reads from a failure's words came from a tacked-on suffix, grep: no match, not found, definition: nothing found, not found, no shell "x", not found. They now say it once: grep: pattern not found, find: name not found, Callers: callers not found, definition: not found, shell "x" not found (...). Co-Authored-By: Claude Opus 5.5 --- src/builtins.zig | 4 ++-- src/host_io.zig | 4 ++-- src/ninep/ctl.zig | 10 +++++----- src/pardes.zig | 10 +++++----- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/builtins.zig b/src/builtins.zig index ec6afeae..9a49df16 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -1384,8 +1384,8 @@ pub const Mini = struct { /// A Find or Grep that finds nothing fails as one, in words 9ns reads as /// ENOENT (`not found`), the same for both. -const e_search_miss_find = "find: no match, not found"; -const e_search_miss_grep = "grep: no match, not found"; +const e_search_miss_find = "find: name not found"; +const e_search_miss_grep = "grep: pattern not found"; /// List the files below this pane's directory whose names hold its argument, in a +Search. pub const Find = struct { diff --git a/src/host_io.zig b/src/host_io.zig index bbd664a9..9e3fbf79 100644 --- a/src/host_io.zig +++ b/src/host_io.zig @@ -933,7 +933,7 @@ pub const Shell = struct { if (libc.access(@ptrCast(&buf), 0) == 0) return std.fmt.bufPrint(said, "not a shell: {s} is not executable", .{bin}) catch "not a shell: not executable"; } // "not found": the words a mount reads as ENOENT. - return std.fmt.bufPrint(said, "no shell \"{s}\", not found (a name on the usual paths, or a path to one)", .{bin}) catch "no such shell"; + return std.fmt.bufPrint(said, "shell \"{s}\" not found (a name on the usual paths, or a path to one)", .{bin}) catch "no such shell"; } /// The program a script's `#!` line names, when it is not there to @@ -970,7 +970,7 @@ pub const Shell = struct { var said: [320]u8 = undefined; try std.testing.expectEqualStrings("interpreter /no/such/interp not found", refusal(try std.fmt.bufPrint(&path, "{s}/bad", .{dir}), &said).?); try std.testing.expect(refusal(try std.fmt.bufPrint(&path, "{s}/good", .{dir}), &said) == null); - try std.testing.expect(std.mem.startsWith(u8, refusal(try std.fmt.bufPrint(&path, "{s}/none", .{dir}), &said).?, "no shell ")); + try std.testing.expect(std.mem.startsWith(u8, refusal(try std.fmt.bufPrint(&path, "{s}/none", .{dir}), &said).?, "shell \"")); try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "plain", .data = "echo\n" }); const plain = try std.fmt.bufPrint(&path, "{s}/plain", .{dir}); try std.testing.expect(std.mem.endsWith(u8, refusal(plain, &said).?, "plain is not executable")); diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 2e6ed6db..256b94ad 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1731,8 +1731,8 @@ test "Shell refuses a path that is no executable, and bare it goes back to the d const root_ctl = @intFromEnum(tree.TopFile.ctl); const refused = wr(p, root_ctl, "Shell /nonexistent/zzsh\n"); try testing.expectEqual(Status.err, refused.reply.status); - try testing.expect(std.mem.indexOf(u8, refused.reply.ename, "Shell: no shell \"/nonexistent/zzsh\"") != null); - try testing.expect(th.logHas(p, "no shell \"/nonexistent/zzsh\"")); + try testing.expect(std.mem.indexOf(u8, refused.reply.ename, "Shell: shell \"/nonexistent/zzsh\" not found") != null); + try testing.expect(th.logHas(p, "shell \"/nonexistent/zzsh\" not found")); try testing.expectEqual(E.IO, wr(p, root_ctl, "Shell /etc\n").errno()); try testing.expect(th.logHas(p, "Shell: not a shell: /etc is a directory")); try testing.expectEqualStrings("", p.settings.shell.requested.get()); @@ -1922,10 +1922,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: no match, 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: no match, 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); @@ -2096,7 +2096,7 @@ test "a language server question that finds nothing, cannot be answered, or is a p.lspRequest(id, .incoming_calls, ""); try testing.expect(p.lsp_wait != null); p.lspResponse(p.lsp_wait.?.id, ""); - try testing.expectEqualStrings("Callers: no callers, not found", p.fs.late_failure[0..p.fs.late_failure_len]); + try testing.expectEqualStrings("Callers: callers not found", p.fs.late_failure[0..p.fs.late_failure_len]); // A backend that cannot answer says why. p.fs.late_failure_len = 0; p.lspRequest(id, .outgoing_calls, ""); diff --git a/src/pardes.zig b/src/pardes.zig index 12acfbd6..1c65795a 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -1853,7 +1853,7 @@ test "Tty+fish, one word a tag can hold, opens a terminal on that shell" { const caller = p.panes[0].?; try std.testing.expect(p.executeBuiltinLine(0, "Tty /nonexistent")); try std.testing.expect(p.active == before and caller.shell == null); - try std.testing.expect(std.mem.indexOf(u8, caller.msg[0..caller.msg_len], "no shell \"/nonexistent\"") != null); + try std.testing.expect(std.mem.indexOf(u8, caller.msg[0..caller.msg_len], "shell \"/nonexistent\" not found") != null); try std.testing.expect(p.executeBuiltinLine(0, "Tty fsh-not-a-shell")); try std.testing.expect(caller.shell == null); // A directory passes access(X_OK); it is no shell either. @@ -6612,10 +6612,10 @@ pub const Pardes = struct { const none: ?[]const u8 = switch (w.kind) { .completion, .format, .rename => null, .diagnostics, .workspace_diagnostics => return p.setMessage(w.pane, std.fmt.bufPrint(&said, "{s}: none", .{lspWord(w.kind)}) catch "none"), - .incoming_calls => "no callers, not found", - .outgoing_calls => "no callees, not found", - .hover => "nothing to show, not found", - else => "nothing found, not found", + .incoming_calls => "callers not found", + .outgoing_calls => "callees not found", + .hover => "nothing to show: not found", + else => "not found", }; if (none) |text| p.reportFailure(w.pane, std.fmt.bufPrint(&said, "{s}: {s}", .{ lspWord(w.kind), text }) catch "nothing found"); return; -- cgit v1.3