emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-24 50f3811: net/tramp.el (tramp-ssh-controlmaster-op


From: Michael Albinus
Subject: [Emacs-diffs] emacs-24 50f3811: net/tramp.el (tramp-ssh-controlmaster-options): Use "%C"
Date: Mon, 02 Feb 2015 10:28:40 +0000

branch: emacs-24
commit 50f3811883c7082b3c2a5a10bcfe77a3adfcb6ff
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    net/tramp.el (tramp-ssh-controlmaster-options): Use "%C"
    
    Fixes: debbugs:19702
    
    * net/tramp.el (tramp-ssh-controlmaster-options): Use "%C" for
    ControlPath if possible.
---
 lisp/ChangeLog    |    5 +++++
 lisp/net/tramp.el |   24 ++++++++++++++++--------
 2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index cc42bce..8ef533e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-02  Michael Albinus  <address@hidden>
+
+       * net/tramp.el (tramp-ssh-controlmaster-options): Use "%C" for
+       ControlPath if possible.  (Bug#19702)
+
 2015-02-02  Glenn Morris  <address@hidden>
 
        * emacs-lisp/authors.el (authors-obsolete-files-regexps)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 3afb487..c442806 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -311,17 +311,25 @@ useful only in combination with 
`tramp-default-proxies-alist'.")
   (let ((result "")
        (case-fold-search t))
     (ignore-errors
-      (with-temp-buffer
-       (call-process "ssh" nil t nil "-o" "ControlMaster")
-       (goto-char (point-min))
-       (when (search-forward-regexp "missing.+argument" nil t)
-         (setq result "-o address@hidden:%%p -o ControlMaster=auto")))
-      (unless (zerop (length result))
+      (when (executable-find "ssh")
        (with-temp-buffer
-         (call-process "ssh" nil t nil "-o" "ControlPersist")
+         (call-process "ssh" nil t nil "-o" "ControlMaster")
          (goto-char (point-min))
          (when (search-forward-regexp "missing.+argument" nil t)
-           (setq result (concat result " -o ControlPersist=no"))))))
+           (setq result "-o ControlMaster=auto")))
+       (unless (zerop (length result))
+         (with-temp-buffer
+           (call-process
+            "ssh" nil t nil "-o" "ControlPath=%C" "host.does.not.exist")
+           (goto-char (point-min))
+           (if (search-forward-regexp "unknown.+key" nil t)
+               (setq result (concat result " -o address@hidden:%%p"))
+             (setq result (concat result " -o ControlPath=%t.%%C"))))
+         (with-temp-buffer
+           (call-process "ssh" nil t nil "-o" "ControlPersist")
+           (goto-char (point-min))
+           (when (search-forward-regexp "missing.+argument" nil t)
+             (setq result (concat result " -o ControlPersist=no")))))))
     result)
     "Call ssh to detect whether it supports the Control* arguments.
 Return a string to be used in `tramp-methods'.")



reply via email to

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