emacs-diffs
[Top][All Lists]
Advanced

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

emacs-28 a50f8dec09: Follow OpenSSH changes in Tramp


From: Michael Albinus
Subject: emacs-28 a50f8dec09: Follow OpenSSH changes in Tramp
Date: Sat, 26 Feb 2022 06:51:35 -0500 (EST)

branch: emacs-28
commit a50f8dec092ecc82814fd21ed2cd1bfdc693655d
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Follow OpenSSH changes in Tramp
    
    * lisp/net/tramp-sh.el (tramp-ssh-controlmaster-options):
    Reimplement.  OpenSSH has changed its diagnostics messages.
---
 lisp/net/tramp-sh.el | 53 +++++++++++++++++++++++++---------------------------
 1 file changed, 25 insertions(+), 28 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 80fd99e7f6..de4d579740 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4753,36 +4753,33 @@ Goes through the list `tramp-inline-compress-commands'."
    (t (setq tramp-ssh-controlmaster-options "")
       (let ((case-fold-search t))
        (ignore-errors
-         (when (executable-find "ssh")
-           (with-tramp-progress-reporter
-               vec 4 "Computing ControlMaster options"
-             (with-temp-buffer
-               (tramp-call-process vec "ssh" nil t nil "-o" "ControlMaster")
-               (goto-char (point-min))
-               (when (search-forward-regexp "\\(missing\\|no\\).+argument" nil 
t)
-                 (setq tramp-ssh-controlmaster-options
-                       "-o ControlMaster=auto")))
-             (unless (zerop (length tramp-ssh-controlmaster-options))
-               (with-temp-buffer
-                 ;; We use a non-existing IP address, in order to
-                 ;; avoid useless connections, and DNS timeouts.
-                 ;; Setting ConnectTimeout is needed since OpenSSH 7.
-                 (tramp-call-process
-                  vec "ssh" nil t nil
-                  "-o" "ConnectTimeout=1" "-o" "ControlPath=%C" "0.0.0.1")
-                 (goto-char (point-min))
+         (with-tramp-progress-reporter
+             vec 4 "Computing ControlMaster options"
+           ;; We use a non-existing IP address, in order to avoid
+           ;; useless connections, and DNS timeouts.
+           (when (zerop
+                  (tramp-call-process
+                   vec "ssh" nil nil nil
+                   "-G" "-o" "ControlMaster=auto" "0.0.0.1"))
+             (setq tramp-ssh-controlmaster-options
+                   "-o ControlMaster=auto")
+             (if (zerop
+                  (tramp-call-process
+                   vec "ssh" nil nil nil
+                   "-G" "-o" "ControlPath='tramp.%C'" "0.0.0.1"))
                  (setq tramp-ssh-controlmaster-options
                        (concat tramp-ssh-controlmaster-options
-                               (if (search-forward-regexp "unknown.+key" nil t)
-                                   " -o ControlPath='tramp.%%r@%%h:%%p'"
-                                 " -o ControlPath='tramp.%%C'"))))
-               (with-temp-buffer
-                 (tramp-call-process vec "ssh" nil t nil "-o" "ControlPersist")
-                 (goto-char (point-min))
-                 (when (search-forward-regexp "missing.+argument" nil t)
-                   (setq tramp-ssh-controlmaster-options
-                         (concat tramp-ssh-controlmaster-options
-                                 " -o ControlPersist=no")))))))))
+                               " -o ControlPath='tramp.%%C'"))
+               (setq tramp-ssh-controlmaster-options
+                     (concat tramp-ssh-controlmaster-options
+                             " -o ControlPath='tramp.%%r@%%h:%%p'")))
+             (when (zerop
+                    (tramp-call-process
+                     vec "ssh" nil nil nil
+                     "-G" "-o" "ControlPersist=no" "0.0.0.1"))
+               (setq tramp-ssh-controlmaster-options
+                     (concat tramp-ssh-controlmaster-options
+                             " -o ControlPersist=no")))))))
       tramp-ssh-controlmaster-options)))
 
 (defun tramp-scp-strict-file-name-checking (vec)



reply via email to

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