From 1293cfa23b47a40b87c25c68bfc808a9c6f4ee42 Mon Sep 17 00:00:00 2001 From: Alex Maksimchuk Date: Sun, 19 Apr 2026 23:03:28 -0500 Subject: [PATCH] fix: use short ControlPath to avoid Unix socket limit on macOS The ControlMaster socket path ~/Library/Caches/scarf/ssh/%C can exceed the 104-byte macOS Unix domain socket limit when the username is long, causing ssh to silently exit 255 with "unix_listener: path too long for Unix domain socket". Switch to /tmp/scarf-ssh- which stays well within the limit. --- scarf/scarf/Core/Transport/SSHTransport.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scarf/scarf/Core/Transport/SSHTransport.swift b/scarf/scarf/Core/Transport/SSHTransport.swift index 23e3ce1..3f6f2b7 100644 --- a/scarf/scarf/Core/Transport/SSHTransport.swift +++ b/scarf/scarf/Core/Transport/SSHTransport.swift @@ -52,10 +52,13 @@ struct SSHTransport: ServerTransport { /// per-host via OpenSSH's `%C` token). Exposed as a static so /// cleanup paths (`ServerRegistry.removeServer`, app-launch sweep) can /// compute it without instantiating a transport. + /// + /// Uses a short path under /tmp to stay within the 104-byte macOS + /// Unix domain socket limit. The Caches path + /// (~/Library/Caches/scarf/ssh/%C) can exceed this limit when the + /// username is long, causing ssh to exit 255. nonisolated static func controlDirPath() -> String { - let base = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first?.path - ?? NSHomeDirectory() + "/Library/Caches" - return base + "/scarf/ssh" + return "/tmp/scarf-ssh-\(getuid())" } /// Snapshot cache directory for a given server. Stable per-ID so repeated