From b25a52ccdc761394d65f20f868dd154e805a6f19 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kai=20Gro=C3=9Fjohann?= Date: Sat, 24 May 2003 14:10:15 +0000 Subject: [PATCH] Version 2.0.34 (of Tramp) released. (tramp-handle-file-symlink-p): If target of symlink is absolute, return a Tramp filename. (Ie, return "/user@host:/target" instead of "/target".) (tramp-handle-file-truename): Deal with new return value from `file-symlink-p'. (tramp-handle-expand-file-name): Make default method explicit in file name. (tramp-unified-filenames): Move to an earlier spot in the file. (top-level): If tramp-unified-filenames is set and we're running on XEmacs, load tramp-efs. (tramp-wait-for-shell-prompt, tramp-barf-if-no-shell-prompt): New functions, used by tramp-send-command-internal. (tramp-open-connection-setup-interactive-shell): Simplify using `tramp-send-command-internal'. (tramp-send-command-internal): New function. (tramp-methods): New entries "remsh" and "remcp" are like "rsh" and "rcp" but invoke "remsh" instead of "rsh". This is useful on Cray systems, for instance. Unify tramp-rsh-program, tramp-telnet-program, tramp-su-program into tramp-login-program. Likewise with tramp-login-args, tramp-copy-program, tramp-copy-args, tramp-copy-keep-date-arg. Users changed. New method plink1; like plink but pass "-1" to force protocol version 1. (tramp-default-method): Use plink as the default on machines where the plink program is present. (tramp-completion-file-name-handler): Add safe-magic property. (tramp-shell-prompt-pattern): Allow ANSI escapes at end of prompt. (ANSI escapes elsewhere in the prompt are recognized properly already.) --- lisp/ChangeLog | 45 +++ lisp/net/tramp-ftp.el | 2 +- lisp/net/tramp.el | 819 ++++++++++++++++++------------------------ lisp/net/trampver.el | 2 +- 4 files changed, 394 insertions(+), 474 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ab414763d2d..4f50db25f05 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,48 @@ +2003-05-24 Kai Gro,A_(Bjohann + + * net/tramp.el: Version 2.0.34 released. + (tramp-handle-file-symlink-p): If target of symlink is absolute, + return a Tramp filename. (Ie, return "/user@host:/target" instead + of "/target".) + (tramp-handle-file-truename): Deal with new return value from + `file-symlink-p'. + (tramp-handle-expand-file-name): Make default method explicit in + file name. + (tramp-unified-filenames): Move to an earlier spot in the file. + (top-level): If tramp-unified-filenames is set and we're running + on XEmacs, load tramp-efs. + (tramp-wait-for-shell-prompt, tramp-barf-if-no-shell-prompt): New + functions, used by tramp-send-command-internal. + (tramp-open-connection-setup-interactive-shell): Simplify using + `tramp-send-command-internal'. + (tramp-send-command-internal): New function. + (tramp-methods): New entries "remsh" and "remcp" are like "rsh" + and "rcp" but invoke "remsh" instead of "rsh". This is useful on + Cray systems, for instance. Unify tramp-rsh-program, + tramp-telnet-program, tramp-su-program into tramp-login-program. + Likewise with tramp-login-args, tramp-copy-program, + tramp-copy-args, tramp-copy-keep-date-arg. Users changed. New + method plink1; like plink but pass "-1" to force protocol version + 1. + (tramp-default-method): Use plink as the default on machines where + the plink program is present. + (tramp-completion-file-name-handler): Add safe-magic property. + (tramp-shell-prompt-pattern): Allow ANSI escapes at + end of prompt. (ANSI escapes elsewhere in the prompt are + recognized properly already.) + + * net/tramp-efs.el: New file. + +2003-05-24 Michael Albinus + + * net/tramp.el (tramp-handle-file-truename): `sym' shouldn't be + quoted. + (tramp-methods, tramp-multi-connection-function-alist): Use + argument "-p Password:" for "sudo" method, because password prompt + might be changed by either passprompt option in /etc/sudoers, or + SUDO_PROMPT environment variable. Suggested by Peter Oliver + . + 2003-05-23 Nick Roberts * gdb-ui.el (gdba): Accommodate Fortran programs. diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index 1d2ab9083f9..07a756c3523 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el @@ -102,7 +102,7 @@ pass to the OPERATION." (cond ;; If argument is a symlink, 'file-directory-p` and 'file-exists-p` ;; call the traversed file recursively. So we cannot disable the - ;;file-name-handler this case. + ;; file-name-handler this case. ((memq operation '(file-directory-p file-exists-p)) (apply 'ange-ftp-hook-function operation args)) ;; Normally, the handlers must be discarded diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 892071114bf..b88c73ebce8 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -87,9 +87,18 @@ (unless (fboundp 'uudecode-decode-region) (autoload 'uudecode-decode-region "uudecode")) -;; ;; It does not work to load EFS after loading TRAMP. -;; (when (fboundp 'efs-file-handler-function) -;; (require 'efs)) +;; XEmacs is distributed with few Lisp packages. Further packages are +;; installed using EFS. If we use a unified filename format, then +;; Tramp is required in addition to EFS. (But why can't Tramp just +;; disable EFS when Tramp is loaded? Then XEmacs can ship with EFS +;; just like before.) Another reason for using a separate filename +;; syntax on XEmacs is that EFS hooks into XEmacs in many places, but +;; Tramp only knows how to deal with `file-name-handler-alist', not +;; the other places. +;;;###autoload +(defvar tramp-unified-filenames (not (featurep 'xemacs)) + "Non-nil means to use unified Ange-FTP/Tramp filename syntax. +Nil means to use a separate filename syntax for Tramp.") ;; Load foreign methods. Because they do require Tramp internally, this ;; must be done with the `eval-after-load' trick. @@ -98,6 +107,9 @@ (unless (featurep 'xemacs) (eval-after-load "tramp" '(require 'tramp-ftp))) +(when (and tramp-unified-filenames (featurep 'xemacs)) + (eval-after-load "tramp" + '(require 'tramp-efs))) ;; tramp-smb uses "smbclient" from Samba. ;; Not available under Cygwin and Windows, because they don't offer @@ -123,19 +135,6 @@ (when (fboundp 'byte-compiler-options) (byte-compiler-options (warnings (- unused-vars))))) -;; XEmacs is distributed with few Lisp packages. Further packages are -;; installed using EFS. If we use a unified filename format, then -;; Tramp is required in addition to EFS. (But why can't Tramp just -;; disable EFS when Tramp is loaded? Then XEmacs can ship with EFS -;; just like before.) Another reason for using a separate filename -;; syntax on XEmacs is that EFS hooks into XEmacs in many places, but -;; Tramp only knows how to deal with `file-name-handler-alist', not -;; the other places. -;;;###autoload -(defvar tramp-unified-filenames (not (featurep 'xemacs)) - "Non-nil means to use unified Ange-FTP/Tramp filename syntax. -Nil means to use a separate filename syntax for Tramp.") - ;;; User Customizable Internal Variables: (defgroup tramp nil @@ -234,265 +233,198 @@ This variable defaults to the value of `tramp-encoding-shell'." (defcustom tramp-methods '( ("rcp" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "rsh") - (tramp-rcp-program "rcp") + (tramp-login-program "rsh") + (tramp-copy-program "rcp") (tramp-remote-sh "/bin/sh") - (tramp-rsh-args nil) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg "-p") - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args nil) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg "-p")) ("scp" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh") - (tramp-rcp-program "scp") + (tramp-login-program "ssh") + (tramp-copy-program "scp") (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-e" "none")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg "-p") - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-e" "none")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg "-p")) ("scp1" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh") - (tramp-rcp-program "scp") + (tramp-login-program "ssh") + (tramp-copy-program "scp") (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-1" "-e" "none")) - (tramp-rcp-args ("-1")) - (tramp-rcp-keep-date-arg "-p") - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-1" "-e" "none")) + (tramp-copy-args ("-1")) + (tramp-copy-keep-date-arg "-p")) ("scp2" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh") - (tramp-rcp-program "scp") + (tramp-login-program "ssh") + (tramp-copy-program "scp") (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-2" "-e" "none")) - (tramp-rcp-args ("-2")) - (tramp-rcp-keep-date-arg "-p") - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-2" "-e" "none")) + (tramp-copy-args ("-2")) + (tramp-copy-keep-date-arg "-p")) ("scp1_old" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh1") - (tramp-rcp-program "scp1") + (tramp-login-program "ssh1") + (tramp-copy-program "scp1") (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-e" "none")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg "-p") - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-e" "none")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg "-p")) ("scp2_old" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh2") - (tramp-rcp-program "scp2") + (tramp-login-program "ssh2") + (tramp-copy-program "scp2") (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-e" "none")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg "-p") - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-e" "none")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg "-p")) ("rsync" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh") - (tramp-rcp-program "rsync") + (tramp-login-program "ssh") + (tramp-copy-program "rsync") (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-e" "none")) - (tramp-rcp-args ("-e" "ssh")) - (tramp-rcp-keep-date-arg "-t") - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-e" "none")) + (tramp-copy-args ("-e" "ssh")) + (tramp-copy-keep-date-arg "-t")) + ("remcp" (tramp-connection-function tramp-open-connection-rsh) + (tramp-login-program "remsh") + (tramp-copy-program "rcp") + (tramp-remote-sh "/bin/sh") + (tramp-login-args nil) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg "-p")) ("rsh" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "rsh") - (tramp-rcp-program nil) + (tramp-login-program "rsh") + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args nil) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args nil) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) ("ssh" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh") - (tramp-rcp-program nil) + (tramp-login-program "ssh") + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-e" "none")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-e" "none")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) ("ssh1" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh") - (tramp-rcp-program nil) + (tramp-login-program "ssh") + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-1" "-e" "none")) - (tramp-rcp-args ("-1")) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-1" "-e" "none")) + (tramp-copy-args ("-1")) + (tramp-copy-keep-date-arg nil)) ("ssh2" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh") - (tramp-rcp-program nil) + (tramp-login-program "ssh") + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-2" "-e" "none")) - (tramp-rcp-args ("-2")) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-2" "-e" "none")) + (tramp-copy-args ("-2")) + (tramp-copy-keep-date-arg nil)) ("ssh1_old" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh1") - (tramp-rcp-program nil) + (tramp-login-program "ssh1") + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-e" "none")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-e" "none")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) ("ssh2_old" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh2") - (tramp-rcp-program nil) + (tramp-login-program "ssh2") + (tramp-copy-program nil) + (tramp-remote-sh "/bin/sh") + (tramp-login-args ("-e" "none")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) + ("remsh" (tramp-connection-function tramp-open-connection-rsh) + (tramp-login-program "remsh") + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-e" "none")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args nil) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) ("telnet" (tramp-connection-function tramp-open-connection-telnet) - (tramp-rsh-program nil) - (tramp-rcp-program nil) + (tramp-login-program "telnet") + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args nil) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program "telnet") - (tramp-telnet-args nil)) + (tramp-login-args nil) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) ("su" (tramp-connection-function tramp-open-connection-su) - (tramp-rsh-program nil) - (tramp-rcp-program nil) + (tramp-login-program "su") + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args nil) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program "su") - (tramp-su-args ("-" "%u")) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-" "%u")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) ("sudo" (tramp-connection-function tramp-open-connection-su) - (tramp-rsh-program nil) - (tramp-rcp-program nil) + (tramp-login-program "sudo") + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args nil) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program "sudo") - (tramp-su-args ("-u" "%u" "-s")) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-u" "%u" "-s" + "-p" "Password:")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) ("multi" (tramp-connection-function tramp-open-connection-multi) - (tramp-rsh-program nil) - (tramp-rcp-program nil) + (tramp-login-program nil) + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args nil) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args nil) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) ("scpx" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh") - (tramp-rcp-program "scp") + (tramp-login-program "ssh") + (tramp-copy-program "scp") (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-e" "none" "-t" "-t" "/bin/sh")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg "-p") - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-e" "none" "-t" "-t" "/bin/sh")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg "-p")) ("sshx" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh") - (tramp-rcp-program nil) + (tramp-login-program "ssh") + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-e" "none" "-t" "-t" "/bin/sh")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-e" "none" "-t" "-t" "/bin/sh")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) ("krlogin" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "krlogin") - (tramp-rcp-program nil) + (tramp-login-program "krlogin") + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-x")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-x")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) ("plink" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "plink") - (tramp-rcp-program nil) + (tramp-login-program "plink") + (tramp-copy-program nil) + (tramp-remote-sh "/bin/sh") + (tramp-login-args ("-ssh")) ;optionally add "-v" + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) + ("plink1" + (tramp-connection-function tramp-open-connection-rsh) + (tramp-login-program "plink") + (tramp-copy-program nil) (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-ssh")) ;optionally add "-v" - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-1" "-ssh")) ;optionally add "-v" + (tramp-copy-args nil) + (tramp-copy-keep-date-arg nil)) ("pscp" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "plink") - (tramp-rcp-program "pscp") + (tramp-login-program "plink") + (tramp-copy-program "pscp") (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-ssh")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg "-p") - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("-ssh")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg "-p")) ("fcp" (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "fsh") - (tramp-rcp-program "fcp") + (tramp-login-program "fsh") + (tramp-copy-program "fcp") (tramp-remote-sh "/bin/sh -i") - (tramp-rsh-args ("sh" "-i")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg "-p") - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) + (tramp-login-args ("sh" "-i")) + (tramp-copy-args nil) + (tramp-copy-keep-date-arg "-p")) ) "*Alist of methods for remote files. This is a list of entries of the form (NAME PARAM1 PARAM2 ...). @@ -510,57 +442,52 @@ pair of the form (KEY VALUE). The following KEYs are defined: which groks tilde expansion, but it can search for it. Also note that \"/bin/sh\" exists on all Unixen, this might not be true for the value that you decide to use. You Have Been Warned. - * `tramp-rsh-program' - This specifies the name of the program to use for rsh; this might be - the absolute filename of rsh or the name of a workalike program. - * `tramp-rsh-args' + * `tramp-login-program' + This specifies the name of the program to use for logging in to the + remote host. Depending on `tramp-connection-function', this may be + the name of rsh or a workalike program (when + `tramp-connection-function' is `tramp-open-connection-rsh'), or the + name of telnet or a workalike (for `tramp-open-connection-telnet'), + or the name of su or a workalike (for `tramp-open-connection-su'). + * `tramp-login-args' This specifies the list of arguments to pass to the above mentioned program. Please note that this is a list of arguments, that is, normally you don't want to put \"-a -b\" or \"-f foo\" here. Instead, you want two list elements, one for \"-a\" and one for \"-b\", or one for \"-f\" and one for \"foo\". - * `tramp-rcp-program' - This specifies the name of the program to use for rcp; this might be - the absolute filename of rcp or the name of a workalike program. - * `tramp-rcp-args' + If `tramp-connection-function' is `tramp-open-connection-su', then + \"%u\" in this list is replaced by the user name, and \"%%\" can + be used to obtain a literal percent character. + * `tramp-copy-program' + This specifies the name of the program to use for remotely copying + the file; this might be the absolute filename of rcp or the name of + a workalike program. + * `tramp-copy-args' This specifies the list of parameters to pass to the above mentioned - program, the hints for `tramp-rsh-args' also apply here. - * `tramp-rcp-keep-date-arg' - This specifies the parameter to use for `rcp' when the timestamp - of the original file should be kept. For `rcp', use `-p', for + program, the hints for `tramp-login-args' also apply here. + * `tramp-copy-keep-date-arg' + This specifies the parameter to use for the copying program when the + timestamp of the original file should be kept. For `rcp', use `-p', for `rsync', use `-t'. - * `tramp-su-program' - This specifies the name of the program to use for `su'. - * `tramp-su-args' - This specifies the list of arguments to pass to `su'. - \"%u\" is replaced by the user name, use \"%%\" for a literal - percent character. - * `tramp-telnet-program' - Specifies the telnet program to use when using - `tramp-open-connection-telnet' to log in. - * `tramp-telnet-args' - Specifies list of arguments to pass to `telnet'. The hints for - `tramp-rsh-args' also apply here. - -What does all this mean? Well, you should specify `tramp-rsh-program', -`tramp-telnet-program' or `tramp-su-program' for all methods; this program -is used to log in to the remote site. Then, there are two ways to -actually transfer the files between the local and the remote side. -One way is using an additional rcp-like program. If you want to do -this, set `tramp-rcp-program' in the method. + +What does all this mean? Well, you should specify `tramp-login-program' +for all methods; this program is used to log in to the remote site. Then, +there are two ways to actually transfer the files between the local and the +remote side. One way is using an additional rcp-like program. If you want +to do this, set `tramp-copy-program' in the method. Another possibility for file transfer is inline transfer, i.e. the -file is passed through the same buffer used by `tramp-rsh-program'. In +file is passed through the same buffer used by `tramp-login-program'. In this case, the file contents need to be protected since the -`tramp-rsh-program' might use escape codes or the connection might not +`tramp-login-program' might use escape codes or the connection might not be eight-bit clean. Therefore, file contents are encoded for transit. See the variable `tramp-coding-commands' for details. So, to summarize: if the method is an out-of-band method, then you -must specify `tramp-rcp-program' and `tramp-rcp-args'. If it is an +must specify `tramp-copy-program' and `tramp-copy-args'. If it is an inline method, then these two parameters should be nil. Every method, inline or out of band, must specify `tramp-connection-function' plus -the associated arguments (for example, the telnet program if you chose +the associated arguments (for example, the login program if you chose `tramp-open-connection-telnet'). Notes: @@ -574,19 +501,16 @@ host other than `localhost' or the name of the local host." :type '(repeat (cons string (set (list (const tramp-connection-function) function) - (list (const tramp-rsh-program) + (list (const tramp-login-program) (choice (const nil) string)) - (list (const tramp-rcp-program) + (list (const tramp-copy-program) (choice (const nil) string)) (list (const tramp-remote-sh) (choice (const nil) string)) - (list (const tramp-rsh-args) (repeat string)) - (list (const tramp-rcp-args) (repeat string)) - (list (const tramp-rcp-keep-date-arg) - (choice (const nil) string)) - (list (const tramp-su-program) + (list (const tramp-login-args) (repeat string)) + (list (const tramp-copy-args) (repeat string)) + (list (const tramp-copy-keep-date-arg) (choice (const nil) string)) - (list (const tramp-su-args) (repeat string)) (list (const tramp-encoding-command) (choice (const nil) string)) (list (const tramp-decoding-command) @@ -594,10 +518,7 @@ host other than `localhost' or the name of the local host." (list (const tramp-encoding-function) (choice (const nil) function)) (list (const tramp-decoding-function) - (choice (const nil) function)) - (list (const tramp-telnet-program) - (choice (const nil) string)) - (list (const tramp-telnet-args) (repeat string)))))) + (choice (const nil) function)))))) (defcustom tramp-multi-methods '("multi" "multiu") "*List of multi-hop methods. @@ -609,9 +530,10 @@ variable `tramp-methods'." (defcustom tramp-multi-connection-function-alist '(("telnet" tramp-multi-connect-telnet "telnet %h%n") ("rsh" tramp-multi-connect-rlogin "rsh %h -l %u%n") + ("remsh" tramp-multi-connect-rlogin "remsh %h -l %u%n") ("ssh" tramp-multi-connect-rlogin "ssh %h -l %u%n") ("su" tramp-multi-connect-su "su - %u%n") - ("sudo" tramp-multi-connect-su "sudo -u %u -s%n")) + ("sudo" tramp-multi-connect-su "sudo -u %u -s -p Password:%n")) "*List of connection functions for multi-hop methods. Each list item is a list of three items (METHOD FUNCTION COMMAND), where METHOD is the name as used in the file name, FUNCTION is the @@ -629,7 +551,11 @@ various functions for details." :group 'tramp :type '(repeat (list string function string))) -(defcustom tramp-default-method "ssh" +(defcustom tramp-default-method + (if (and (fboundp 'executable-find) + (executable-find "plink")) + "plink" + "ssh") "*Default method to use for transferring files. See `tramp-methods' for possibilities. Also see `tramp-default-method-alist'." @@ -659,8 +585,7 @@ See `tramp-methods' for a list of possibilities for METHOD." (unless (memq system-type '(windows-nt)) '((tramp-parse-rhosts "/etc/hosts.equiv") (tramp-parse-rhosts "~/.rhosts"))) - "Default list of (FUNCTION FILE) pairs to be examined for rsh methods." -) + "Default list of (FUNCTION FILE) pairs to be examined for rsh methods.") ;; Default values for non-Unices seeked (defconst tramp-completion-function-alist-ssh @@ -673,22 +598,19 @@ See `tramp-methods' for a list of possibilities for METHOD." (tramp-parse-rhosts "~/.shosts") (tramp-parse-shosts "~/.ssh/known_hosts") (tramp-parse-sconfig "~/.ssh/config"))) - "Default list of (FUNCTION FILE) pairs to be examined for ssh methods." -) + "Default list of (FUNCTION FILE) pairs to be examined for ssh methods.") ;; Default values for non-Unices seeked (defconst tramp-completion-function-alist-telnet (unless (memq system-type '(windows-nt)) '((tramp-parse-hosts "/etc/hosts"))) - "Default list of (FUNCTION FILE) pairs to be examined for telnet methods." -) + "Default list of (FUNCTION FILE) pairs to be examined for telnet methods.") ;; Default values for non-Unices seeked (defconst tramp-completion-function-alist-su (unless (memq system-type '(windows-nt)) '((tramp-parse-passwd "/etc/passwd"))) - "Default list of (FUNCTION FILE) pairs to be examined for su methods." -) + "Default list of (FUNCTION FILE) pairs to be examined for su methods.") (defcustom tramp-completion-function-alist (list (cons "rcp" tramp-completion-function-alist-rsh) @@ -774,14 +696,14 @@ The regexp should match at end of buffer." :type 'regexp) (defcustom tramp-shell-prompt-pattern - "^[^#$%>\n]*[#$%>] *" + "^[^#$%>\n]*[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z]\\)?" "Regexp to match prompts from remote shell. Normally, Tramp expects you to configure `shell-prompt-pattern' correctly, but sometimes it happens that you are connecting to a remote host which sends a different kind of shell prompt. Therefore, Tramp recognizes things matched by `shell-prompt-pattern' as prompt, and also things matched by this variable. The default value of this -variable is the same as the default value of `shell-prompt-pattern', +variable is similar to the default value of `shell-prompt-pattern', which should work well in many cases." :group 'tramp :type 'regexp) @@ -1315,27 +1237,27 @@ method parameter, as specified in `tramp-methods' (which see).") In the connection buffer, this variable has the value of the like-named method parameter, as specified in `tramp-methods' (which see).") -(defvar tramp-rsh-program nil +(defvar tramp-login-program nil "This internal variable holds a parameter for `tramp-methods'. In the connection buffer, this variable has the value of the like-named method parameter, as specified in `tramp-methods' (which see).") -(defvar tramp-rsh-args nil +(defvar tramp-login-args nil "This internal variable holds a parameter for `tramp-methods'. In the connection buffer, this variable has the value of the like-named method parameter, as specified in `tramp-methods' (which see).") -(defvar tramp-rcp-program nil +(defvar tramp-copy-program nil "This internal variable holds a parameter for `tramp-methods'. In the connection buffer, this variable has the value of the like-named method parameter, as specified in `tramp-methods' (which see).") -(defvar tramp-rcp-args nil +(defvar tramp-copy-args nil "This internal variable holds a parameter for `tramp-methods'. In the connection buffer, this variable has the value of the like-named method parameter, as specified in `tramp-methods' (which see).") -(defvar tramp-rcp-keep-date-arg nil +(defvar tramp-copy-keep-date-arg nil "This internal variable holds a parameter for `tramp-methods'. In the connection buffer, this variable has the value of the like-named method parameter, as specified in `tramp-methods' (which see).") @@ -1360,21 +1282,6 @@ method parameter, as specified in `tramp-methods' (which see).") In the connection buffer, this variable has the value of the like-named method parameter, as specified in `tramp-methods' (which see).") -(defvar tramp-telnet-program nil - "This internal variable holds a parameter for `tramp-methods'. -In the connection buffer, this variable has the value of the like-named -method parameter, as specified in `tramp-methods' (which see).") - -(defvar tramp-telnet-args nil - "This internal variable holds a parameter for `tramp-methods'. -In the connection buffer, this variable has the value of the like-named -method parameter, as specified in `tramp-methods' (which see).") - -(defvar tramp-su-program nil - "This internal variable holds a parameter for `tramp-methods'. -In the connection buffer, this variable has the value of the like-named -method parameter, as specified in `tramp-methods' (which see).") - ;; CCC `local in each buffer'? (defvar tramp-ls-command nil "This command is used to get a long listing with numeric user and group ids. @@ -1944,6 +1851,17 @@ target of the symlink differ." (setq numchase (1+ numchase)) (when (file-name-absolute-p symlink-target) (setq result nil)) + ;; If the symlink was absolute, we'll get a string like + ;; "/user@host:/some/target"; extract the + ;; "/some/target" part from it. + (when (tramp-tramp-file-p symlink-target) + (with-parsed-tramp-file-name symlink-target sym + (unless (equal (list multi-method method user host) + (list sym-multi-method sym-method + sym-user sym-host)) + (error "Symlink target `%s' on wrong host" + symlink-target)) + (setq symlink-target localname))) (setq steps (append (tramp-split-string symlink-target "/") steps))) (t @@ -2321,7 +2239,13 @@ if the remote host can't provide the modtime." "Like `file-symlink-p' for tramp files." (with-parsed-tramp-file-name filename nil (let ((x (car (tramp-handle-file-attributes filename)))) - (when (stringp x) x)))) + (when (stringp x) + ;; When Tramp is running on VMS, then `file-name-absolute-p' + ;; might do weird things. + (if (file-name-absolute-p x) + (tramp-make-tramp-file-name + multi-method method user host x) + x))))) (defun tramp-handle-file-writable-p (filename) "Like `file-writable-p' for tramp files." @@ -2604,7 +2528,7 @@ and `rename'. FILENAME and NEWNAME must be absolute file names." ;; source and target file. ;; CCC: If both source and target are Tramp files, - ;; and both are using the same rcp-program, then we + ;; and both are using the same copy-program, then we ;; can invoke rcp directly. Note that ;; default-directory should point to a local ;; directory if we want to invoke rcp. @@ -2922,7 +2846,8 @@ the result will be a local, non-Tramp, filename." ;; would otherwise use backslash. (let ((directory-sep-char ?/)) (tramp-make-tramp-file-name - multi-method method user host + multi-method (or method (tramp-find-default-method user host)) + user host (tramp-drop-volume-letter (tramp-run-real-handler 'expand-file-name (list localname))))))))) @@ -3012,14 +2937,14 @@ This will break if COMMAND prints a newline, followed by the value of (with-parsed-tramp-file-name filename nil (let ((output-buf (get-buffer-create "*tramp output*")) (tramp-buf (tramp-get-buffer multi-method method user host)) - (rcp-program (tramp-get-rcp-program - multi-method - (tramp-find-method multi-method method user host) - user host)) - (rcp-args (tramp-get-rcp-args - multi-method - (tramp-find-method multi-method method user host) - user host)) + (copy-program (tramp-get-copy-program + multi-method + (tramp-find-method multi-method method user host) + user host)) + (copy-args (tramp-get-copy-args + multi-method + (tramp-find-method multi-method method user host) + user host)) ;; We used to bind the following as late as possible. ;; loc-enc and loc-dec were bound directly before the if ;; statement that checks them. But the functions @@ -3035,7 +2960,7 @@ This will break if COMMAND prints a newline, followed by the value of (error "Cannot make local copy of non-existing file `%s'" filename)) (setq tmpfil (tramp-make-temp-file)) - (cond (rcp-program + (cond (copy-program ;; Use rcp-like program for file transfer. (tramp-message-for-buffer multi-method method user host @@ -3044,11 +2969,11 @@ This will break if COMMAND prints a newline, followed by the value of (unless (equal 0 (apply #'call-process - rcp-program + copy-program nil output-buf nil - (append rcp-args + (append copy-args (list - (tramp-make-rcp-program-file-name + (tramp-make-copy-program-file-name user host (tramp-shell-quote-argument localname)) tmpfil)))) @@ -3056,7 +2981,7 @@ This will break if COMMAND prints a newline, followed by the value of (error (concat "tramp-handle-file-local-copy: `%s' didn't work, " "see buffer `%s' for details") - rcp-program output-buf)) + copy-program output-buf)) (tramp-message-for-buffer multi-method method user host 5 "Fetching %s to tmp file %s...done" filename tmpfil)) @@ -3180,10 +3105,11 @@ This will break if COMMAND prints a newline, followed by the value of (error "File not overwritten"))) (with-parsed-tramp-file-name filename nil (let ((curbuf (current-buffer)) - (rcp-program (tramp-get-rcp-program - multi-method (tramp-find-method multi-method method user host) - user host)) - (rcp-args (tramp-get-rcp-args + (copy-program (tramp-get-copy-program + multi-method + (tramp-find-method multi-method method user host) + user host)) + (copy-args (tramp-get-copy-args multi-method (tramp-find-method multi-method method user host) user host)) @@ -3221,17 +3147,17 @@ This will break if COMMAND prints a newline, followed by the value of ;; decoding command must be specified. However, if the method ;; _also_ specifies an encoding function, then that is used for ;; encoding the contents of the tmp file. - (cond (rcp-program + (cond (copy-program ;; use rcp-like program for file transfer - (let ((argl (append rcp-args + (let ((argl (append copy-args (list tmpfil - (tramp-make-rcp-program-file-name + (tramp-make-copy-program-file-name user host (tramp-shell-quote-argument localname)))))) (tramp-message-for-buffer multi-method method user host - 6 "Writing tmp file using `%s'..." rcp-program) + 6 "Writing tmp file using `%s'..." copy-program) (save-excursion (set-buffer trampbuf) (erase-buffer)) (when tramp-debug-buffer (save-excursion @@ -3239,19 +3165,19 @@ This will break if COMMAND prints a newline, followed by the value of method user host)) (goto-char (point-max)) (tramp-insert-with-face - 'bold (format "$ %s %s\n" rcp-program + 'bold (format "$ %s %s\n" copy-program (mapconcat 'identity argl " "))))) (unless (equal 0 (apply #'call-process - rcp-program nil trampbuf nil argl)) + copy-program nil trampbuf nil argl)) (pop-to-buffer trampbuf) (error "Cannot write region to file `%s', command `%s' failed" - filename rcp-program)) + filename copy-program)) (tramp-message-for-buffer multi-method method user host 6 "Transferring file using `%s'...done" - rcp-program))) + copy-program))) ((and rem-enc rem-dec) ;; Use inline file transfer (let ((tmpbuf (get-buffer-create " *tramp file transfer*"))) @@ -3505,6 +3431,7 @@ Falls back to normal file name handler if no tramp file name handler exists." (fn (apply (cdr fn) args)) (t (tramp-run-real-handler operation args)))))) +;;;###autoload (put 'tramp-file-name-handler 'file-remote-p t) ;for file-remote-p ;;;###autoload @@ -3520,6 +3447,9 @@ Falls back to normal file name handler if no tramp file name handler exists." (save-match-data (apply (cdr fn) args)) (tramp-completion-run-real-handler operation args)))) +;;;###autoload +(put 'tramp-completion-file-name-handler 'safe-magic t) + ;; Register in file name handler alist ;;;###autoload (add-to-list 'file-name-handler-alist @@ -4608,12 +4538,12 @@ Maybe the different regular expressions need to be tuned. (p (apply 'start-process (tramp-buffer-name multi-method method user host) (tramp-get-buffer multi-method method user host) - (tramp-get-telnet-program + (tramp-get-login-program multi-method (tramp-find-method multi-method method user host) user host) host - (tramp-get-telnet-args + (tramp-get-login-args multi-method (tramp-find-method multi-method method user host) user host))) @@ -4665,18 +4595,18 @@ arguments, and xx will be used as the host name to connect to. (let ((process-environment (copy-sequence process-environment)) (bufnam (tramp-buffer-name multi-method method user host)) (buf (tramp-get-buffer multi-method method user host)) - (rsh-program (tramp-get-rsh-program + (login-program (tramp-get-login-program multi-method (tramp-find-method multi-method method user host) user host)) - (rsh-args (tramp-get-rsh-args + (login-args (tramp-get-login-args multi-method (tramp-find-method multi-method method user host) user host))) ;; The following should be changed. We need a more general ;; mechanism to parse extra host args. (when (string-match "\\([^#]*\\)#\\(.*\\)" host) - (setq rsh-args (cons "-p" (cons (match-string 2 host) rsh-args))) + (setq login-args (cons "-p" (cons (match-string 2 host) rsh-args))) (setq host (match-string 1 host))) (setenv "TERM" tramp-terminal-type) (let* ((default-directory (tramp-temporary-file-directory)) @@ -4687,10 +4617,10 @@ arguments, and xx will be used as the host name to connect to. (> emacs-major-version 20)) tramp-dos-coding-system)) (p (if (and user (not (string= user ""))) - (apply #'start-process bufnam buf rsh-program - host "-l" user rsh-args) - (apply #'start-process bufnam buf rsh-program - host rsh-args))) + (apply #'start-process bufnam buf login-program + host "-l" user login-args) + (apply #'start-process bufnam buf login-program + host login-args))) (found nil)) (process-kill-without-query p) @@ -4740,14 +4670,14 @@ prompt than you do, so it is not at all unlikely that the variable (p (apply 'start-process (tramp-buffer-name multi-method method user host) (tramp-get-buffer multi-method method user host) - (tramp-get-su-program + (tramp-get-login-program multi-method (tramp-find-method multi-method method user host) user host) (mapcar (lambda (x) (format-spec x `((?u . ,(or user "root"))))) - (tramp-get-su-args + (tramp-get-login-args multi-method (tramp-find-method multi-method method user host) user host)))) @@ -4951,6 +4881,24 @@ nil." "]]")))) found)) +(defun tramp-wait-for-shell-prompt (proc timeout) + "Wait for the shell prompt to appear from process PROC within TIMEOUT seconds. +See `tramp-wait-for-regexp' for more details. +Shell prompt pattern is determined by variables `shell-prompt-pattern' +and `tramp-shell-prompt-pattern'." + (tramp-wait-for-regexp + proc timeout + (format "\\(%s\\|%s\\)\\'" + shell-prompt-pattern tramp-shell-prompt-pattern))) + +(defun tramp-barf-if-no-shell-prompt (proc timeout &rest error-args) + "Wait for shell prompt and barf if none appears. +Looks at process PROC to see if a shell prompt appears in TIMEOUT +seconds. If not, it produces an error message with the given ERROR-ARGS." + (unless (tramp-wait-for-shell-prompt proc timeout) + (pop-to-buffer (buffer-name)) + (apply 'error error-args))) + (defun tramp-enter-password (p prompt) "Prompt for a password and send it to the remote end. Uses PROMPT as a prompt and sends the password to process P." @@ -4994,55 +4942,31 @@ to set up. METHOD, USER and HOST specify the connection." ;; because that is read by some sh implementations (eg, bash when ;; called as sh) on startup; this way, we avoid the startup file ;; clobbering $PS1. - (process-send-string nil (format "exec env 'ENV=' 'PS1=$ ' %s%s" - (tramp-get-remote-sh - multi-method method user host) - tramp-rsh-end-of-line)) - (when tramp-debug-buffer - (save-excursion - (set-buffer (tramp-get-debug-buffer multi-method method user host)) - (goto-char (point-max)) - (tramp-insert-with-face - 'bold (format "$ exec env PS1='$ ' %s\n" - (tramp-get-remote-sh multi-method method user host))))) - (tramp-message 9 "Waiting 30s for remote `%s' to come up..." - (tramp-get-remote-sh multi-method method user host)) - (unless (tramp-wait-for-regexp - p 30 (format "\\(%s\\|%s\\)\\'" - shell-prompt-pattern tramp-shell-prompt-pattern)) - (pop-to-buffer (buffer-name)) - (error "Remote `%s' didn't come up. See buffer `%s' for details" - (tramp-get-remote-sh multi-method method user host) - (buffer-name))) - (tramp-message 9 "Setting up remote shell environment") + (tramp-send-command-internal + multi-method method user host + (format "exec env 'ENV=' 'PS1=$ ' %s" + (tramp-get-remote-sh multi-method method user host)) + (format "remote `%s' to come up" + (tramp-get-remote-sh multi-method method user host))) + (tramp-barf-if-no-shell-prompt + p 30 + "Remote `%s' didn't come up. See buffer `%s' for details" + (tramp-get-remote-sh multi-method method user host) + (buffer-name)) + (tramp-message 8 "Setting up remote shell environment") (tramp-discard-garbage-erase-buffer p multi-method method user host) - (process-send-string - nil (format "stty -inlcr -echo kill '^U'%s" tramp-rsh-end-of-line)) - (unless (tramp-wait-for-regexp - p 30 (format "\\(%s\\|%s\\)\\'" - shell-prompt-pattern tramp-shell-prompt-pattern)) - (pop-to-buffer (buffer-name)) - (error "Couldn't `stty -echo', see buffer `%s'" (buffer-name))) + (tramp-send-command-internal multi-method method user host + "stty -inlcr -echo kill '^U'") (erase-buffer) - (process-send-string nil (format "TERM=dumb; export TERM%s" - tramp-rsh-end-of-line)) - (unless (tramp-wait-for-regexp - p 30 (format "\\(%s\\|%s\\)\\'" - shell-prompt-pattern tramp-shell-prompt-pattern)) - (pop-to-buffer (buffer-name)) - (error "Couldn't `TERM=dumb; export TERM', see buffer `%s'" (buffer-name))) + (tramp-send-command-internal multi-method method user host + "TERM=dumb; export TERM") ;; Try to set up the coding system correctly. ;; CCC this can't be the right way to do it. Hm. (save-excursion (erase-buffer) (tramp-message 9 "Determining coding system") - (process-send-string nil (format "echo foo ; echo bar %s" - tramp-rsh-end-of-line)) - (unless (tramp-wait-for-regexp - p 30 (format "\\(%s\\|%s\\)\\'" - shell-prompt-pattern tramp-shell-prompt-pattern)) - (pop-to-buffer (buffer-name)) - (error "Couldn't `echo foo; echo bar' to determine line endings'")) + (tramp-send-command-internal multi-method method user host + "echo foo ; echo bar") (goto-char (point-min)) (if (featurep 'mule) ;; Use MULE to select the right EOL convention for communicating @@ -5066,57 +4990,26 @@ to set up. METHOD, USER and HOST specify the connection." ;; because we're running on a non-MULE Emacs. Let's try ;; stty, instead. (tramp-message 9 "Trying `stty -onlcr'") - (process-send-string nil (format "stty -onlcr%s" tramp-rsh-end-of-line)) - (unless (tramp-wait-for-regexp - p 30 (format "\\(%s\\|%s\\)\\'" - shell-prompt-pattern tramp-shell-prompt-pattern)) - (pop-to-buffer (buffer-name)) - (error "Couldn't `stty -onlcr', see buffer `%s'" (buffer-name)))))) + (tramp-send-command-internal multi-method method user host + "stty -onlcr")))) (erase-buffer) (tramp-message 9 "Waiting 30s for `HISTFILE=$HOME/.tramp_history; HISTSIZE=1'") - (process-send-string - nil (format "HISTFILE=$HOME/.tramp_history; HISTSIZE=1%s" - tramp-rsh-end-of-line)) - (unless (tramp-wait-for-regexp - p 30 (format "\\(%s\\|%s\\)\\'" - shell-prompt-pattern tramp-shell-prompt-pattern)) - (pop-to-buffer (buffer-name)) - (error (concat "Couldn't `HISTFILE=$HOME/.tramp_history; " - "HISTSIZE=1', see buffer `%s'") - (buffer-name))) + (tramp-send-command-internal multi-method method user host + "HISTFILE=$HOME/.tramp_history; HISTSIZE=1") (erase-buffer) (tramp-message 9 "Waiting 30s for `set +o vi +o emacs'") - (process-send-string - nil (format "set +o vi +o emacs%s" ;mustn't `>/dev/null' with AIX? - tramp-rsh-end-of-line)) - (unless (tramp-wait-for-regexp - p 30 (format "\\(%s\\|%s\\)\\'" - shell-prompt-pattern tramp-shell-prompt-pattern)) - (pop-to-buffer (buffer-name)) - (error "Couldn't `set +o vi +o emacs', see buffer `%s'" - (buffer-name))) + (tramp-send-command-internal multi-method method user host + "set +o vi +o emacs") (erase-buffer) (tramp-message 9 "Waiting 30s for `unset MAIL MAILCHECK MAILPATH'") - (process-send-string - nil (format "unset MAIL MAILCHECK MAILPATH 1>/dev/null 2>/dev/null%s" - tramp-rsh-end-of-line)) - (unless (tramp-wait-for-regexp - p 30 (format "\\(%s\\|%s\\)\\'" - shell-prompt-pattern tramp-shell-prompt-pattern)) - (pop-to-buffer (buffer-name)) - (error "Couldn't `unset MAIL MAILCHECK MAILPATH', see buffer `%s'" - (buffer-name))) + (tramp-send-command-internal + multi-method method user host + "unset MAIL MAILCHECK MAILPATH 1>/dev/null 2>/dev/null") (erase-buffer) (tramp-message 9 "Waiting 30s for `unset CDPATH'") - (process-send-string - nil (format "unset CDPATH%s" tramp-rsh-end-of-line)) - (unless (tramp-wait-for-regexp - p 30 (format "\\(%s\\|%s\\)\\'" - shell-prompt-pattern tramp-shell-prompt-pattern)) - (pop-to-buffer (buffer-name)) - (error "Couldn't `unset CDPATH', see buffer `%s'" - (buffer-name))) + (tramp-send-command-internal multi-method method user host + "unset CDPATH") (erase-buffer) (tramp-message 9 "Setting shell prompt") ;; Douglas Gray Stephens says that we must @@ -5240,7 +5133,7 @@ locale to C and sets up the remote shell search path." " -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n" "}")) (tramp-wait-for-output) - (unless (tramp-get-rcp-program + (unless (tramp-get-copy-program multi-method (tramp-find-method multi-method method user host) user host) @@ -5282,7 +5175,7 @@ locale to C and sets up the remote shell search path." (tramp-set-connection-property "ln" ln multi-method method user host))) (erase-buffer) ;; Find the right encoding/decoding commands to use. - (unless (tramp-get-rcp-program + (unless (tramp-get-copy-program multi-method (tramp-find-method multi-method method user host) user host) @@ -5527,6 +5420,17 @@ connection. This is meant to be used from (process-send-string proc (concat command tramp-rsh-end-of-line)))) +(defun tramp-send-command-internal + (multi-method method user host command &optional msg) + "Send command to remote host and wait for success. +Sends COMMAND, then waits 30 seconds for shell prompt." + (tramp-send-command multi-method method user host command t t) + (when msg + (tramp-message 9 "Waiting 30s for %s..." msg)) + (tramp-barf-if-no-shell-prompt + nil 30 + "Couldn't `%s', see buffer `%s'" command (buffer-name))) + (defun tramp-wait-for-output (&optional timeout) "Wait for output from remote rsh command." (let ((proc (get-buffer-process (current-buffer))) @@ -5964,8 +5868,8 @@ If both MULTI-METHOD and METHOD are nil, do a lookup in (incf i))) (concat prefix hops localname))) -(defun tramp-make-rcp-program-file-name (user host localname) - "Create a file name suitable to be passed to `rcp'." +(defun tramp-make-copy-program-file-name (user host localname) + "Create a file name suitable to be passed to `rcp' and workalikes." (if user (format "%s@%s:%s" user host localname) (format "%s:%s" host localname))) @@ -5973,8 +5877,8 @@ If both MULTI-METHOD and METHOD are nil, do a lookup in (defun tramp-method-out-of-band-p (multi-method method user host) "Return t if this is an out-of-band method, nil otherwise. It is important to check for this condition, since it is not possible -to enter a password for the `tramp-rcp-program'." - (tramp-get-rcp-program +to enter a password for the `tramp-copy-program'." + (tramp-get-copy-program multi-method (tramp-find-method multi-method method user host) user host)) @@ -6072,70 +5976,41 @@ If the value is not set for the connection, return `default'" (error "Method `%s' didn't specify a remote shell" (or multi-method method))))) -(defun tramp-get-rsh-program (multi-method method user host) - (second (or (assoc 'tramp-rsh-program +(defun tramp-get-login-program (multi-method method user host) + (second (or (assoc 'tramp-login-program (assoc (tramp-find-method multi-method method user host) tramp-methods)) - (error "Method `%s' didn't specify an rsh program" + (error "Method `%s' didn't specify a login program" (or multi-method method))))) -(defun tramp-get-rsh-args (multi-method method user host) - (second (or (assoc 'tramp-rsh-args +(defun tramp-get-login-args (multi-method method user host) + (second (or (assoc 'tramp-login-args (assoc (tramp-find-method multi-method method user host) tramp-methods)) - (error "Method `%s' didn't specify rsh args" + (error "Method `%s' didn't specify login args" (or multi-method method))))) -(defun tramp-get-rcp-program (multi-method method user host) - (second (or (assoc 'tramp-rcp-program +(defun tramp-get-copy-program (multi-method method user host) + (second (or (assoc 'tramp-copy-program (assoc (tramp-find-method multi-method method user host) tramp-methods)) - (error "Method `%s' didn't specify an rcp program" + (error "Method `%s' didn't specify a copy program" (or multi-method method))))) -(defun tramp-get-rcp-args (multi-method method user host) - (second (or (assoc 'tramp-rcp-args +(defun tramp-get-copy-args (multi-method method user host) + (second (or (assoc 'tramp-copy-args (assoc (tramp-find-method multi-method method user host) tramp-methods)) - (error "Method `%s' didn't specify rcp args" + (error "Method `%s' didn't specify copy args" (or multi-method method))))) -(defun tramp-get-rcp-keep-date-arg (multi-method method user host) - (second (or (assoc 'tramp-rcp-keep-date-arg +(defun tramp-get-copy-keep-date-arg (multi-method method user host) + (second (or (assoc 'tramp-copy-keep-date-arg (assoc (tramp-find-method multi-method method user host) tramp-methods)) (error "Method `%s' didn't specify `keep-date' arg for tramp" (or multi-method method))))) -(defun tramp-get-su-program (multi-method method user host) - (second (or (assoc 'tramp-su-program - (assoc (tramp-find-method multi-method method user host) - tramp-methods)) - (error "Method `%s' didn't specify a su program" - (or multi-method method))))) - -(defun tramp-get-su-args (multi-method method user host) - (second (or (assoc 'tramp-su-args - (assoc (tramp-find-method multi-method method user host) - tramp-methods)) - (error "Method `%s' didn't specify su args" - (or multi-method method))))) - -(defun tramp-get-telnet-program (multi-method method user host) - (second (or (assoc 'tramp-telnet-program - (assoc (tramp-find-method multi-method method user host) - tramp-methods)) - (error "Method `%s' didn't specify a telnet program" - (or multi-method method))))) - -(defun tramp-get-telnet-args (multi-method method user host) - (second (or (assoc 'tramp-telnet-args - (assoc (tramp-find-method multi-method method user host) - tramp-methods)) - (error "Method `%s' didn't specify telnet args" - (or multi-method method))))) - - ;; Auto saving to a special directory. (defun tramp-make-auto-save-file-name (fn) diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index 7a9f957cec4..b8175946c23 100644 --- a/lisp/net/trampver.el +++ b/lisp/net/trampver.el @@ -30,7 +30,7 @@ ;; are auto-frobbed from configure.ac, so you should edit that file and run ;; "autoconf && ./configure" to change them. -(defconst tramp-version "2.0.33" +(defconst tramp-version "2.0.34" "This version of Tramp.") (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" -- 2.39.2