Subject: 25.0.50; Mac OS X 10.10: tramp fails with "too long for Unix domain socket" error

From: David Caldwell <[email-masked]>
Date: Fri, 13 Feb 2015 19:19:42 -0800

After invoking with emacs -Q, opening a file with tramp fails with an
error:

unix_listener:
"/var/folders/l9/vwn57w053mzdv_mrtkjqqnj00000gn/T/[email-masked]:22.zrNS5blwPkoWXlHh"
too long for Unix domain socket

This error is printed in buffer called "*tramp/scp
[email-masked]*".

The particular file I was opening was "/[email-masked]:".

This also fails in Emacs 24.4.

It does not fail in Emacs 24.3. I'm going to try to binary search to
narrow down the problem. Done.

I tracked it to somewhere between 2014-06-13 and 2014-06-06 (I used the
nightly builds at http://emacsformacosx.com/builds/all instead of
building it all myself. The only patch in that area that looks like it
has anything to do with it is a336b2eae3b52f6fba5a19cc98e780feca618115,
but I don't understand why (maybe the regexp wasn't matching before?).

When running as batch I noticed the ControlPath seems to be the
difference with when it works or not. The message when it works:

  Tramp: Sending command `exec ssh -l david   -o ControlPersist=no -e
none deadth.porkrind.org'

And when it doesn't:

  Tramp: Sending command `exec ssh -l david  -o
ControlPath=/var/folders/l9/vwn57w053mzdv_mrtkjqqnj00000gn/T/tramp.95670s_p.%r@%h:%p
-o ControlMaster=auto -o ControlPersist=no -e none death.porkrind.org'

I'm running on Mac OS X 10.10 (Yosemite).

Ok. More info: I'm running a locally built version of OpenSSH. My local
version is "OpenSSH_6.7p1, OpenSSL 1.0.2 22 Jan 2015". The system
version is "OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011". When I run the
command listed above with the long control path, the 2 versions act
differently. The locally compiled 6.7p1 version prints:

   unix_listener:
"/var/folders/l9/vwn57w053mzdv_mrtkjqqnj00000gn/T/[email-masked]:22.1NyTKIqLDRhV1uyV"
too long for Unix domain socket

...and then exits. The system 6.2p2 version prints:

   ControlPath
"/var/folders/l9/vwn57w053mzdv_mrtkjqqnj00000gn/T/[email-masked]:22.92nYwUmCrMTDpjyE"
too long for Unix domain socket

...but then logs me in anyway (presumably without a ControlMaster).

So it looks like Emacs is generating command line paths that are too
long for ssh. New ssh versions treat this as a fatal error but old
versions treat it as a warning.

Shortening the path to just "/tmp/tramp.95670s_p.%r@%h:%p" makes it
work with both ssh versions.

-David

In GNU Emacs 25.0.50.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21
Version 10.9.5 (Build 13F34))
 of 2015-02-11 on builder10-9.porkrind.org
Windowing system distributor `Apple', version 10.3.1344
Configured using:
 `configure --with-ns'

Configured features:
ACL LIBXML2 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Fundamental

Minor modes in effect:
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent messages:
Tramp: Sending command `exec ssh -l david  -o
ControlPath=/var/folders/l9/vwn57w053mzdv_mrtkjqqnj00000gn/T/tramp.91898lKp.%r@%h:%p
-o ControlMaster=auto -o ControlPersist=no -e none death.porkrind.org'
Tramp: Waiting for prompts from remote shell...
Tramp failed to connect.  If this happens repeatedly, try
    `M-x tramp-cleanup-this-connection'
Tramp: Waiting for prompts from remote shell...failed
Tramp: Opening connection for [email-masked] using scp...failed
Use M-x make-directory RET RET to create the directory and its parents

Tramp: Checking `vc-registered' for /[email-masked]:src...failed
Use M-x make-directory RET RET to create the directory and its parents

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message dired rfc822 mml easymenu
mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev
gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mail-utils
tramp-cmds tramp-cache tramp-sh tramp tramp-compat auth-source cl-macs
eieio byte-opt gv bytecomp byte-compile cl-extra seq cconv eieio-core
cl-generic pcase cl-loaddefs cl-lib gnus-util mm-util mail-prsvr
password-cache tramp-loaddefs trampver shell pcomplete comint ansi-color
ring format-spec advice help-fns time-date tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel ns-win tool-bar dnd
fontset image regexp-opt fringe tabulated-list newcomment elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham
georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic
indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process cocoa ns multi-tty emacs)

Memory information:
((conses 16 99123 6609)
 (symbols 48 21209 0)
 (miscs 40 40 146)
 (strings 32 22684 4534)
 (string-bytes 1 692575)
 (vectors 16 14182)
 (vector-slots 8 427442 3799)
 (floats 8 117 335)
 (intervals 56 175 101)
 (buffers 976 12))