From: Noah Lavine <noah549@gmail.com>
To: emacs-devel@gnu.org
Subject: [patch] Tramp Scpc Autodetection
Date: Thu, 8 Apr 2010 10:56:50 -0400 [thread overview]
Message-ID: <g2v16d22e431004080756p239954b3k9989aad1e9986161@mail.gmail.com> (raw)
I recently noticed that Tramp won't use the "scpc" method of transfer
by default when it detects an ssh installation, even though it's
somewhat superior to the "ssh" method. It can't do this because only
OpenSSH 4.0 and greater have the ability to share SSH connections with
other programs. This patch gives Emacs the ability to check whether
OpenSSH 4.0 or greater is installed, and if so, to use the scpc
mechanism automatically.
I'd like to do whatever is necessary to contribute this patch to
emacs. What is necessary for that?
More generally, I couldn't find any information on the emacs website
or in the manual about how to contribute to Emacs. Is this list the
right place to send things like this?
Thank you
Noah Lavine
--- tramp-old.el 2010-04-08 10:40:26.000000000 -0400
+++ tramp.el 2010-04-08 10:41:03.000000000 -0400
@@ -653,38 +653,49 @@
`localhost' or the name of the local host. Another host name is
useful only in combination with `tramp-default-proxies-alist'.")
-
+(defun detect-scpc ()
+ (with-temp-buffer
+ (let ((ssh-call (condition-case nil
+ (call-process "ssh" nil t nil "-V")
+ (error nil))))
+ (and ssh-call
+ (goto-char (point-min))
+ (search-forward "OpenSSH_" nil t)
+ (looking-at "[0-9.]*")
+ (let ((ssl-version (read (match-string 0))))
+ (>= ssl-version 4.0))))))
(defcustom tramp-default-method
;; An external copy method seems to be preferred, because it is much
;; more performant for large files, and it hasn't too serious delays
;; for small files. But it must be ensured that there aren't
;; permanent password queries. Either a password agent like
- ;; "ssh-agent" or "Pageant" shall run, or the optional password.el
- ;; package shall be active for password caching. "scpc" would be
- ;; another good choice because of the "ControlMaster" option, but
- ;; this is a more modern alternative in OpenSSH 4, which cannot be
- ;; taken as default.
- (cond
- ;; PuTTY is installed.
- ((executable-find "pscp")
- (if (or (fboundp 'password-read)
+ ;; "ssh-agent" or "Pageant" shall run, or the optional
+ ;; password-cache.el or auth-sources.el packages shall be active for
+ ;; password caching.
+ ;; "scpc" is chosen if we detect that the user is running OpenSSH 4.0
+ ;; or newer.
+ cond
+ ;; PuTTY is installed.
+ ((executable-find "pscp")
+ (if (or (fboundp 'password-read)
+ (fboundp 'auth-source-user-or-password)
;; Pageant is running.
- (and (fboundp 'w32-window-exists-p)
- (funcall (symbol-function 'w32-window-exists-p)
- "Pageant" "Pageant")))
- "pscp"
- "plink"))
- ;; There is an ssh installation.
- ((executable-find "scp")
- (if (or (fboundp 'password-read)
- ;; ssh-agent is running.
- (getenv "SSH_AUTH_SOCK")
- (getenv "SSH_AGENT_PID"))
- "scp"
- "ssh"))
- ;; Fallback.
- (t "ftp"))
+ (tramp-compat-process-running-p "Pageant"))
+ "pscp"
+ "plink"))
+ ;; There is an ssh installation.
+ ((executable-find "scp")
+ (cond
+ ((detect-scpc) "scpc")
+ ((or (fboundp 'password-read)
+ (fboundp 'auth-source-user-or-password)
+ ;; ssh-agent is running.
+ (getenv "SSH_AUTH_SOCK")
+ (getenv "SSH_AGENT_PID")) "scp")
+ (t "ssh")))
+ ;; Fallback.
+ (t "ftp")
"*Default method to use for transferring files.
See `tramp-methods' for possibilities.
Also see `tramp-default-method-alist'."
next reply other threads:[~2010-04-08 14:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-08 14:56 Noah Lavine [this message]
2010-04-08 19:35 ` [patch] Tramp Scpc Autodetection Davis Herring
2010-04-09 1:30 ` Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=g2v16d22e431004080756p239954b3k9989aad1e9986161@mail.gmail.com \
--to=noah549@gmail.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.