tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug: scp confused by single quotes in ControlPath


From: Michael Albinus
Subject: Re: Bug: scp confused by single quotes in ControlPath
Date: Thu, 12 May 2022 16:38:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Daniel Kessler <kesslerd@umich.edu> writes:

> Dear Tramp Developers,

Hi Daniel,

> I believe I have pinpointed this to the way ControlPath is specified
> throughout the file tramp-sh.el. Specifically, ControlPath is
> specified in a manner that includes hard quotes. This is present in
> both comments and code in the current master branch, e.g.,
>
>                 (setq tramp-ssh-controlmaster-options
>                       (concat tramp-ssh-controlmaster-options
>                               " -o ControlPath='tramp.%%C'"))
>
> When the connection is initially established, it starts a shell
> process and then performs ssh there, and so the shell consumes the
> hard quotes. However, when external methods are used (e.g.,
> tramp-do-copy-or-rename-file-out-of-band), the scp program is invoked
> directly (i.e., without going through a shell), and so scp is looking
> for a ControlPath file that includes a literal single quote (which of
> course doesn't exist). Because it can't find the ControlPath, it has
> to establish a fresh ssh connection, which involves some overhead and
> thus requires me to provide my credentials again.

Thank you for this thorough report.

> I was able to fix this by manually setting
> tramp-ssh-control-master-options as:
>   (setq tramp-ssh-controlmaster-options
>         "-o ControlMaster=auto -o ControlPath=tramp.%%C -o
> ControlPersist=no")

Yep, user option tramp-ssh-controlmaster-options exist as last resort.

> However, I wonder if the hard quotes in tramp-sh.el are truly
> required: are there especially problematic characters that %C might
> expand to that would require quoting? If so, it might be necessary to
> modify the options on-the-fly so that the quotes are present when
> being used in a call that goes via the shell and absent when being
> passed directly to a (non-shell) process.

Well, tramp.%C is expanded to a hash string, like
tramp.c029a3b682f060bbe998f859dec53d60e19f47ce. No need to quote this.

There is also the fallback tramp.%%r@%%h:%%p, which could be expanded to
a string which must be quoted. But this would happen only if the
username (%r) or hostname (%h%) look so, which is not very likely.

So I have removed the quote from the ControlPath value, as you have
proposed. Pushed to the emacs-28 branch of the Emacs git repository, it
will appear with Emacs 28.2. It will also be contained in the next GNU
ELPA release of Tramp (2.5.2.5), which will happen later this month.

> Sincerely,
> Dan Kessler

Best regards, Michael.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]