summaryrefslogtreecommitdiff
path: root/src/config.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 03:04:42 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit80ed1bf997117a36b9d0e10744de736e84d96e7f (patch)
tree9ad644b3d1abf076959ed4b6aad7bc1622e30828 /src/config.zig
parentbeea3aaa8d35c00145c78a746393d71b8b14e658 (diff)
downloadpardes-80ed1bf997117a36b9d0e10744de736e84d96e7f.tar.gz
pardes-80ed1bf997117a36b9d0e10744de736e84d96e7f.zip
Shell refuses a name that is no executable, and bare restores the default
Shell took any word and the host quietly ran another shell at the next spawn. It now refuses a path or name that is not executable ("Shell: x: no executable by that name", failing a ctl write, logged err), a bare Shell goes back to the default, and a default $SHELL that is not executable falls back to /bin/sh. shellset's golden takes the refusal on the message row (re-recorded by name). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/config.zig')
-rw-r--r--src/config.zig8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/config.zig b/src/config.zig
index a59fe18d..e0fcab48 100644
--- a/src/config.zig
+++ b/src/config.zig
@@ -350,7 +350,8 @@ test "wheel drift guard" {
pub fn defaultShell() []const u8 {
if (comptime pardes.hosted) if (std.c.getenv("SHELL")) |s| {
const shell = std.mem.span(s);
- if (shell.len > 0) return shell;
+ // One that is not there, or not executable, is no shell: /bin/sh.
+ if (shell.len > 0 and std.c.access(s, std.c.X_OK) == 0) return shell;
};
return "/bin/sh";
}
@@ -1045,8 +1046,9 @@ pub const Runtime = struct {
}
},
.shell => {
- const value = std.mem.trim(u8, argument orelse return false, " \t\r\n");
- if (value.len == 0 or !state.shell.requested.set(value)) return false;
+ // Bare, the default again ($SHELL, else /bin/sh).
+ const value = std.mem.trim(u8, argument orelse "", " \t\r\n");
+ if (!state.shell.requested.set(value)) return false;
state.shell.pending = true;
},
.tagline_size => {