* [patch] Tramp Scpc Autodetection
@ 2010-04-08 14:56 Noah Lavine
2010-04-08 19:35 ` Davis Herring
2010-04-09 1:30 ` Glenn Morris
0 siblings, 2 replies; 3+ messages in thread
From: Noah Lavine @ 2010-04-08 14:56 UTC (permalink / raw)
To: emacs-devel
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'."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Tramp Scpc Autodetection
2010-04-08 14:56 [patch] Tramp Scpc Autodetection Noah Lavine
@ 2010-04-08 19:35 ` Davis Herring
2010-04-09 1:30 ` Glenn Morris
1 sibling, 0 replies; 3+ messages in thread
From: Davis Herring @ 2010-04-08 19:35 UTC (permalink / raw)
To: Noah Lavine; +Cc: emacs-devel
> I'd like to do whatever is necessary to contribute this patch to
> emacs. What is necessary for that?
I'm not in charge, but you'll certainly need a copyright assignment for
this if you don't already have one: I believe you just need to write to
copyright-clerk@fsf.org and ask for the form, but if I'm wrong a
maintainer (Stefan or Chong) will correct me shortly.
After review/revision of the patch and your assignment (which usually
takes longer), someone will commit your patch quickly. Since this is a
user-visible change (if a minor one), a NEWS entry might be helpful.
> 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?
Yes, although if you're reporting a bug (and possibly supplying a patch)
you should write to bug-gnu-emacs@gnu.org, which is backed by a database
so that bugs and patches don't get forgotten. For discussion of new
features or changes to the interface or so, this is the place; your case
is perhaps a gray area.
A few comments on the patch:
> +(defun detect-scpc ()
You should use the package prefix "tramp-" here.
> + (search-forward "OpenSSH_" nil t)
> + (looking-at "[0-9.]*")
> + (let ((ssl-version (read (match-string 0))))
> + (>= ssl-version 4.0))))))
This won't do the right thing if, say, the version is "4.3.2", because
`read' will treat it as a symbol, not a number. The obvious change is to
use "[0-9]+\\.?[0-9]*" as the regexp, which will also avoid an error if
there is no version string in the buffer at all (if, say, the process call
fails).
Davis
--
This product is sold by volume, not by mass. If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Tramp Scpc Autodetection
2010-04-08 14:56 [patch] Tramp Scpc Autodetection Noah Lavine
2010-04-08 19:35 ` Davis Herring
@ 2010-04-09 1:30 ` Glenn Morris
1 sibling, 0 replies; 3+ messages in thread
From: Glenn Morris @ 2010-04-09 1:30 UTC (permalink / raw)
To: Noah Lavine; +Cc: emacs-devel
Noah Lavine wrote:
> More generally, I couldn't find any information on the emacs website
> or in the manual about how to contribute to Emacs.
There's a section "Contributing to Emacs Development" in the manual,
and a file etc/CONTRIBUTE in the distribution (and now also linked
from the Emacs homepage at http://www.gnu.org/software/emacs/CONTRIBUTE )
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-09 1:30 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-08 14:56 [patch] Tramp Scpc Autodetection Noah Lavine
2010-04-08 19:35 ` Davis Herring
2010-04-09 1:30 ` Glenn Morris
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.