From 0b359e1f99f1a2630969c1c00b6c71db3b794ccd Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 07:56:59 -0300 Subject: A Save refused for want of a name counts as a failure, so its announcement goes A builtin that would open a prompt nobody can answer (Save with no name on a scratch, through a ctl write) failed the write without saying a failure, so the announcement rule missed it and `msg N Save` stayed. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 5 +++++ src/pardes.zig | 2 ++ 2 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 4f52d661..6a8a37be 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -1504,6 +1504,11 @@ test "a builtin's Verbose announcement is logged only when it succeeds, its fail const serial = serialOf(p); var want: [64]u8 = undefined; const said_exit = try std.fmt.bufPrint(&want, "msg {d} Exit\n", .{serial}); + // A Save a ctl write gives no name to, on a scratch: refused, no Save. + const scratch = try th.newPane(p); + var said_save_buf: [64]u8 = undefined; + try testing.expectEqual(E.INVAL, wr(p, Node.of(scratch, .ctl), "Save\n").errno()); + try testing.expect(!th.logHas(p, try std.fmt.bufPrint(&said_save_buf, "msg {d} Save\n", .{scratch}))); // Refused as it runs, through a click: the write fails, and no Exit. const f = &p.panes[0].?.file.?; f.saved_revision = f.revision -% 1; diff --git a/src/pardes.zig b/src/pardes.zig index 72a90244..9ba8a2d3 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -6007,6 +6007,8 @@ pub const Pardes = struct { // ctl file: the write fails instead (src/ninep/ctl.zig). if (p.fs.no_prompt) { p.fs.refused = true; + // A failure like any other: the builtin's announcement goes. + p.fs.failures +%= 1; return; } // Asked for over 9P (Save from an exec on a terminal): a question -- cgit v1.3