From 24b8178d7ba0db8b0ec38769f859e9f47afbfa62 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 8 Nov 2026 21:13:29 -0300 Subject: fix: a session whose runtime directory was not the user's alone ran with no 9P socket and no word, which read as a detached session parked before its listener (a bash recipe's mkdir -m 700 -p dir/sub leaves dir at the umask's 755; smoke.py chmods it): the socket check (9p_io.noSocket, the long path's too) says no socket: must be a directory of yours alone (mode 755, owner 1000): chmod 700 it, to the log, pane 0's message and a --detach start's stderr, and --9p's help says the directory must be mode 700; a unit test opens the directory to others Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/main.zig | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/main.zig') diff --git a/src/main.zig b/src/main.zig index b6f57873..c36c4eb7 100644 --- a/src/main.zig +++ b/src/main.zig @@ -85,7 +85,8 @@ const help_text = \\ --9p= name the default 9P socket. Without this flag, \\ the name is the detached session name or pid. \\ The socket is under $XDG_RUNTIME_DIR, falling - \\ back to ~/.local/state/pardes. + \\ back to ~/.local/state/pardes: a directory + \\ of the user's alone (mode 700), or none. \\ --9p-tcp= also serve 9P at tcp!!. \\ --mount== mount a 9P session or Unix/TCP endpoint under /n/. \\ Repeat for more mounts; os and self are reserved. @@ -746,11 +747,11 @@ fn nativeMain(std_init: std.process.Init) !void { // Said where it was started (stderr, as the log says it): no pane // anyone sees would show it. The session runs on, with no 9P. var pid_buf: [16]u8 = undefined; - var words_buf: [160]u8 = undefined; + var words_buf: [256]u8 = undefined; const entry = if (opts.ninep_name.len != 0) opts.ninep_name else std.fmt.bufPrint(&pid_buf, "{d}", .{std.c.getpid()}) catch unreachable; // a pid fits 16 - if (ninep_io.tooLong(entry, &words_buf)) |words| { - var line_buf: [200]u8 = undefined; - std.Io.File.stderr().writeStreamingAll(init.io, std.fmt.bufPrint(&line_buf, "pardes: {s}\n", .{words}) catch unreachable) catch {}; // 160 fits 200 + if (ninep_io.noSocket(entry, &words_buf)) |words| { + var line_buf: [300]u8 = undefined; + std.Io.File.stderr().writeStreamingAll(init.io, std.fmt.bufPrint(&line_buf, "pardes: {s}\n", .{words}) catch unreachable) catch {}; // 256 fits 300 } // Nobody's size yet: one roomy enough for a script's panes; `size` // sets another, and an attached terminal or window its own. -- cgit v1.3