diff options
-rw-r--r-- | doc/misc/tramp.texi | 36 | ||||
-rw-r--r-- | etc/NEWS | 10 | ||||
-rw-r--r-- | lisp/net/tramp-integration.el | 4 | ||||
-rw-r--r-- | lisp/net/tramp-sh.el | 49 |
4 files changed, 59 insertions, 40 deletions
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index acf32726895..3b5ba3b1390 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi @@ -2758,32 +2758,32 @@ allows you to set the @option{ControlPath} provided the variable Note how @samp{%r}, @samp{%h} and @samp{%p} must be encoded as @samp{%%r}, @samp{%%h} and @samp{%%p}. -@vindex tramp-use-ssh-controlmaster-options +@vindex tramp-use-connection-share Using a predefined string in @code{tramp-ssh-controlmaster-options}, or puzzling an own string, happens only when user option -@code{tramp-use-ssh-controlmaster-options} is set to @code{t}. If the +@code{tramp-use-connection-share} is set to @code{t}. If the @file{~/.ssh/config} file is configured appropriately for the above behavior, then any changes to @command{ssh} can be suppressed with this @code{nil} setting: @lisp -(customize-set-variable 'tramp-use-ssh-controlmaster-options nil) +(customize-set-variable 'tramp-use-connection-share nil) @end lisp Sometimes, it is not possible to use OpenSSH's @option{ControlMaster} option for remote processes. This could result in concurrent access to the OpenSSH socket when reading data by different processes, which could block Emacs. In this case, setting -@code{tramp-use-ssh-controlmaster-options} to @code{suppress} disables -shared access. It is not needed to set this user option permanently -to @code{suppress}, binding the user option prior calling +@code{tramp-use-connection-share} to @code{suppress} disables shared +access. It is not needed to set this user option permanently to +@code{suppress}, binding the user option prior calling @code{make-process} is sufficient. @value{tramp} does this for esxample for compilation processes on its own. @vindex ProxyCommand@r{, ssh option} @vindex ProxyJump@r{, ssh option} -@code{tramp-use-ssh-controlmaster-options} should also be set to -@code{nil} or @code{suppress} if you use the @option{ProxyCommand} or +@code{tramp-use-connection-share} should also be set to @code{nil} or +@code{suppress} if you use the @option{ProxyCommand} or @option{ProxyJump} options in your @command{ssh} configuration. In order to use the @option{ControlMaster} option, @value{tramp} must @@ -2806,12 +2806,16 @@ Host * Check the @samp{ssh_config(5)} man page whether these options are supported on your proxy host. -On MS Windows, @code{tramp-use-ssh-controlmaster-options} is set to -@code{nil} by default, because the MS Windows and MSYS2 -implementations of @command{OpenSSH} do not support this option properly. +On MS Windows, @code{tramp-use-connection-share} is set to @code{nil} +by default, because the MS Windows and MSYS2 implementations of +@command{OpenSSH} do not support this option properly. -In PuTTY, you can achieve connection sharing in the @option{Connection/SSH} -entry, enabling the @option{Share SSH connections if possible} option. +In PuTTY, you can achieve connection sharing in the +@option{Connection/SSH} entry, enabling the @option{Share SSH +connections if possible} option. @code{tramp-use-connection-share} +must be set to @code{nil}. If @code{tramp-use-connection-share} is +set to @code{t} or @code{suppress}, @command{plink} is called with the +option @option{-share} or @option{-noshare}, respectively. @subsection Configure direct copying between two remote servers @@ -4300,9 +4304,9 @@ It does not use @code{tramp-remote-path}. In order to gain even more performance, it is recommended to bind @code{tramp-verbose} to 0 when running @code{make-process} or @code{start-file-process}. Furthermore, you might set -@code{tramp-use-ssh-controlmaster-options} to @code{nil} in order to -bypass @value{tramp}'s handling of the @option{ControlMaster} options, -and use your own settings in @file{~/.ssh/config}, @ref{Using ssh +@code{tramp-use-connection-share} to @code{nil} in order to bypass +@value{tramp}'s handling of the @option{ControlMaster} options, and +use your own settings in @file{~/.ssh/config}, @ref{Using ssh connection sharing}. @@ -185,10 +185,12 @@ point is not in a comment or a string. It is by default bound to This allows accessing system containers provided by Toolbox. +++ -*** New value 'suppress' for user option 'tramp-use-ssh-controlmaster-options'. -This user option allows now the values t, nil, and 'suppress'. The -latter suppresses also "ControlMaster" settings in the user's -"~/.ssh/config" file. +*** Rename 'tramp-use-ssh-controlmaster-options' to 'tramp-use-connection-share. +The old name still exists as defvaralias. This user option controls +now connection sharing for both ssh-based and plink-based methods. It +allows the values t, nil, and 'suppress'. The latter suppresses +also "ControlMaster" settings in the user's "~/.ssh/config" file, +or connection share configuration in PuTTY sessions, respectively. ** EWW diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el index 3ef4b55acd3..5b3259eab03 100644 --- a/lisp/net/tramp-integration.el +++ b/lisp/net/tramp-integration.el @@ -53,7 +53,7 @@ (defvar shortdoc--groups) (defvar tramp-current-connection) (defvar tramp-postfix-host-format) -(defvar tramp-use-ssh-controlmaster-options) +(defvar tramp-use-connection-share) ;;; Fontification of `read-file-name': @@ -302,7 +302,7 @@ NAME must be equal to `tramp-current-connection'." ;; Bug#45518. So we don't use ssh ControlMaster options. (defun tramp-compile-disable-ssh-controlmaster-options () "Don't allow ssh ControlMaster while compiling." - (setq-local tramp-use-ssh-controlmaster-options nil)) + (setq-local tramp-use-connection-share 'suppress)) (with-eval-after-load 'compile (add-hook 'compilation-mode-hook diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 875ad096ad6..24e90447b24 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -106,21 +106,27 @@ detected as prompt when being sent on echoing hosts, therefore.") (defconst tramp-end-of-heredoc (md5 tramp-end-of-output) "String used to recognize end of heredoc strings.") -(defcustom tramp-use-ssh-controlmaster-options (not (eq system-type 'windows-nt)) - "Whether to use `tramp-ssh-controlmaster-options'. -Set it to t, if you want Tramp to apply these options. +(defcustom tramp-use-connection-share (not (eq system-type 'windows-nt)) + "Whether to use connection share in ssh or PuTTY. +Set it to t, if you want Tramp to apply respective options. These +are `tramp-ssh-controlmaster-options' for ssh, and \"-share\" for PuTTY. Set it to nil, if you use Control* or Proxy* options in your ssh configuration. Set it to `suppress' if you want to disable settings in your -\"~/.ssh/config¸\"." +\"~/.ssh/config\" file or in your PuTTY session." :group 'tramp - :version "29.2" + :version "30.1" :type '(choice (const :tag "Set ControlMaster" t) (const :tag "Don't set ControlMaster" nil) (const :tag "Suppress ControlMaster" suppress)) - ;; Check with (safe-local-variable-p 'tramp-use-ssh-controlmaster-options 'suppress) + ;; Check with (safe-local-variable-p 'tramp-use-connection-share 'suppress) :safe (lambda (val) (and (memq val '(t nil suppress)) t))) +(defvaralias 'tramp-use-connection-share 'tramp-use-ssh-controlmaster-options) +(make-obsolete-variable + 'tramp-use-ssh-controlmaster-options + "Use `tramp-use-connection-share' instead" "30.1") + (defvar tramp-ssh-controlmaster-options nil "Which ssh Control* arguments to use. @@ -130,8 +136,8 @@ If it is a string, it should have the form spec must be doubled, because the string is used as format string. Otherwise, it will be auto-detected by Tramp, if -`tramp-use-ssh-controlmaster-options' is t. The value depends on -the installed local ssh version. +`tramp-use-connection-share' is t. The value depends on the +installed local ssh version. The string is used in `tramp-methods'.") @@ -348,7 +354,7 @@ The string is used in `tramp-methods'.") (add-to-list 'tramp-methods `("plink" (tramp-login-program "plink") - (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") + (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%c") ("-t") ("%h") ("\"") (,(format "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'" @@ -361,7 +367,7 @@ The string is used in `tramp-methods'.") (add-to-list 'tramp-methods `("plinkx" (tramp-login-program "plink") - (tramp-login-args (("-load") ("%h") ("-t") ("\"") + (tramp-login-args (("-load") ("%h") ("%c") ("-t") ("\"") (,(format "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'" tramp-terminal-type @@ -373,7 +379,7 @@ The string is used in `tramp-methods'.") (add-to-list 'tramp-methods `("pscp" (tramp-login-program "plink") - (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") + (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%c") ("-t") ("%h") ("\"") (,(format "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'" @@ -391,7 +397,7 @@ The string is used in `tramp-methods'.") (add-to-list 'tramp-methods `("psftp" (tramp-login-program "plink") - (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") + (tramp-login-args (("-l" "%u") ("-P" "%p") ("-ssh") ("%c") ("-t") ("%h") ("\"") (,(format "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'" @@ -403,7 +409,7 @@ The string is used in `tramp-methods'.") (tramp-remote-shell-args ("-c")) (tramp-copy-program "pscp") (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-sftp") - ("-p" "%k") ("-q"))) + ("-p" "%k"))) (tramp-copy-keep-date t))) (add-to-list 'tramp-methods `("fcp" @@ -4839,12 +4845,19 @@ Goes through the list `tramp-inline-compress-commands'." "Return the Control* arguments of the local ssh." (cond ;; No options to be computed. - ((or (null tramp-use-ssh-controlmaster-options) + ((or (null tramp-use-connection-share) (null (assoc "%c" (tramp-get-method-parameter vec 'tramp-login-args)))) "") + ;; Use plink option. + ((string-match-p + (rx "plink" (? ".exe") eol) + (tramp-get-method-parameter vec 'tramp-login-program)) + (if (eq tramp-use-connection-share 'suppress) + "-noshare" "-share")) + ;; There is already a value to be used. - ((and (eq tramp-use-ssh-controlmaster-options t) + ((and (eq tramp-use-connection-share t) (stringp tramp-ssh-controlmaster-options)) tramp-ssh-controlmaster-options) @@ -4854,18 +4867,18 @@ Goes through the list `tramp-inline-compress-commands'." (when (tramp-ssh-option-exists-p vec "ControlMaster=auto") (concat "-o ControlMaster=" - (if (eq tramp-use-ssh-controlmaster-options 'suppress) + (if (eq tramp-use-connection-share 'suppress) "no" "auto") " -o ControlPath=" - (if (eq tramp-use-ssh-controlmaster-options 'suppress) + (if (eq tramp-use-connection-share 'suppress) "none" ;; Hashed tokens are introduced in OpenSSH 6.7. (if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C") "tramp.%%C" "tramp.%%r@%%h:%%p")) ;; ControlPersist option is introduced in OpenSSH 5.6. - (when (and (not (eq tramp-use-ssh-controlmaster-options 'suppress)) + (when (and (not (eq tramp-use-connection-share 'suppress)) (tramp-ssh-option-exists-p vec "ControlPersist=no")) " -o ControlPersist=no"))))))) |