[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: tramp (2.7.1.4 nil/nil); Tramp may attempt to create ControlPath soc
From: |
Michael Albinus |
Subject: |
Re: tramp (2.7.1.4 nil/nil); Tramp may attempt to create ControlPath sockets that exceed maximum path length |
Date: |
Tue, 19 Nov 2024 15:16:34 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Alex Hutcheson <alexhutcheson@google.com> writes:
Hi Alex,
> I think ideally we should make Tramp work "out-of-the-box", even if
> the user
> hasn't changed any of the default in their Emacs or SSH config. This
> would
> require picking somewhere reasonable to put the ControlPath domain
> socket
> in cases where the full expansion of a user's home directory might be
> too
> long.
I doubt that there is a user in the wild who uses Tramp w/o even a
single configuration line in ~/.emacs :-)
> If the manual still suggests configuring OpenSSH to put the
> ControlPath
> under /tmp/, then it seems like it would be fine to default to that
> behavior?
> At least as a fallback in the case where the ~/.cache/emacs/ directory
> would
> be too long.
Agreed. We shouldn't recommend use of /tmp.
> The value of tramp-compat-temporary-file-directory could be kept
> as-is, since
> the length isn't a problem for other use-cases. We'd just need to
> update the
> behavior for the ControlPath domain socket.
Reading the sources, it looks like Tramp is already prepared for
that. The relevant setting of ControlPath is in tramp-sh.el:
--8<---------------cut here---------------start------------->8---
(expand-file-name
(if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C")
"tramp.%%C" "tramp.%%r@%%h:%%p")
(or small-temporary-file-directory
tramp-compat-temporary-file-directory))
--8<---------------cut here---------------end--------------->8---
small-temporary-file-directory is nil in vanilla Emacs. So I would
change the FAQ entry to something like this:
--8<---------------cut here---------------start------------->8---
• I get an error ‘unix_listener: path
"/very/long/path/.cache/emacs/tramp.XXX" too long for Unix domain
socket’ when connectiong via ‘ssh’ to a remote host.
By default, TRAMP uses the directory ‘~/.cache/emacs/’ for
creation of OpenSSH Unix domain sockets. On GNU/Linux, domain
sockets have a much lower maximum path length (currently 107
characters) than normal files.
You can change this directory by setting the user option
‘small-temporary-file-directory’ to another name, like
(unless small-temporary-file-directory
(customize-set-variable
'small-temporary-file-directory
(format "/run/user/%d/emacs/" (user-uid)))
(make-directory small-temporary-file-directory t))
‘"/run/user/UID"’ is the value of the environment variable
‘XDG_RUNTIME_DIR’, which you can use instead via ‘(getenv
"XDG_RUNTIME_DIR")’.
--8<---------------cut here---------------end--------------->8---
Best regards, Michael.