From d63bbf44dc22994ad3cdd73cf852f3d91d87b3f8 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 21 Apr 2009 08:05:27 -0700 Subject: [PATCH] Work around 'ControlPath too long' on Mac OS X Mac OS X sets TMPDIR to a very long path within /var, so long that a socket created in that location is too big for a struct sockaddr_un on the platform, resulting in OpenSSH being unable to create or bind to a socket in that location. Instead we try to use the very short and very common /tmp, but fall back to the guessed default if /tmp does not exist. Signed-off-by: Shawn O. Pearce --- git_command.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/git_command.py b/git_command.py index 954beba..7ff1aba 100644 --- a/git_command.py +++ b/git_command.py @@ -35,8 +35,11 @@ def _ssh_sock(create=True): if _ssh_sock_path is None: if not create: return None + dir = '/tmp' + if not os.path.exists(dir): + dir = tempfile.gettempdir() _ssh_sock_path = os.path.join( - tempfile.mkdtemp('', 'ssh-'), + tempfile.mkdtemp('', 'ssh-', dir), 'master-%r@%h:%p') return _ssh_sock_path