From 36a8b68b3381b77971c0fd655a8e7f41ecc58426 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 1 Mar 2013 09:13:53 +0100 Subject: [PATCH] * net/tramp.el (tramp-obsolete-methods): New defconst. (tramp-warned-obsolete-methods): New defvar. (tramp-find-method): Check for obsolete methods. Map them to a replacement method if appropriate. * net/tramp-sh.el (tramp-methods) [scp1, scp2, ssh1, ssh2, plink1]: Remove methods. (top): Remove completion functions for "scp1", "scp2", "ssh1", "ssh2" and "plink1". --- lisp/ChangeLog | 12 +++++++ lisp/net/tramp-sh.el | 76 -------------------------------------------- lisp/net/tramp.el | 48 +++++++++++++++++++++------- 3 files changed, 48 insertions(+), 88 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5ce0e6b597..2ffe23823b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,15 @@ +2013-03-01 Michael Albinus + + * net/tramp.el (tramp-obsolete-methods): New defconst. + (tramp-warned-obsolete-methods): New defvar. + (tramp-find-method): Check for obsolete methods. Map them to a + replacement method if appropriate. + + * net/tramp-sh.el (tramp-methods) [scp1, scp2, ssh1, ssh2, plink1]: + Remove methods. + (top): Remove completion functions for "scp1", "scp2", "ssh1", + "ssh2" and "plink1". + 2013-02-28 Dale Sedivec * textmodes/sgml-mode.el (sgml-syntax-propertize-function): diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index e2aaafb38d..9dd37fdf63 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -125,42 +125,6 @@ detected as prompt when being sent on echoing hosts, therefore.") ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22))) ;;;###tramp-autoload -(add-to-list 'tramp-methods - '("scp1" - (tramp-login-program "ssh") - (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") - ("-1") ("-e" "none") ("%h"))) - (tramp-async-args (("-q"))) - (tramp-remote-shell "/bin/sh") - (tramp-remote-shell-args ("-c")) - (tramp-copy-program "scp") - (tramp-copy-args (("-1") ("-P" "%p") ("-p" "%k") - ("-q") ("-r") ("%c"))) - (tramp-copy-keep-date t) - (tramp-copy-recursive t) - (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") - ("-o" "UserKnownHostsFile=/dev/null") - ("-o" "StrictHostKeyChecking=no"))) - (tramp-default-port 22))) -;;;###tramp-autoload -(add-to-list 'tramp-methods - '("scp2" - (tramp-login-program "ssh") - (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") - ("-2") ("-e" "none") ("%h"))) - (tramp-async-args (("-q"))) - (tramp-remote-shell "/bin/sh") - (tramp-remote-shell-args ("-c")) - (tramp-copy-program "scp") - (tramp-copy-args (("-2") ("-P" "%p") ("-p" "%k") - ("-q") ("-r") ("%c"))) - (tramp-copy-keep-date t) - (tramp-copy-recursive t) - (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") - ("-o" "UserKnownHostsFile=/dev/null") - ("-o" "StrictHostKeyChecking=no"))) - (tramp-default-port 22))) -;;;###tramp-autoload (add-to-list 'tramp-methods '("scpx" (tramp-login-program "ssh") @@ -232,32 +196,6 @@ detected as prompt when being sent on echoing hosts, therefore.") ("-o" "StrictHostKeyChecking=no"))) (tramp-default-port 22))) ;;;###tramp-autoload -(add-to-list 'tramp-methods - '("ssh1" - (tramp-login-program "ssh") - (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") - ("-1") ("-e" "none") ("%h"))) - (tramp-async-args (("-q"))) - (tramp-remote-shell "/bin/sh") - (tramp-remote-shell-args ("-c")) - (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") - ("-o" "UserKnownHostsFile=/dev/null") - ("-o" "StrictHostKeyChecking=no"))) - (tramp-default-port 22))) -;;;###tramp-autoload -(add-to-list 'tramp-methods - '("ssh2" - (tramp-login-program "ssh") - (tramp-login-args (("-l" "%u") ("-p" "%p") ("%c") - ("-2") ("-e" "none") ("%h"))) - (tramp-async-args (("-q"))) - (tramp-remote-shell "/bin/sh") - (tramp-remote-shell-args ("-c")) - (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") - ("-o" "UserKnownHostsFile=/dev/null") - ("-o" "StrictHostKeyChecking=no"))) - (tramp-default-port 22))) -;;;###tramp-autoload (add-to-list 'tramp-methods '("sshx" (tramp-login-program "ssh") @@ -315,14 +253,6 @@ detected as prompt when being sent on echoing hosts, therefore.") (tramp-remote-shell-args ("-c")) (tramp-default-port 22))) ;;;###tramp-autoload -(add-to-list 'tramp-methods - '("plink1" - (tramp-login-program "plink") - (tramp-login-args (("-l" "%u") ("-P" "%p") ("-1" "-ssh") ("%h"))) - (tramp-remote-shell "/bin/sh") - (tramp-remote-shell-args ("-c")) - (tramp-default-port 22))) -;;;###tramp-autoload (add-to-list 'tramp-methods `("plinkx" (tramp-login-program "plink") @@ -436,16 +366,12 @@ detected as prompt when being sent on echoing hosts, therefore.") (tramp-set-completion-function "rcp" tramp-completion-function-alist-rsh) (tramp-set-completion-function "remcp" tramp-completion-function-alist-rsh) (tramp-set-completion-function "scp" tramp-completion-function-alist-ssh) - (tramp-set-completion-function "scp1" tramp-completion-function-alist-ssh) - (tramp-set-completion-function "scp2" tramp-completion-function-alist-ssh) (tramp-set-completion-function "scpx" tramp-completion-function-alist-ssh) (tramp-set-completion-function "sftp" tramp-completion-function-alist-ssh) (tramp-set-completion-function "rsync" tramp-completion-function-alist-ssh) (tramp-set-completion-function "rsh" tramp-completion-function-alist-rsh) (tramp-set-completion-function "remsh" tramp-completion-function-alist-rsh) (tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh) - (tramp-set-completion-function "ssh1" tramp-completion-function-alist-ssh) - (tramp-set-completion-function "ssh2" tramp-completion-function-alist-ssh) (tramp-set-completion-function "sshx" tramp-completion-function-alist-ssh) (tramp-set-completion-function "telnet" tramp-completion-function-alist-telnet) @@ -455,8 +381,6 @@ detected as prompt when being sent on echoing hosts, therefore.") (tramp-set-completion-function "krlogin" tramp-completion-function-alist-rsh) (tramp-set-completion-function "plink" tramp-completion-function-alist-ssh) - (tramp-set-completion-function - "plink1" tramp-completion-function-alist-ssh) (tramp-set-completion-function "plinkx" tramp-completion-function-alist-putty) (tramp-set-completion-function "pscp" tramp-completion-function-alist-ssh) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index e5e6949213..d959cfc854 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1170,21 +1170,45 @@ If the `tramp-methods' entry does not exist, return nil." (and (stringp name) (string-match tramp-file-name-regexp name)))) +;; Obsoleted with Tramp 2.2.7. +(defconst tramp-obsolete-methods + '("ssh1" "ssh2" "scp1" "scp2" "scpc" "rsyncc" "plink1") + "Obsolete methods.") + +(defvar tramp-warned-obsolete-methods nil + "Which methods the user has been warned to be obsolete.") + (defun tramp-find-method (method user host) "Return the right method string to use. This is METHOD, if non-nil. Otherwise, do a lookup in -`tramp-default-method-alist'." - (or method - (let ((choices tramp-default-method-alist) - lmethod item) - (while choices - (setq item (pop choices)) - (when (and (string-match (or (nth 0 item) "") (or host "")) - (string-match (or (nth 1 item) "") (or user ""))) - (setq lmethod (nth 2 item)) - (setq choices nil))) - lmethod) - tramp-default-method)) +`tramp-default-method-alist'. It maps also obsolete methods to +their replacement." + (let ((result + (or method + (let ((choices tramp-default-method-alist) + lmethod item) + (while choices + (setq item (pop choices)) + (when (and (string-match (or (nth 0 item) "") (or host "")) + (string-match (or (nth 1 item) "") (or user ""))) + (setq lmethod (nth 2 item)) + (setq choices nil))) + lmethod) + tramp-default-method))) + ;; This is needed for a transition period only. + (when (member result tramp-obsolete-methods) + (unless (member result tramp-warned-obsolete-methods) + (if noninteractive + (warn "Method %s is obsolete, using %s" + result (substring result 0 -1)) + (unless (y-or-n-p (format "Method %s is obsolete, use %s? " + result (substring result 0 -1))) + (error 'file-error "Method \"%s\" not supported" result))) + (add-to-list 'tramp-warned-obsolete-methods result)) + ;; This works with the current set of `tramp-obsolete-methods'. + ;; Must be improved, if their are more sophisticated replacements. + (setq result (substring result 0 -1))) + result)) (defun tramp-find-user (method user host) "Return the right user string to use. -- 2.39.2