From df3816399981e20dc78cc55e5a32a7c2fd1dd57c Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Mon, 3 Aug 2026 15:39:17 -0400 Subject: [PATCH] fix: cap zellij session name length to avoid socket path overflow crash --- docs/CHANGELOG.md | 15 ++++++++++++++- .../modules/nmasur/presets/programs/zellij.nix | 9 ++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 822f7e8a..3174e152 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,9 +1,22 @@ # Changelog +## 2026-08-03 + +- Fixed the `zellij-session` fish function in `presets/programs/zellij.nix` + truncating the session name (derived from the target directory basename) + to 20 characters. Zellij names each session's Unix-domain IPC socket + `$TMPDIR/zellij-//`, and on macOS the socket path is + capped at 103 bytes. The `/var/folders/...` `$TMPDIR` prefix consumes ~79 + of those, leaving only ~24 chars for the name, so switching into directories + with long basenames overflowed the socket path. Because `switch-session` + had already detached from the current session by the time the new one failed + to bind, the failure took down the entire terminal instead of erroring + gracefully. + ## 2026-07-25 - Added jjui config generation to `jujutsu.nix` in Home Manager to include custom GitHub ruleset bypass commands (`ctrl+b` and `ctrl+shift+b`). -- Added `overlays/cheetah3.nix` to disable `pythonMetadataCheckPhase` for `cheetah3`. +- Added `overlays/cheetah3.nix` to disable `pythonMetadataCheckPhase` for `cheetah3`. This fixes an issue where the NixOS rebuild fails for `sabnzbd` due to `importlib.metadata.PackageNotFoundError: No package metadata was found for cheetah3` during the Python package evaluation in `nixos-unstable`. ## 2026-07-20 diff --git a/platforms/home-manager/modules/nmasur/presets/programs/zellij.nix b/platforms/home-manager/modules/nmasur/presets/programs/zellij.nix index b0c91da2..762c40eb 100644 --- a/platforms/home-manager/modules/nmasur/presets/programs/zellij.nix +++ b/platforms/home-manager/modules/nmasur/presets/programs/zellij.nix @@ -58,8 +58,15 @@ in if test "$TARGET_DIR" = $(pwd) return 1 end + # Zellij names each session's IPC socket $TMPDIR/zellij-//. + # On macOS the socket path is capped at 103 bytes; the $TMPDIR prefix under + # /var/folders/... eats ~79 of those, leaving only ~24 chars for the name. + # A longer basename overflows the socket path, and because switch-session has + # already detached from the current session by the time the new one fails to + # bind, it takes the whole terminal down. Truncate to stay well under the limit. + set SESSION_NAME (basename $TARGET_DIR | string sub --length 20) echo "$ZELLIJ_SESSION_NAME" > ~/.local/state/zellij-last-session - ${lib.getExe pkgs.zellij} action switch-session $(basename $TARGET_DIR) --cwd $TARGET_DIR --layout default + ${lib.getExe pkgs.zellij} action switch-session $SESSION_NAME --cwd $TARGET_DIR --layout default ''; }; gh-run = {