mirror of
https://github.com/awizemann/scarf.git
synced 2026-05-10 18:44:45 +00:00
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-<uid> which stays well within the limit.
This commit is contained in:
@@ -52,10 +52,13 @@ struct SSHTransport: ServerTransport {
|
|||||||
/// per-host via OpenSSH's `%C` token). Exposed as a static so
|
/// per-host via OpenSSH's `%C` token). Exposed as a static so
|
||||||
/// cleanup paths (`ServerRegistry.removeServer`, app-launch sweep) can
|
/// cleanup paths (`ServerRegistry.removeServer`, app-launch sweep) can
|
||||||
/// compute it without instantiating a transport.
|
/// 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 {
|
nonisolated static func controlDirPath() -> String {
|
||||||
let base = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first?.path
|
return "/tmp/scarf-ssh-\(getuid())"
|
||||||
?? NSHomeDirectory() + "/Library/Caches"
|
|
||||||
return base + "/scarf/ssh"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Snapshot cache directory for a given server. Stable per-ID so repeated
|
/// Snapshot cache directory for a given server. Stable per-ID so repeated
|
||||||
|
|||||||
Reference in New Issue
Block a user