Commit c951aecb authored by Kai Großjohann's avatar Kai Großjohann
Browse files

(tramp-chunksize): Extend docstring. Suggested by

Charles Curley <charlescurley@charlescurley.com>.
(tramp-multi-connection-function-alist): Add ssht entry which adds
"-e none -t -t" to the list of ssh args.  Suggested by Adrian
Aichner.
(tramp-get-method-parameter): New function to retrieve a method
parameter.  This allows for omission of method parameters.
Callers adjusted.
parent d344ecbb
2003-11-30 Kai Grossjohann <kai.grossjohann@gmx.net>
Version 2.0.38 of Tramp released.
* net/tramp.el (tramp-chunksize): Extend docstring. Suggested by
Charles Curley <charlescurley@charlescurley.com>.
(tramp-multi-connection-function-alist): Add ssht entry which adds
"-e none -t -t" to the list of ssh args. Suggested by Adrian
Aichner.
(tramp-get-method-parameter): New function to retrieve a method
parameter. This allows for omission of method parameters.
Callers adjusted.
2003-11-25 Michael Albinus <Michael.Albinus@alcatel.de>
* net/tramp.el: Add new optional parameter ID-FORMAT to
`file-attributes'. Calls of `file-attributes' won't use this
parameter for backward compatibility reasons.
(tramp-perl-file-attributes): Add a new parameter to Perl script
in order to handle uid/gid as strings, if desired.
(tramp-handle-file-truename, tramp-handle-file-symlink-p): Apply
`file-attributes' instead of `tramp-handle-file-attributes' in
order to make the function more general.
(tramp-handle-file-attributes): Replace proprietary optional
parameter NONNUMERIC by the recently (Emacs 21.4) introduced
ID-FORMAT.
(tramp-handle-file-attributes-with-perl): Handle parameter
NONNUMERIC if set. This wasn't done in the past.
(tramp-post-connection): Apply second parameter "$2" if
`tramp-remote-perl' is called.
* net/tramp-smb.el (tramp-smb-handle-delete-file): Correct
cut'n'waste error (`filename' instead of `directory').
(tramp-smb-handle-directory-files-and-attributes)
(tramp-smb-handle-file-attributes): Add recently (Emacs 21.4)
introduced parameter ID-FORMAT.
(tramp-smb-handle-make-directory-internal): Correct cut'n'waste
error (`directory' instead of `ldir').
* net/tramp-vc.el (tramp-handle-vc-user-login-name): Check if
`file-attributes' has a second parameter. If yes, apply it with
value "'integer". Otherwise, don't use that parameter (default is
integer format).
2003-11-30 Luc Teirlinck <teirllm@auburn.edu> 2003-11-30 Luc Teirlinck <teirllm@auburn.edu>
* help.el (help-map): Bind `display-local-help' to `C-h .'. * help.el (help-map): Bind `display-local-help' to `C-h .'.
......
...@@ -137,6 +137,8 @@ pass to the OPERATION." ...@@ -137,6 +137,8 @@ pass to the OPERATION."
;; pretended in `tramp-file-name-handler' otherwise. ;; pretended in `tramp-file-name-handler' otherwise.
;; Furthermore, there are no backup files on FTP hosts. ;; Furthermore, there are no backup files on FTP hosts.
;; Worth further investigations. ;; Worth further investigations.
;; * Map /multi:ssh:out@gate:ftp:kai@real.host:/path/to.file
;; on Ange-FTP gateways.
;;; arch-tag: 759fb338-5c63-4b99-bd36-b4d59db91cff ;;; arch-tag: 759fb338-5c63-4b99-bd36-b4d59db91cff
;;; tramp-ftp.el ends here ;;; tramp-ftp.el ends here
...@@ -290,7 +290,7 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server." ...@@ -290,7 +290,7 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server."
(tramp-smb-send-command user host (format "cd \\")) (tramp-smb-send-command user host (format "cd \\"))
;; Error ;; Error
(tramp-smb-send-command user host (format "cd \\")) (tramp-smb-send-command user host (format "cd \\"))
(error "Cannot delete file `%s'" directory)))))) (error "Cannot delete file `%s'" filename))))))
(defun tramp-smb-handle-directory-files (defun tramp-smb-handle-directory-files
(directory &optional full match nosort) (directory &optional full match nosort)
...@@ -324,18 +324,18 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server." ...@@ -324,18 +324,18 @@ KEEP-DATE is not handled in case NEWNAME resides on an SMB server."
entries)))) entries))))
(defun tramp-smb-handle-directory-files-and-attributes (defun tramp-smb-handle-directory-files-and-attributes
(directory &optional full match nosort) (directory &optional full match nosort id-format)
"Like `directory-files-and-attributes' for tramp files." "Like `directory-files-and-attributes' for tramp files."
(mapcar (mapcar
(lambda (x) (lambda (x)
(cons x (file-attributes ;; We cannot call `file-attributes' for backward compatibility reasons.
(if full x (concat (file-name-as-directory directory) x))))) ;; Its optional parameter ID-FORMAT is introduced with Emacs 21.4.
(cons x (tramp-smb-handle-file-attributes
(if full x (concat (file-name-as-directory directory) x)) id-format)))
(directory-files directory full match nosort))) (directory-files directory full match nosort)))
(defun tramp-smb-handle-file-attributes (filename &optional nonnumeric) (defun tramp-smb-handle-file-attributes (filename &optional id-format)
"Like `file-attributes' for tramp files. "Like `file-attributes' for tramp files."
Optional argument NONNUMERIC means return user and group name
rather than as numbers."
; (with-parsed-tramp-file-name filename nil ; (with-parsed-tramp-file-name filename nil
(let (user host localname) (let (user host localname)
(with-parsed-tramp-file-name filename l (with-parsed-tramp-file-name filename l
...@@ -346,6 +346,8 @@ rather than as numbers." ...@@ -346,6 +346,8 @@ rather than as numbers."
(entries (tramp-smb-get-file-entries user host share file)) (entries (tramp-smb-get-file-entries user host share file))
(entry (and entries (entry (and entries
(assoc (file-name-nondirectory file) entries))) (assoc (file-name-nondirectory file) entries)))
(uid (if (and id-format (equal id-format 'string)) "nobody" -1))
(gid (if (and id-format (equal id-format 'string)) "nogroup" -1))
(inode (tramp-smb-get-inode share file)) (inode (tramp-smb-get-inode share file))
(device (tramp-get-device nil tramp-smb-method user host))) (device (tramp-get-device nil tramp-smb-method user host)))
...@@ -354,8 +356,8 @@ rather than as numbers." ...@@ -354,8 +356,8 @@ rather than as numbers."
(list (and (string-match "d" (nth 1 entry)) (list (and (string-match "d" (nth 1 entry))
t) ;0 file type t) ;0 file type
-1 ;1 link count -1 ;1 link count
-1 ;2 uid uid ;2 uid
-1 ;3 gid gid ;3 gid
'(0 0) ;4 atime '(0 0) ;4 atime
(nth 3 entry) ;5 mtime (nth 3 entry) ;5 mtime
'(0 0) ;6 ctime '(0 0) ;6 ctime
...@@ -546,7 +548,7 @@ WILDCARD and FULL-DIRECTORY-P are not handled." ...@@ -546,7 +548,7 @@ WILDCARD and FULL-DIRECTORY-P are not handled."
"Like `make-directory-internal' for tramp files." "Like `make-directory-internal' for tramp files."
(setq directory (directory-file-name (expand-file-name directory))) (setq directory (directory-file-name (expand-file-name directory)))
(unless (file-name-absolute-p directory) (unless (file-name-absolute-p directory)
(setq ldir (concat default-directory directory))) (setq directory (concat default-directory directory)))
; (with-parsed-tramp-file-name directory nil ; (with-parsed-tramp-file-name directory nil
(let (user host localname) (let (user host localname)
(with-parsed-tramp-file-name directory l (with-parsed-tramp-file-name directory l
......
...@@ -391,8 +391,15 @@ filename we are thinking about..." ...@@ -391,8 +391,15 @@ filename we are thinking about..."
;; Pacify byte-compiler; this symbol is bound in the calling ;; Pacify byte-compiler; this symbol is bound in the calling
;; function. CCC: Maybe it would be better to move the ;; function. CCC: Maybe it would be better to move the
;; boundness-checking into this function? ;; boundness-checking into this function?
(let ((file (symbol-value 'file))) (let ((file (symbol-value 'file))
(if (and uid (/= uid (nth 2 (file-attributes file)))) (remote-uid
;; With Emacs 21.4, `file-attributes' has got an optional parameter
;; ID-FORMAT. Handle this case backwards compatible.
(if (and (functionp 'subr-arity)
(= 2 (cdr (subr-arity (symbol-function 'file-attributes)))))
(nth 2 (file-attributes file 'integer))
(nth 2 (file-attributes file)))))
(if (and uid (/= uid remote-uid))
(error "tramp-handle-vc-user-login-name cannot map a uid to a name") (error "tramp-handle-vc-user-login-name cannot map a uid to a name")
(let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file))) (let* ((v (tramp-dissect-file-name (tramp-handle-expand-file-name file)))
(u (tramp-file-name-user v))) (u (tramp-file-name-user v)))
......
...@@ -569,6 +569,7 @@ variable `tramp-methods'." ...@@ -569,6 +569,7 @@ variable `tramp-methods'."
("rsh" tramp-multi-connect-rlogin "rsh %h -l %u%n") ("rsh" tramp-multi-connect-rlogin "rsh %h -l %u%n")
("remsh" tramp-multi-connect-rlogin "remsh %h -l %u%n") ("remsh" tramp-multi-connect-rlogin "remsh %h -l %u%n")
("ssh" tramp-multi-connect-rlogin "ssh %h -l %u%n") ("ssh" tramp-multi-connect-rlogin "ssh %h -l %u%n")
("ssht" tramp-multi-connect-rlogin "ssh %h -e none -t -t -l %u%n")
("su" tramp-multi-connect-su "su - %u%n") ("su" tramp-multi-connect-su "su - %u%n")
("sudo" tramp-multi-connect-su "sudo -u %u -s -p Password:%n")) ("sudo" tramp-multi-connect-su "sudo -u %u -s -p Password:%n"))
"*List of connection functions for multi-hop methods. "*List of connection functions for multi-hop methods.
...@@ -1250,6 +1251,17 @@ checked via the following code: ...@@ -1250,6 +1251,17 @@ checked via the following code:
(re-search-forward \"\\\\w+\") (re-search-forward \"\\\\w+\")
(message \"Bytes sent: %s\\tBytes received: %s\" bytes (match-string 0)))) (message \"Bytes sent: %s\\tBytes received: %s\" bytes (match-string 0))))
In the Emacs normally running Tramp, evaluate the above code.
You can do this, for example, by pasting it into the `*scratch*'
buffer and then hitting C-j with the cursor after the last
closing parenthesis.
If your Emacs is buggy, the sent and received numbers will be
different. In that case, you'll want to set this variable to
some number. For those people who have needed it, the value 500
seems to have worked well. There is no way to predict what value
you need; maybe you could just experiment a bit.
Please raise a bug report via \"M-x tramp-bug\" if your system needs Please raise a bug report via \"M-x tramp-bug\" if your system needs
this variable to be set as well." this variable to be set as well."
:group 'tramp :group 'tramp
...@@ -1405,13 +1417,15 @@ some systems don't, and for them we have this shell function.") ...@@ -1405,13 +1417,15 @@ some systems don't, and for them we have this shell function.")
;; The device number is returned as "-1", because there will be a virtual ;; The device number is returned as "-1", because there will be a virtual
;; device number set in `tramp-handle-file-attributes' ;; device number set in `tramp-handle-file-attributes'
(defconst tramp-perl-file-attributes "\ (defconst tramp-perl-file-attributes "\
$f = $ARGV[0]; ($f, $n) = @ARGV;
@s = lstat($f); @s = lstat($f);
if (($s[2] & 0170000) == 0120000) { $l = readlink($f); $l = \"\\\"$l\\\"\"; } if (($s[2] & 0170000) == 0120000) { $l = readlink($f); $l = \"\\\"$l\\\"\"; }
elsif (($s[2] & 0170000) == 040000) { $l = \"t\"; } elsif (($s[2] & 0170000) == 040000) { $l = \"t\"; }
else { $l = \"nil\" }; else { $l = \"nil\" };
printf(\"(%s %u %d %d (%u %u) (%u %u) (%u %u) %u %u t (%u . %u) -1)\\n\", $u = ($n eq \"nil\") ? $s[4] : getpwuid($s[4]);
$l, $s[3], $s[4], $s[5], $s[8] >> 16 & 0xffff, $s[8] & 0xffff, $g = ($n eq \"nil\") ? $s[5] : getgrgid($s[5]);
printf(\"(%s %u %s %s (%u %u) (%u %u) (%u %u) %u %u t (%u . %u) -1)\\n\",
$l, $s[3], $u, $g, $s[8] >> 16 & 0xffff, $s[8] & 0xffff,
$s[9] >> 16 & 0xffff, $s[9] & 0xffff, $s[10] >> 16 & 0xffff, $s[10] & 0xffff, $s[9] >> 16 & 0xffff, $s[9] & 0xffff, $s[10] >> 16 & 0xffff, $s[10] & 0xffff,
$s[7], $s[2], $s[1] >> 16 & 0xffff, $s[1] & 0xffff);" $s[7], $s[2], $s[1] >> 16 & 0xffff, $s[1] & 0xffff);"
"Perl script to produce output suitable for use with `file-attributes' "Perl script to produce output suitable for use with `file-attributes'
...@@ -1900,7 +1914,7 @@ target of the symlink differ." ...@@ -1900,7 +1914,7 @@ target of the symlink differ."
(append '("") (reverse result) (list thisstep)) (append '("") (reverse result) (list thisstep))
"/")) "/"))
(setq symlink-target (setq symlink-target
(nth 0 (tramp-handle-file-attributes (nth 0 (file-attributes
(tramp-make-tramp-file-name (tramp-make-tramp-file-name
multi-method method user host multi-method method user host
(mapconcat 'identity (mapconcat 'identity
...@@ -1979,11 +1993,10 @@ target of the symlink differ." ...@@ -1979,11 +1993,10 @@ target of the symlink differ."
;; CCC: This should check for an error condition and signal failure ;; CCC: This should check for an error condition and signal failure
;; when something goes wrong. ;; when something goes wrong.
;; Daniel Pittman <daniel@danann.net> ;; Daniel Pittman <daniel@danann.net>
(defun tramp-handle-file-attributes (filename &optional nonnumeric) (defun tramp-handle-file-attributes (filename &optional id-format)
"Like `file-attributes' for tramp files. "Like `file-attributes' for tramp files."
Optional argument NONNUMERIC means return user and group name (let ((nonnumeric (and id-format (equal id-format 'string)))
rather than as numbers." result)
(let (result)
(with-parsed-tramp-file-name filename nil (with-parsed-tramp-file-name filename nil
(when (tramp-handle-file-exists-p filename) (when (tramp-handle-file-exists-p filename)
;; file exists, find out stuff ;; file exists, find out stuff
...@@ -2097,8 +2110,8 @@ is initially created and is kept cached by the remote shell." ...@@ -2097,8 +2110,8 @@ is initially created and is kept cached by the remote shell."
multi-method method user host localname)) multi-method method user host localname))
(tramp-send-command (tramp-send-command
multi-method method user host multi-method method user host
(format "tramp_file_attributes %s" (format "tramp_file_attributes %s %s"
(tramp-shell-quote-argument localname))) (tramp-shell-quote-argument localname) nonnumeric))
(tramp-wait-for-output) (tramp-wait-for-output)
(let ((result (read (current-buffer)))) (let ((result (read (current-buffer))))
(setcar (nthcdr 8 result) (setcar (nthcdr 8 result)
...@@ -2310,7 +2323,7 @@ if the remote host can't provide the modtime." ...@@ -2310,7 +2323,7 @@ if the remote host can't provide the modtime."
(defun tramp-handle-file-symlink-p (filename) (defun tramp-handle-file-symlink-p (filename)
"Like `file-symlink-p' for tramp files." "Like `file-symlink-p' for tramp files."
(with-parsed-tramp-file-name filename nil (with-parsed-tramp-file-name filename nil
(let ((x (car (tramp-handle-file-attributes filename)))) (let ((x (car (file-attributes filename))))
(when (stringp x) (when (stringp x)
;; When Tramp is running on VMS, then `file-name-absolute-p' ;; When Tramp is running on VMS, then `file-name-absolute-p'
;; might do weird things. ;; might do weird things.
...@@ -3030,14 +3043,14 @@ This will break if COMMAND prints a newline, followed by the value of ...@@ -3030,14 +3043,14 @@ This will break if COMMAND prints a newline, followed by the value of
(with-parsed-tramp-file-name filename nil (with-parsed-tramp-file-name filename nil
(let ((output-buf (get-buffer-create "*tramp output*")) (let ((output-buf (get-buffer-create "*tramp output*"))
(tramp-buf (tramp-get-buffer multi-method method user host)) (tramp-buf (tramp-get-buffer multi-method method user host))
(copy-program (tramp-get-copy-program (copy-program (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host)) user host 'tramp-copy-program))
(copy-args (tramp-get-copy-args (copy-args (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host)) user host 'tramp-copy-args))
;; We used to bind the following as late as possible. ;; We used to bind the following as late as possible.
;; loc-enc and loc-dec were bound directly before the if ;; loc-enc and loc-dec were bound directly before the if
;; statement that checks them. But the functions ;; statement that checks them. But the functions
...@@ -3212,14 +3225,14 @@ This will break if COMMAND prints a newline, followed by the value of ...@@ -3212,14 +3225,14 @@ This will break if COMMAND prints a newline, followed by the value of
(error "File not overwritten"))) (error "File not overwritten")))
(with-parsed-tramp-file-name filename nil (with-parsed-tramp-file-name filename nil
(let ((curbuf (current-buffer)) (let ((curbuf (current-buffer))
(copy-program (tramp-get-copy-program (copy-program (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host)) user host 'tramp-copy-program))
(copy-args (tramp-get-copy-args (copy-args (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host)) user host 'tramp-copy-args))
(rem-enc (tramp-get-remote-encoding multi-method method user host)) (rem-enc (tramp-get-remote-encoding multi-method method user host))
(rem-dec (tramp-get-remote-decoding multi-method method user host)) (rem-dec (tramp-get-remote-decoding multi-method method user host))
(loc-enc (tramp-get-local-encoding multi-method method user host)) (loc-enc (tramp-get-local-encoding multi-method method user host))
...@@ -4402,7 +4415,8 @@ file exists and nonzero exit status otherwise." ...@@ -4402,7 +4415,8 @@ file exists and nonzero exit status otherwise."
9 "Setting remote shell prompt...done") 9 "Setting remote shell prompt...done")
) )
(t (tramp-message 5 "Remote `%s' groks tilde expansion, good" (t (tramp-message 5 "Remote `%s' groks tilde expansion, good"
(tramp-get-remote-sh multi-method method user host)))))) (tramp-get-method-parameter
multi-method method user host 'tramp-remote-sh))))))
(defun tramp-check-ls-command (multi-method method user host cmd) (defun tramp-check-ls-command (multi-method method user host cmd)
"Checks whether the given `ls' executable groks `-n'. "Checks whether the given `ls' executable groks `-n'.
...@@ -4686,15 +4700,15 @@ Maybe the different regular expressions need to be tuned. ...@@ -4686,15 +4700,15 @@ Maybe the different regular expressions need to be tuned.
(p (apply 'start-process (p (apply 'start-process
(tramp-buffer-name multi-method method user host) (tramp-buffer-name multi-method method user host)
(tramp-get-buffer multi-method method user host) (tramp-get-buffer multi-method method user host)
(tramp-get-login-program (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host) user host 'tramp-login-program)
host host
(tramp-get-login-args (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host))) user host 'tramp-login-args)))
(found nil) (found nil)
(pw nil)) (pw nil))
(process-kill-without-query p) (process-kill-without-query p)
...@@ -4743,14 +4757,14 @@ arguments, and xx will be used as the host name to connect to. ...@@ -4743,14 +4757,14 @@ arguments, and xx will be used as the host name to connect to.
(let ((process-environment (copy-sequence process-environment)) (let ((process-environment (copy-sequence process-environment))
(bufnam (tramp-buffer-name multi-method method user host)) (bufnam (tramp-buffer-name multi-method method user host))
(buf (tramp-get-buffer multi-method method user host)) (buf (tramp-get-buffer multi-method method user host))
(login-program (tramp-get-login-program (login-program (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host)) user host 'tramp-login-program))
(login-args (tramp-get-login-args (login-args (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host))) user host 'tramp-login-args)))
;; The following should be changed. We need a more general ;; The following should be changed. We need a more general
;; mechanism to parse extra host args. ;; mechanism to parse extra host args.
(when (string-match "\\([^#]*\\)#\\(.*\\)" host) (when (string-match "\\([^#]*\\)#\\(.*\\)" host)
...@@ -4818,17 +4832,17 @@ prompt than you do, so it is not at all unlikely that the variable ...@@ -4818,17 +4832,17 @@ prompt than you do, so it is not at all unlikely that the variable
(p (apply 'start-process (p (apply 'start-process
(tramp-buffer-name multi-method method user host) (tramp-buffer-name multi-method method user host)
(tramp-get-buffer multi-method method user host) (tramp-get-buffer multi-method method user host)
(tramp-get-login-program (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host) user host 'tramp-login-program)
(mapcar (mapcar
(lambda (x) (lambda (x)
(format-spec x `((?u . ,(or user "root"))))) (format-spec x `((?u . ,(or user "root")))))
(tramp-get-login-args (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host)))) user host 'tramp-login-args))))
(found nil) (found nil)
(pw nil)) (pw nil))
(process-kill-without-query p) (process-kill-without-query p)
...@@ -5054,11 +5068,13 @@ Uses PROMPT as a prompt and sends the password to process P." ...@@ -5054,11 +5068,13 @@ Uses PROMPT as a prompt and sends the password to process P."
(erase-buffer) (erase-buffer)
(process-send-string (process-send-string
p (concat pw p (concat pw
(tramp-get-password-end-of-line (or (tramp-get-method-parameter
tramp-current-multi-method tramp-current-multi-method
tramp-current-method tramp-current-method
tramp-current-user tramp-current-user
tramp-current-host))))) tramp-current-host
'tramp-password-end-of-line)
tramp-default-password-end-of-line)))))
;; HHH: Not Changed. This might handle the case where USER is not ;; HHH: Not Changed. This might handle the case where USER is not
;; given in the "File name" very poorly. Then, the local ;; given in the "File name" very poorly. Then, the local
...@@ -5101,13 +5117,15 @@ to set up. METHOD, USER and HOST specify the connection." ...@@ -5101,13 +5117,15 @@ to set up. METHOD, USER and HOST specify the connection."
(tramp-send-command-internal (tramp-send-command-internal
multi-method method user host multi-method method user host
(format "exec env 'ENV=' 'PS1=$ ' %s" (format "exec env 'ENV=' 'PS1=$ ' %s"
(tramp-get-remote-sh multi-method method user host)) (tramp-get-method-parameter
multi-method method user host 'tramp-remote-sh))
(format "remote `%s' to come up" (format "remote `%s' to come up"
(tramp-get-remote-sh multi-method method user host))) (tramp-get-method-parameter
multi-method method user host 'tramp-remote-sh)))
(tramp-barf-if-no-shell-prompt (tramp-barf-if-no-shell-prompt
p 30 p 30
"Remote `%s' didn't come up. See buffer `%s' for details" "Remote `%s' didn't come up. See buffer `%s' for details"
(tramp-get-remote-sh multi-method method user host) (tramp-get-method-parameter multi-method method user host 'tramp-remote-sh)
(buffer-name)) (buffer-name))
(tramp-message 8 "Setting up remote shell environment") (tramp-message 8 "Setting up remote shell environment")
(tramp-discard-garbage-erase-buffer p multi-method method user host) (tramp-discard-garbage-erase-buffer p multi-method method user host)
...@@ -5287,13 +5305,13 @@ locale to C and sets up the remote shell search path." ...@@ -5287,13 +5305,13 @@ locale to C and sets up the remote shell search path."
multi-method method user host multi-method method user host
(concat "tramp_file_attributes () {\n" (concat "tramp_file_attributes () {\n"
tramp-remote-perl tramp-remote-perl
" -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n" " -e '" tramp-perl-file-attributes "' $1 $2 2>/dev/null\n"
"}")) "}"))
(tramp-wait-for-output) (tramp-wait-for-output)
(unless (tramp-get-copy-program (unless (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host) user host 'tramp-copy-program)
(tramp-message 5 "Sending the Perl `mime-encode' implementations.") (tramp-message 5 "Sending the Perl `mime-encode' implementations.")
(tramp-send-string (tramp-send-string
multi-method method user host multi-method method user host
...@@ -5332,10 +5350,10 @@ locale to C and sets up the remote shell search path." ...@@ -5332,10 +5350,10 @@ locale to C and sets up the remote shell search path."
(tramp-set-connection-property "ln" ln multi-method method user host))) (tramp-set-connection-property "ln" ln multi-method method user host)))
(erase-buffer) (erase-buffer)
;; Find the right encoding/decoding commands to use. ;; Find the right encoding/decoding commands to use.
(unless (tramp-get-copy-program (unless (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host) user host 'tramp-copy-program)
(tramp-find-inline-encoding multi-method method user host)) (tramp-find-inline-encoding multi-method method user host))
;; If encoding/decoding command are given, test to see if they work. ;; If encoding/decoding command are given, test to see if they work.
;; CCC: Maybe it would be useful to run the encoder both locally and ;; CCC: Maybe it would be useful to run the encoder both locally and
...@@ -5548,10 +5566,10 @@ connection if a previous connection has died for some reason." ...@@ -5548,10 +5566,10 @@ connection if a previous connection has died for some reason."
(unless (and p (processp p) (memq (process-status p) '(run open))) (unless (and p (processp p) (memq (process-status p) '(run open)))
(when (and p (processp p)) (when (and p (processp p))
(delete-process p)) (delete-process p))
(funcall (tramp-get-connection-function (funcall (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host) user host 'tramp-connection-function)
multi-method method user host)))) multi-method method user host))))
(defun tramp-send-command (defun tramp-send-command
...@@ -6035,10 +6053,10 @@ If both MULTI-METHOD and METHOD are nil, do a lookup in ...@@ -6035,10 +6053,10 @@ If both MULTI-METHOD and METHOD are nil, do a lookup in
"Return t if this is an out-of-band method, nil otherwise. "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 It is important to check for this condition, since it is not possible
to enter a password for the `tramp-copy-program'." to enter a password for the `tramp-copy-program'."
(tramp-get-copy-program (tramp-get-method-parameter
multi-method multi-method
(tramp-find-method multi-method method user host) (tramp-find-method multi-method method user host)
user host)) user host 'tramp-copy-program))
;; Variables local to connection. ;; Variables local to connection.
...@@ -6117,65 +6135,19 @@ If the value is not set for the connection, return `default'" ...@@ -6117,65 +6135,19 @@ If the value is not set for the connection, return `default'"
(tramp-get-connection-property "local-decoding" nil (tramp-get-connection-property "local-decoding" nil
multi-method method user host)) multi-method method user host))
(defun tramp-get-method-parameter (multi-method method user host param)
"Return the method parameter PARAM.
(defun tramp-get-connection-function (multi-method method user host) If the `tramp-methods' entry does not exist, use the variable PARAM
(second (or (assoc 'tramp-connection-function as default."
(assoc (tramp-find-method multi-method method user host) (unless (boundp param)
tramp-methods)) (error "Non-existing method parameter `%s'" param))
(error "Method `%s' didn't specify a connection function" (let ((entry (assoc param
(or multi-method method)))))
(defun tramp-get-remote-sh (multi-method method user host)
(second (or (assoc 'tramp-remote-sh
(assoc (tramp-find-method multi-method method user host)
tramp-methods))
(error "Method `%s' didn't specify a remote shell"
(or multi-method method)))))
(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 a login program"
(or multi-method method)))))
(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 login args"
(or multi-method method)))))
(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 a copy program"
(or multi-method method)))))
(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 copy args"
(or multi-method method)))))
(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-password-end-of-line (multi-method method user host)
(let ((entry (assoc 'tramp-password-end-of-line
(assoc (tramp-find-method multi-method method user host) (assoc (tramp-find-method multi-method method user host)
tramp-methods)))) tramp-methods))))
(unless entry (if entry
(error "Method `%s' didn't specify `password-end-of-line' arg for tramp" (second entry)
(or multi-method method)))