Subject: Re: bug#70901: 30.0.50; Tramp doesn't use ControlMaster even with (setq tramp-use-connection-share nil)

From: Michael Albinus <[email-masked]>
Date: Wed, 15 May 2024 10:17:55 +0200

Dmitry Gutov <[email-masked]> writes:

> Hi Michael,

Hi Dmitry,
>> The Tramp ssh call looks like it should. Tramp doesn't care about
>> ControlMaster with your settings:
>> 
>>> 14:41:04.227455 tramp-maybe-open-connection (3) # Sending command ‘exec ssh -l dgutov -e none fencepost.gnu.org || exit’
>>> 14:41:04.227485 tramp-send-command (6) # exec ssh -l dgutov -e none fencepost.gnu.org || exit
>>> 14:41:06.037182 tramp-process-actions (6) #
>>> Last login: Mon May 13 07:39:46 2024 from 82.102.62.129
>>> dgutov@fencepost:~$
>
> Shouldn't it then take advantage of ControlMaster, which has been
> configured for this host?

It should. You could check which settings will be used by calling
'ssh -G fencepost.gnu.org'.

> ssh logs in to the remote server very quickly from the terminal with
> my ControlMaster configuration.
>
> But I don't see any speed improvement in Tramp operations from it. For
> example, I evaluate just 'ls' using M-& (async-shell-command), and the
> time it takes to complete doesn't seem to be affected by the contents
> of my ~/.ssh/config.

Sure. The connection is fast. But then, Tramp makes an initial
hand-shake, which needs some roundtrips. Set

(add-to-list 'tramp-connection-properties
             (list (regexp-quote "/ssh:fencepost.gnu.org:")
                   "direct-async-process" t))

prior connecting the host the very first time in Tramp. This should
improve the speed. Since it doesn't ask for passwords interactively, you
might configure your password via auth-source.

See the discussion in (info "(tramp)Improving performance of asynchronous
remote processes")

Best regards, Michael.