diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 11:48:32 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | c3c3ef27ede2f69ef4f8c6acb10808f02ee46bb2 (patch) | |
| tree | 523d03bbb555a4a6d9c991fa4ec43723223cda18 /src/ninep/ctl.zig | |
| parent | cef529dc8cd080198f79d2b26bffbe9c7cf3e8bd (diff) | |
| download | pardes-c3c3ef27ede2f69ef4f8c6acb10808f02ee46bb2.tar.gz pardes-c3c3ef27ede2f69ef4f8c6acb10808f02ee46bb2.zip | |
A builtin or setting this build lacks is refused GUI-only, from an exec too
On a terminal, Fonts written to an exec was no builtin there, so it ran as a shell command and ended exit 127; ctl said unknown control message. Both now say Fonts is GUI-only, invalid here (a builtin another platform's build has, not in this build).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 68b62186..c2a78fb8 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -388,11 +388,11 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ? const b = std.meta.stringToEnum(Builtin, word) orelse { // A setting this build's frontend cannot show (Lift, GripWidth on a // terminal) is known, and says so rather than sound misspelt. - if (config.Runtime.find(word) != null) { + if (builtins.absentWhy(word) orelse if (config.Runtime.find(word) != null) @as([]const u8, "GUI-only") else null) |absent| { var why: [64]u8 = undefined; // EINVAL, a request this build cannot take, in words 9ns reads // as that: `invalid`. - return refuse(p, req, std.fmt.bufPrint(&why, "{s} is GUI-only, invalid here", .{word}) catch "GUI-only, invalid here", line); + return refuse(p, req, std.fmt.bufPrint(&why, "{s} is {s}, invalid here", .{ word, absent }) catch "GUI-only, invalid here", line); } return refuse(p, req, "unknown control message", line); }; @@ -1704,6 +1704,14 @@ test "a setting this frontend cannot show says GUI-only, and DumpDir reads back if (!builtins.capabilities.lift) { try testing.expectEqualStrings("Lift is GUI-only, invalid here \"Lift on\"", wr(p, root_ctl, "Lift on\n").reply.ename); try testing.expectEqualStrings("GripWidth is GUI-only, invalid here \"GripWidth 120\"", wr(p, root_ctl, "GripWidth 120\n").reply.ename); + // A builtin the GUI alone has, written to a ctl or an exec, never + // runs as a shell command. + if (comptime !pardes.font_picker) { + try testing.expectEqualStrings("Fonts is GUI-only, invalid here \"Fonts\"", wr(p, root_ctl, "Fonts\n").reply.ename); + const ran = wr(p, root_exec, "Fonts\n"); + try testing.expectEqual(E.IO, ran.errno()); + try testing.expectEqualStrings("Fonts is GUI-only, invalid here", ran.reply.ename); + } } try testing.expectEqualStrings("unknown control message \"Liftt on\"", wr(p, root_ctl, "Liftt on\n").reply.ename); var buf: [900]u8 = undefined; |
