aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMichael Albinus2015-07-21 14:59:18 +0200
committerMichael Albinus2015-07-21 14:59:18 +0200
commitb0dbf4c038d53ccce6ecf592c6d5b1ffcc084ad0 (patch)
tree91b0521e809dee52fbc509feb1a4b59dd5679a84 /lisp
parentb6ac30ab435596f1be6023ad22471bf570a11c4a (diff)
downloademacs-b0dbf4c038d53ccce6ecf592c6d5b1ffcc084ad0.tar.gz
emacs-b0dbf4c038d53ccce6ecf592c6d5b1ffcc084ad0.zip
Sync with Tramp repository
* doc/misc/tramp.texi (Configuration): Note, that Tramp must be required prior changing its configuration. (Connection caching, Predefined connection information) (Remote shell setup): Fix typos. (Predefined connection information): Describe, how to overwrite parameters of `tramp-methods'. (Remote programs, Remote processes, Traces and Profiles): Simplify example. (Remote programs): Remove superfluous comment. * doc/misc/trampver.texi: Update release number. * lisp/net/tramp-cache.el (tramp-connection-properties): Adapt docstring. * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file): New defun. (tramp-gvfs-handle-copy-file, tramp-gvfs-handle-rename-file): Use it. (tramp-gvfs-handle-make-directory): Reimplement PARENTS handling, "gvfs-mkdir -p ..." does not work robust. (tramp-gvfs-maybe-open-connection): Adapt `tramp-get-method-parameter' call. * lisp/net/tramp-sh.el (tramp-methods): Add `tramp-remote-shell-login' parameter where it fits. (tramp-get-remote-path): Use it. (tramp-make-copy-program-file-name): Fix quoting for "psftp" method. (all): Adapt `tramp-get-method-parameter' calls. * lisp/net/tramp.el (tramp-methods): Adapt docstring. (tramp-get-method-parameter): Replace argument METHOD by VEC. Check also for hits in `tramp-connection-properties'. Adapt docstring. (tramp-get-remote-tmpdir): Cache only the local name of tmpdir. (all): Adapt `tramp-get-method-parameter' calls. * lisp/net/trampver.el Update release number. * test/automated/tramp-tests.el (tramp--instrument-test-case): Add "^make-symbolic-link not supported$" to `debug-ignored-errors'. (tramp-test13-make-directory, tramp--test-adb-p) (tramp--test-smb-or-windows-nt-p): Simplify. (tramp--test-ftp-p, tramp--test-gvfs-p): New defuns. (tramp--test-special-characters): Fix docstring. Add gvfs and ftp tests. (tramp--test-utf8): Fix docstring.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/net/tramp-cache.el3
-rw-r--r--lisp/net/tramp-gvfs.el244
-rw-r--r--lisp/net/tramp-sh.el116
-rw-r--r--lisp/net/tramp.el64
-rw-r--r--lisp/net/trampver.el4
5 files changed, 238 insertions, 193 deletions
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index f2ee49ff6be..279d9f45c95 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -66,7 +66,8 @@
66Every entry has the form (REGEXP PROPERTY VALUE). The regexp 66Every entry has the form (REGEXP PROPERTY VALUE). The regexp
67matches remote file names. It can be nil. PROPERTY is a string, 67matches remote file names. It can be nil. PROPERTY is a string,
68and VALUE the corresponding value. They are used, if there is no 68and VALUE the corresponding value. They are used, if there is no
69matching entry for PROPERTY in `tramp-cache-data'." 69matching entry for PROPERTY in `tramp-cache-data'. For more
70details see the info pages."
70 :group 'tramp 71 :group 'tramp
71 :version "24.4" 72 :version "24.4"
72 :type '(repeat (list (choice :tag "File Name regexp" regexp (const nil)) 73 :type '(repeat (list (choice :tag "File Name regexp" regexp (const nil))
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 215e39d04c3..4dfdcd76e66 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -582,62 +582,127 @@ is no information where to trace the message.")
582 582
583;; File name primitives. 583;; File name primitives.
584 584
585(defun tramp-gvfs-do-copy-or-rename-file
586 (op filename newname &optional ok-if-already-exists keep-date
587 preserve-uid-gid preserve-extended-attributes)
588 "Copy or rename a remote file.
589OP must be `copy' or `rename' and indicates the operation to perform.
590FILENAME specifies the file to copy or rename, NEWNAME is the name of
591the new file (for copy) or the new name of the file (for rename).
592OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already.
593KEEP-DATE means to make sure that NEWNAME has the same timestamp
594as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep
595the uid and gid if both files are on the same host.
596PRESERVE-EXTENDED-ATTRIBUTES is ignored.
597
598This function is invoked by `tramp-gvfs-handle-copy-file' and
599`tramp-gvfs-handle-rename-file'. It is an error if OP is neither
600of `copy' and `rename'. FILENAME and NEWNAME must be absolute
601file names."
602 (unless (memq op '(copy rename))
603 (error "Unknown operation `%s', must be `copy' or `rename'" op))
604
605 (let ((t1 (tramp-tramp-file-p filename))
606 (t2 (tramp-tramp-file-p newname))
607 (equal-remote (tramp-equal-remote filename newname))
608 (file-operation (intern (format "%s-file" op)))
609 (gvfs-operation (if (eq op 'copy) "gvfs-copy" "gvfs-move"))
610 (msg-operation (if (eq op 'copy) "Copying" "Renaming")))
611
612 (with-parsed-tramp-file-name (if t1 filename newname) nil
613 (when (and (not ok-if-already-exists) (file-exists-p newname))
614 (tramp-error
615 v 'file-already-exists "File %s already exists" newname))
616
617 (if (or (and equal-remote
618 (tramp-get-connection-property v "direct-copy-failed" nil))
619 (and t1 (not (tramp-gvfs-file-name-p filename)))
620 (and t2 (not (tramp-gvfs-file-name-p newname))))
621
622 ;; We cannot copy or rename directly.
623 (let ((tmpfile (tramp-compat-make-temp-file filename)))
624 (cond
625 (preserve-extended-attributes
626 (tramp-compat-funcall
627 file-operation
628 filename tmpfile t keep-date preserve-uid-gid
629 preserve-extended-attributes))
630 (preserve-uid-gid
631 (tramp-compat-funcall
632 file-operation filename tmpfile t keep-date preserve-uid-gid))
633 (t
634 (tramp-compat-funcall
635 file-operation filename tmpfile t keep-date)))
636 (rename-file tmpfile newname ok-if-already-exists))
637
638 ;; Direct action.
639 (with-tramp-progress-reporter
640 v 0 (format "%s %s to %s" msg-operation filename newname)
641 (unless
642 (apply
643 'tramp-gvfs-send-command v gvfs-operation
644 (append
645 (and (eq op 'copy) (or keep-date preserve-uid-gid)
646 (list "--preserve"))
647 (list
648 (tramp-gvfs-url-file-name filename)
649 (tramp-gvfs-url-file-name newname))))
650
651 (if (or (not equal-remote)
652 (and equal-remote
653 (tramp-get-connection-property
654 v "direct-copy-failed" nil)))
655 ;; Propagate the error.
656 (with-current-buffer (tramp-get-connection-buffer v)
657 (goto-char (point-min))
658 (tramp-error-with-buffer
659 nil v 'file-error
660 "%s failed, see buffer `%s' for details."
661 msg-operation (buffer-name)))
662
663 ;; Some WebDAV server, like the one from QNAP, do not
664 ;; support direct copy/move. Try a fallback.
665 (tramp-set-connection-property v "direct-copy-failed" t)
666 (tramp-gvfs-do-copy-or-rename-file
667 op filename newname ok-if-already-exists keep-date
668 preserve-uid-gid preserve-extended-attributes))))
669
670 (when (and t1 (eq op 'rename))
671 (with-parsed-tramp-file-name filename nil
672 (tramp-flush-file-property v (file-name-directory localname))
673 (tramp-flush-file-property v localname)))
674
675 (when t2
676 (with-parsed-tramp-file-name newname nil
677 (tramp-flush-file-property v (file-name-directory localname))
678 (tramp-flush-file-property v localname)))))))
679
585(defun tramp-gvfs-handle-copy-file 680(defun tramp-gvfs-handle-copy-file
586 (filename newname &optional ok-if-already-exists keep-date 681 (filename newname &optional ok-if-already-exists keep-date
587 preserve-uid-gid preserve-extended-attributes) 682 preserve-uid-gid preserve-extended-attributes)
588 "Like `copy-file' for Tramp files." 683 "Like `copy-file' for Tramp files."
589 (with-parsed-tramp-file-name 684 (setq filename (expand-file-name filename))
590 (if (tramp-tramp-file-p filename) filename newname) nil 685 (setq newname (expand-file-name newname))
591 686 (cond
592 (when (and (not ok-if-already-exists) (file-exists-p newname)) 687 ;; At least one file a Tramp file?
593 (tramp-error 688 ((or (tramp-tramp-file-p filename)
594 v 'file-already-exists "File %s already exists" newname)) 689 (tramp-tramp-file-p newname))
595 690 (tramp-gvfs-do-copy-or-rename-file
596 (if (or (and (tramp-tramp-file-p filename) 691 'copy filename newname ok-if-already-exists keep-date
597 (not (tramp-gvfs-file-name-p filename))) 692 preserve-uid-gid preserve-extended-attributes))
598 (and (tramp-tramp-file-p newname) 693 ;; Compat section.
599 (not (tramp-gvfs-file-name-p newname)))) 694 (preserve-extended-attributes
600 695 (tramp-run-real-handler
601 ;; We cannot call `copy-file' directly. Use 696 'copy-file
602 ;; `tramp-compat-funcall' for backward compatibility (number 697 (list filename newname ok-if-already-exists keep-date
603 ;; of arguments). 698 preserve-uid-gid preserve-extended-attributes)))
604 (let ((tmpfile (tramp-compat-make-temp-file filename))) 699 (preserve-uid-gid
605 (cond 700 (tramp-run-real-handler
606 (preserve-extended-attributes 701 'copy-file
607 (tramp-compat-funcall 702 (list filename newname ok-if-already-exists keep-date preserve-uid-gid)))
608 'copy-file 703 (t
609 filename tmpfile t keep-date preserve-uid-gid 704 (tramp-run-real-handler
610 preserve-extended-attributes)) 705 'copy-file (list filename newname ok-if-already-exists keep-date)))))
611 (preserve-uid-gid
612 (tramp-compat-funcall
613 'copy-file filename tmpfile t keep-date preserve-uid-gid))
614 (t
615 (copy-file filename tmpfile t keep-date)))
616 (rename-file tmpfile newname ok-if-already-exists))
617
618 ;; Direct copy.
619 (with-tramp-progress-reporter
620 v 0 (format "Copying %s to %s" filename newname)
621 (unless
622 (let ((args
623 (append (if (or keep-date preserve-uid-gid)
624 (list "--preserve")
625 nil)
626 (list
627 (tramp-gvfs-url-file-name filename)
628 (tramp-gvfs-url-file-name newname)))))
629 (apply 'tramp-gvfs-send-command v "gvfs-copy" args))
630 ;; Propagate the error.
631 (with-current-buffer (tramp-get-connection-buffer v)
632 (goto-char (point-min))
633 (tramp-error-with-buffer
634 nil v 'file-error
635 "Copying failed, see buffer `%s' for details." (buffer-name)))))
636
637 (when (tramp-tramp-file-p newname)
638 (with-parsed-tramp-file-name newname nil
639 (tramp-flush-file-property v (file-name-directory localname))
640 (tramp-flush-file-property v localname))))))
641 706
642(defun tramp-gvfs-handle-delete-directory (directory &optional recursive trash) 707(defun tramp-gvfs-handle-delete-directory (directory &optional recursive trash)
643 "Like `delete-directory' for Tramp files." 708 "Like `delete-directory' for Tramp files."
@@ -1016,60 +1081,35 @@ is no information where to trace the message.")
1016 1081
1017(defun tramp-gvfs-handle-make-directory (dir &optional parents) 1082(defun tramp-gvfs-handle-make-directory (dir &optional parents)
1018 "Like `make-directory' for Tramp files." 1083 "Like `make-directory' for Tramp files."
1084 (setq dir (directory-file-name (expand-file-name dir)))
1019 (with-parsed-tramp-file-name dir nil 1085 (with-parsed-tramp-file-name dir nil
1020 (unless 1086 (tramp-flush-file-property v (file-name-directory localname))
1021 (apply 1087 (tramp-flush-directory-property v localname)
1022 'tramp-gvfs-send-command v "gvfs-mkdir" 1088 (save-match-data
1023 (if parents 1089 (let ((ldir (file-name-directory dir)))
1024 (list "-p" (tramp-gvfs-url-file-name dir)) 1090 ;; Make missing directory parts. "gvfs-mkdir -p ..." does not
1025 (list (tramp-gvfs-url-file-name dir)))) 1091 ;; work robust.
1026 ;; Propagate the error. 1092 (when (and parents (not (file-directory-p ldir)))
1027 (tramp-error v 'file-error "Couldn't make directory %s" dir)))) 1093 (make-directory ldir parents))
1094 ;; Just do it.
1095 (unless (tramp-gvfs-send-command
1096 v "gvfs-mkdir" (tramp-gvfs-url-file-name dir))
1097 (tramp-error v 'file-error "Couldn't make directory %s" dir))))))
1028 1098
1029(defun tramp-gvfs-handle-rename-file 1099(defun tramp-gvfs-handle-rename-file
1030 (filename newname &optional ok-if-already-exists) 1100 (filename newname &optional ok-if-already-exists)
1031 "Like `rename-file' for Tramp files." 1101 "Like `rename-file' for Tramp files."
1032 (with-parsed-tramp-file-name 1102 ;; Check if both files are local -- invoke normal rename-file.
1033 (if (tramp-tramp-file-p filename) filename newname) nil 1103 ;; Otherwise, use Tramp from local system.
1034 1104 (setq filename (expand-file-name filename))
1035 (when (and (not ok-if-already-exists) (file-exists-p newname)) 1105 (setq newname (expand-file-name newname))
1036 (tramp-error 1106 ;; At least one file a Tramp file?
1037 v 'file-already-exists "File %s already exists" newname)) 1107 (if (or (tramp-tramp-file-p filename)
1038 1108 (tramp-tramp-file-p newname))
1039 (if (or (and (tramp-tramp-file-p filename) 1109 (tramp-gvfs-do-copy-or-rename-file
1040 (not (tramp-gvfs-file-name-p filename))) 1110 'rename filename newname ok-if-already-exists t t)
1041 (and (tramp-tramp-file-p newname) 1111 (tramp-run-real-handler
1042 (not (tramp-gvfs-file-name-p newname)))) 1112 'rename-file (list filename newname ok-if-already-exists))))
1043
1044 ;; We cannot move directly.
1045 (let ((tmpfile (tramp-compat-make-temp-file filename)))
1046 (rename-file filename tmpfile t)
1047 (rename-file tmpfile newname ok-if-already-exists))
1048
1049 ;; Direct move.
1050 (with-tramp-progress-reporter
1051 v 0 (format "Renaming %s to %s" filename newname)
1052 (unless
1053 (tramp-gvfs-send-command
1054 v "gvfs-move"
1055 (tramp-gvfs-url-file-name filename)
1056 (tramp-gvfs-url-file-name newname))
1057 ;; Propagate the error.
1058 (with-current-buffer (tramp-get-buffer v)
1059 (goto-char (point-min))
1060 (tramp-error-with-buffer
1061 nil v 'file-error
1062 "Renaming failed, see buffer `%s' for details." (buffer-name)))))
1063
1064 (when (tramp-tramp-file-p filename)
1065 (with-parsed-tramp-file-name filename nil
1066 (tramp-flush-file-property v (file-name-directory localname))
1067 (tramp-flush-file-property v localname)))
1068
1069 (when (tramp-tramp-file-p newname)
1070 (with-parsed-tramp-file-name newname nil
1071 (tramp-flush-file-property v (file-name-directory localname))
1072 (tramp-flush-file-property v localname))))))
1073 1113
1074(defun tramp-gvfs-handle-write-region 1114(defun tramp-gvfs-handle-write-region
1075 (start end filename &optional append visit lockname confirm) 1115 (start end filename &optional append visit lockname confirm)
@@ -1530,7 +1570,7 @@ connection if a previous connection has died for some reason."
1530 ;; indicated by the "mounted" signal, i.e. the "fuse-mountpoint" 1570 ;; indicated by the "mounted" signal, i.e. the "fuse-mountpoint"
1531 ;; file property. 1571 ;; file property.
1532 (with-timeout 1572 (with-timeout
1533 ((or (tramp-get-method-parameter method 'tramp-connection-timeout) 1573 ((or (tramp-get-method-parameter vec 'tramp-connection-timeout)
1534 tramp-connection-timeout) 1574 tramp-connection-timeout)
1535 (if (zerop (length (tramp-file-name-user vec))) 1575 (if (zerop (length (tramp-file-name-user vec)))
1536 (tramp-error 1576 (tramp-error
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index fda5945a18a..dbf46794a82 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -135,6 +135,7 @@ The string is used in `tramp-methods'.")
135 (tramp-login-program "rsh") 135 (tramp-login-program "rsh")
136 (tramp-login-args (("%h") ("-l" "%u"))) 136 (tramp-login-args (("%h") ("-l" "%u")))
137 (tramp-remote-shell "/bin/sh") 137 (tramp-remote-shell "/bin/sh")
138 (tramp-remote-shell-login ("-l"))
138 (tramp-remote-shell-args ("-c")) 139 (tramp-remote-shell-args ("-c"))
139 (tramp-copy-program "rcp") 140 (tramp-copy-program "rcp")
140 (tramp-copy-args (("-p" "%k") ("-r"))) 141 (tramp-copy-args (("-p" "%k") ("-r")))
@@ -146,6 +147,7 @@ The string is used in `tramp-methods'.")
146 (tramp-login-program "remsh") 147 (tramp-login-program "remsh")
147 (tramp-login-args (("%h") ("-l" "%u"))) 148 (tramp-login-args (("%h") ("-l" "%u")))
148 (tramp-remote-shell "/bin/sh") 149 (tramp-remote-shell "/bin/sh")
150 (tramp-remote-shell-login ("-l"))
149 (tramp-remote-shell-args ("-c")) 151 (tramp-remote-shell-args ("-c"))
150 (tramp-copy-program "rcp") 152 (tramp-copy-program "rcp")
151 (tramp-copy-args (("-p" "%k"))) 153 (tramp-copy-args (("-p" "%k")))
@@ -158,6 +160,7 @@ The string is used in `tramp-methods'.")
158 ("-e" "none") ("%h"))) 160 ("-e" "none") ("%h")))
159 (tramp-async-args (("-q"))) 161 (tramp-async-args (("-q")))
160 (tramp-remote-shell "/bin/sh") 162 (tramp-remote-shell "/bin/sh")
163 (tramp-remote-shell-login ("-l"))
161 (tramp-remote-shell-args ("-c")) 164 (tramp-remote-shell-args ("-c"))
162 (tramp-copy-program "scp") 165 (tramp-copy-program "scp")
163 (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r") ("%c"))) 166 (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r") ("%c")))
@@ -175,6 +178,7 @@ The string is used in `tramp-methods'.")
175 ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh"))) 178 ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh")))
176 (tramp-async-args (("-q"))) 179 (tramp-async-args (("-q")))
177 (tramp-remote-shell "/bin/sh") 180 (tramp-remote-shell "/bin/sh")
181 (tramp-remote-shell-login ("-l"))
178 (tramp-remote-shell-args ("-c")) 182 (tramp-remote-shell-args ("-c"))
179 (tramp-copy-program "scp") 183 (tramp-copy-program "scp")
180 (tramp-copy-args (("-P" "%p") ("-p" "%k") 184 (tramp-copy-args (("-P" "%p") ("-p" "%k")
@@ -193,6 +197,7 @@ The string is used in `tramp-methods'.")
193 ("-e" "none") ("%h"))) 197 ("-e" "none") ("%h")))
194 (tramp-async-args (("-q"))) 198 (tramp-async-args (("-q")))
195 (tramp-remote-shell "/bin/sh") 199 (tramp-remote-shell "/bin/sh")
200 (tramp-remote-shell-login ("-l"))
196 (tramp-remote-shell-args ("-c")) 201 (tramp-remote-shell-args ("-c"))
197 (tramp-copy-program "rsync") 202 (tramp-copy-program "rsync")
198 (tramp-copy-args (("-t" "%k") ("-r"))) 203 (tramp-copy-args (("-t" "%k") ("-r")))
@@ -206,6 +211,7 @@ The string is used in `tramp-methods'.")
206 (tramp-login-program "rsh") 211 (tramp-login-program "rsh")
207 (tramp-login-args (("%h") ("-l" "%u"))) 212 (tramp-login-args (("%h") ("-l" "%u")))
208 (tramp-remote-shell "/bin/sh") 213 (tramp-remote-shell "/bin/sh")
214 (tramp-remote-shell-login ("-l"))
209 (tramp-remote-shell-args ("-c")))) 215 (tramp-remote-shell-args ("-c"))))
210;;;###tramp-autoload 216;;;###tramp-autoload
211(add-to-list 'tramp-methods 217(add-to-list 'tramp-methods
@@ -213,6 +219,7 @@ The string is used in `tramp-methods'.")
213 (tramp-login-program "remsh") 219 (tramp-login-program "remsh")
214 (tramp-login-args (("%h") ("-l" "%u"))) 220 (tramp-login-args (("%h") ("-l" "%u")))
215 (tramp-remote-shell "/bin/sh") 221 (tramp-remote-shell "/bin/sh")
222 (tramp-remote-shell-login ("-l"))
216 (tramp-remote-shell-args ("-c")))) 223 (tramp-remote-shell-args ("-c"))))
217;;;###tramp-autoload 224;;;###tramp-autoload
218(add-to-list 'tramp-methods 225(add-to-list 'tramp-methods
@@ -222,6 +229,7 @@ The string is used in `tramp-methods'.")
222 ("-e" "none") ("%h"))) 229 ("-e" "none") ("%h")))
223 (tramp-async-args (("-q"))) 230 (tramp-async-args (("-q")))
224 (tramp-remote-shell "/bin/sh") 231 (tramp-remote-shell "/bin/sh")
232 (tramp-remote-shell-login ("-l"))
225 (tramp-remote-shell-args ("-c")) 233 (tramp-remote-shell-args ("-c"))
226 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") 234 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
227 ("-o" "UserKnownHostsFile=/dev/null") 235 ("-o" "UserKnownHostsFile=/dev/null")
@@ -235,6 +243,7 @@ The string is used in `tramp-methods'.")
235 ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh"))) 243 ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh")))
236 (tramp-async-args (("-q"))) 244 (tramp-async-args (("-q")))
237 (tramp-remote-shell "/bin/sh") 245 (tramp-remote-shell "/bin/sh")
246 (tramp-remote-shell-login ("-l"))
238 (tramp-remote-shell-args ("-c")) 247 (tramp-remote-shell-args ("-c"))
239 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") 248 (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
240 ("-o" "UserKnownHostsFile=/dev/null") 249 ("-o" "UserKnownHostsFile=/dev/null")
@@ -246,6 +255,7 @@ The string is used in `tramp-methods'.")
246 (tramp-login-program "telnet") 255 (tramp-login-program "telnet")
247 (tramp-login-args (("%h") ("%p") ("2>/dev/null"))) 256 (tramp-login-args (("%h") ("%p") ("2>/dev/null")))
248 (tramp-remote-shell "/bin/sh") 257 (tramp-remote-shell "/bin/sh")
258 (tramp-remote-shell-login ("-l"))
249 (tramp-remote-shell-args ("-c")) 259 (tramp-remote-shell-args ("-c"))
250 (tramp-default-port 23))) 260 (tramp-default-port 23)))
251;;;###tramp-autoload 261;;;###tramp-autoload
@@ -254,6 +264,7 @@ The string is used in `tramp-methods'.")
254 (tramp-login-program "telnet") 264 (tramp-login-program "telnet")
255 (tramp-login-args (("%h") ("%p") ("2>/dev/null"))) 265 (tramp-login-args (("%h") ("%p") ("2>/dev/null")))
256 (tramp-remote-shell "/bin/sh") 266 (tramp-remote-shell "/bin/sh")
267 (tramp-remote-shell-login ("-l"))
257 (tramp-remote-shell-args ("-c")) 268 (tramp-remote-shell-args ("-c"))
258 (tramp-copy-program "nc") 269 (tramp-copy-program "nc")
259 ;; We use "-v" for better error tracking. 270 ;; We use "-v" for better error tracking.
@@ -270,6 +281,7 @@ The string is used in `tramp-methods'.")
270 (tramp-login-program "su") 281 (tramp-login-program "su")
271 (tramp-login-args (("-") ("%u"))) 282 (tramp-login-args (("-") ("%u")))
272 (tramp-remote-shell "/bin/sh") 283 (tramp-remote-shell "/bin/sh")
284 (tramp-remote-shell-login ("-l"))
273 (tramp-remote-shell-args ("-c")) 285 (tramp-remote-shell-args ("-c"))
274 (tramp-connection-timeout 10))) 286 (tramp-connection-timeout 10)))
275;;;###tramp-autoload 287;;;###tramp-autoload
@@ -280,6 +292,7 @@ The string is used in `tramp-methods'.")
280 ;; Local $SHELL could be a nasty one, like zsh or fish. Let's override it. 292 ;; Local $SHELL could be a nasty one, like zsh or fish. Let's override it.
281 (tramp-login-env (("SHELL") ("/bin/sh"))) 293 (tramp-login-env (("SHELL") ("/bin/sh")))
282 (tramp-remote-shell "/bin/sh") 294 (tramp-remote-shell "/bin/sh")
295 (tramp-remote-shell-login ("-l"))
283 (tramp-remote-shell-args ("-c")) 296 (tramp-remote-shell-args ("-c"))
284 (tramp-connection-timeout 10))) 297 (tramp-connection-timeout 10)))
285;;;###tramp-autoload 298;;;###tramp-autoload
@@ -288,6 +301,7 @@ The string is used in `tramp-methods'.")
288 (tramp-login-program "ksu") 301 (tramp-login-program "ksu")
289 (tramp-login-args (("%u") ("-q"))) 302 (tramp-login-args (("%u") ("-q")))
290 (tramp-remote-shell "/bin/sh") 303 (tramp-remote-shell "/bin/sh")
304 (tramp-remote-shell-login ("-l"))
291 (tramp-remote-shell-args ("-c")) 305 (tramp-remote-shell-args ("-c"))
292 (tramp-connection-timeout 10))) 306 (tramp-connection-timeout 10)))
293;;;###tramp-autoload 307;;;###tramp-autoload
@@ -296,6 +310,7 @@ The string is used in `tramp-methods'.")
296 (tramp-login-program "krlogin") 310 (tramp-login-program "krlogin")
297 (tramp-login-args (("%h") ("-l" "%u") ("-x"))) 311 (tramp-login-args (("%h") ("-l" "%u") ("-x")))
298 (tramp-remote-shell "/bin/sh") 312 (tramp-remote-shell "/bin/sh")
313 (tramp-remote-shell-login ("-l"))
299 (tramp-remote-shell-args ("-c")))) 314 (tramp-remote-shell-args ("-c"))))
300;;;###tramp-autoload 315;;;###tramp-autoload
301(add-to-list 'tramp-methods 316(add-to-list 'tramp-methods
@@ -310,6 +325,7 @@ The string is used in `tramp-methods'.")
310 tramp-initial-end-of-output)) 325 tramp-initial-end-of-output))
311 ("/bin/sh") ("\""))) 326 ("/bin/sh") ("\"")))
312 (tramp-remote-shell "/bin/sh") 327 (tramp-remote-shell "/bin/sh")
328 (tramp-remote-shell-login ("-l"))
313 (tramp-remote-shell-args ("-c")) 329 (tramp-remote-shell-args ("-c"))
314 (tramp-default-port 22))) 330 (tramp-default-port 22)))
315;;;###tramp-autoload 331;;;###tramp-autoload
@@ -323,6 +339,7 @@ The string is used in `tramp-methods'.")
323 tramp-initial-end-of-output)) 339 tramp-initial-end-of-output))
324 ("/bin/sh") ("\""))) 340 ("/bin/sh") ("\"")))
325 (tramp-remote-shell "/bin/sh") 341 (tramp-remote-shell "/bin/sh")
342 (tramp-remote-shell-login ("-l"))
326 (tramp-remote-shell-args ("-c")))) 343 (tramp-remote-shell-args ("-c"))))
327;;;###tramp-autoload 344;;;###tramp-autoload
328(add-to-list 'tramp-methods 345(add-to-list 'tramp-methods
@@ -336,6 +353,7 @@ The string is used in `tramp-methods'.")
336 tramp-initial-end-of-output)) 353 tramp-initial-end-of-output))
337 ("/bin/sh") ("\""))) 354 ("/bin/sh") ("\"")))
338 (tramp-remote-shell "/bin/sh") 355 (tramp-remote-shell "/bin/sh")
356 (tramp-remote-shell-login ("-l"))
339 (tramp-remote-shell-args ("-c")) 357 (tramp-remote-shell-args ("-c"))
340 (tramp-copy-program "pscp") 358 (tramp-copy-program "pscp")
341 (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-scp") ("-p" "%k") 359 (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-scp") ("-p" "%k")
@@ -355,6 +373,7 @@ The string is used in `tramp-methods'.")
355 tramp-initial-end-of-output)) 373 tramp-initial-end-of-output))
356 ("/bin/sh") ("\""))) 374 ("/bin/sh") ("\"")))
357 (tramp-remote-shell "/bin/sh") 375 (tramp-remote-shell "/bin/sh")
376 (tramp-remote-shell-login ("-l"))
358 (tramp-remote-shell-args ("-c")) 377 (tramp-remote-shell-args ("-c"))
359 (tramp-copy-program "pscp") 378 (tramp-copy-program "pscp")
360 (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k") 379 (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k")
@@ -367,6 +386,7 @@ The string is used in `tramp-methods'.")
367 (tramp-login-program "fsh") 386 (tramp-login-program "fsh")
368 (tramp-login-args (("%h") ("-l" "%u") ("sh" "-i"))) 387 (tramp-login-args (("%h") ("-l" "%u") ("sh" "-i")))
369 (tramp-remote-shell "/bin/sh") 388 (tramp-remote-shell "/bin/sh")
389 (tramp-remote-shell-login ("-l"))
370 (tramp-remote-shell-args ("-i") ("-c")) 390 (tramp-remote-shell-args ("-i") ("-c"))
371 (tramp-copy-program "fcp") 391 (tramp-copy-program "fcp")
372 (tramp-copy-args (("-p" "%k"))) 392 (tramp-copy-args (("-p" "%k")))
@@ -1957,7 +1977,7 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
1957 (t2 (tramp-tramp-file-p newname))) 1977 (t2 (tramp-tramp-file-p newname)))
1958 (with-parsed-tramp-file-name (if t1 dirname newname) nil 1978 (with-parsed-tramp-file-name (if t1 dirname newname) nil
1959 (if (and (not copy-contents) 1979 (if (and (not copy-contents)
1960 (tramp-get-method-parameter method 'tramp-copy-recursive) 1980 (tramp-get-method-parameter v 'tramp-copy-recursive)
1961 ;; When DIRNAME and NEWNAME are remote, they must have 1981 ;; When DIRNAME and NEWNAME are remote, they must have
1962 ;; the same method. 1982 ;; the same method.
1963 (or (null t1) (null t2) 1983 (or (null t1) (null t2)
@@ -2379,7 +2399,7 @@ The method used must be an out-of-band method."
2379 (tramp-get-connection-property v "login-as" nil))) 2399 (tramp-get-connection-property v "login-as" nil)))
2380 2400
2381 ;; Check for listener port. 2401 ;; Check for listener port.
2382 (when (tramp-get-method-parameter method 'tramp-remote-copy-args) 2402 (when (tramp-get-method-parameter v 'tramp-remote-copy-args)
2383 (setq listener (number-to-string (+ 50000 (random 10000)))) 2403 (setq listener (number-to-string (+ 50000 (random 10000))))
2384 (while 2404 (while
2385 (zerop (tramp-call-process v "nc" nil nil nil "-z" host listener)) 2405 (zerop (tramp-call-process v "nc" nil nil nil "-z" host listener))
@@ -2396,10 +2416,9 @@ The method used must be an out-of-band method."
2396 spec (format-spec-make 2416 spec (format-spec-make
2397 ?h host ?u user ?p port ?r listener ?c options 2417 ?h host ?u user ?p port ?r listener ?c options
2398 ?k (if keep-date " " "")) 2418 ?k (if keep-date " " ""))
2399 copy-program (tramp-get-method-parameter 2419 copy-program (tramp-get-method-parameter v 'tramp-copy-program)
2400 method 'tramp-copy-program)
2401 copy-keep-date (tramp-get-method-parameter 2420 copy-keep-date (tramp-get-method-parameter
2402 method 'tramp-copy-keep-date) 2421 v 'tramp-copy-keep-date)
2403 2422
2404 copy-args 2423 copy-args
2405 (delete 2424 (delete
@@ -2408,9 +2427,7 @@ The method used must be an out-of-band method."
2408 ;; for the whole keep-date sublist. 2427 ;; for the whole keep-date sublist.
2409 " " 2428 " "
2410 (dolist 2429 (dolist
2411 (x 2430 (x (tramp-get-method-parameter v 'tramp-copy-args) copy-args)
2412 (tramp-get-method-parameter method 'tramp-copy-args)
2413 copy-args)
2414 (setq copy-args 2431 (setq copy-args
2415 (append 2432 (append
2416 copy-args 2433 copy-args
@@ -2424,16 +2441,12 @@ The method used must be an out-of-band method."
2424 (lambda (x) 2441 (lambda (x)
2425 (setq x (mapcar (lambda (y) (format-spec y spec)) x)) 2442 (setq x (mapcar (lambda (y) (format-spec y spec)) x))
2426 (unless (member "" x) (mapconcat 'identity x " "))) 2443 (unless (member "" x) (mapconcat 'identity x " ")))
2427 (tramp-get-method-parameter method 'tramp-copy-env))) 2444 (tramp-get-method-parameter v 'tramp-copy-env)))
2428 2445
2429 remote-copy-program 2446 remote-copy-program
2430 (tramp-get-method-parameter method 'tramp-remote-copy-program)) 2447 (tramp-get-method-parameter v 'tramp-remote-copy-program))
2431 2448
2432 (dolist 2449 (dolist (x (tramp-get-method-parameter v 'tramp-remote-copy-args))
2433 (x
2434 (or
2435 (tramp-get-connection-property v "remote-copy-args" nil)
2436 (tramp-get-method-parameter method 'tramp-remote-copy-args)))
2437 (setq remote-copy-args 2450 (setq remote-copy-args
2438 (append 2451 (append
2439 remote-copy-args 2452 remote-copy-args
@@ -3333,8 +3346,7 @@ the result will be a local, non-Tramp, file name."
3333 (if (and (not (stringp start)) 3346 (if (and (not (stringp start))
3334 (= (or end (point-max)) (point-max)) 3347 (= (or end (point-max)) (point-max))
3335 (= (or start (point-min)) (point-min)) 3348 (= (or start (point-min)) (point-min))
3336 (tramp-get-method-parameter 3349 (tramp-get-method-parameter v 'tramp-copy-keep-tmpfile))
3337 method 'tramp-copy-keep-tmpfile))
3338 (progn 3350 (progn
3339 (setq tramp-temp-buffer-file-name tmpfile) 3351 (setq tramp-temp-buffer-file-name tmpfile)
3340 (condition-case err 3352 (condition-case err
@@ -3952,12 +3964,7 @@ file exists and nonzero exit status otherwise."
3952(defun tramp-find-shell (vec) 3964(defun tramp-find-shell (vec)
3953 "Opens a shell on the remote host which groks tilde expansion." 3965 "Opens a shell on the remote host which groks tilde expansion."
3954 (with-current-buffer (tramp-get-buffer vec) 3966 (with-current-buffer (tramp-get-buffer vec)
3955 (let ((default-shell 3967 (let ((default-shell (tramp-get-method-parameter vec 'tramp-remote-shell))
3956 (or
3957 (tramp-get-connection-property
3958 (tramp-get-connection-process vec) "remote-shell" nil)
3959 (tramp-get-method-parameter
3960 (tramp-file-name-method vec) 'tramp-remote-shell)))
3961 shell) 3968 shell)
3962 (setq shell 3969 (setq shell
3963 (with-tramp-connection-property vec "remote-shell" 3970 (with-tramp-connection-property vec "remote-shell"
@@ -4016,11 +4023,7 @@ seconds. If not, it produces an error message with the given ERROR-ARGS."
4016Mainly sets the prompt and the echo correctly. PROC is the shell 4023Mainly sets the prompt and the echo correctly. PROC is the shell
4017process to set up. VEC specifies the connection." 4024process to set up. VEC specifies the connection."
4018 (let ((tramp-end-of-output tramp-initial-end-of-output)) 4025 (let ((tramp-end-of-output tramp-initial-end-of-output))
4019 (tramp-open-shell 4026 (tramp-open-shell vec (tramp-get-method-parameter vec 'tramp-remote-shell))
4020 vec
4021 (or (tramp-get-connection-property vec "remote-shell" nil)
4022 (tramp-get-method-parameter
4023 (tramp-file-name-method vec) 'tramp-remote-shell)))
4024 4027
4025 ;; Disable echo. 4028 ;; Disable echo.
4026 (tramp-message vec 5 "Setting up remote shell environment") 4029 (tramp-message vec 5 "Setting up remote shell environment")
@@ -4557,15 +4560,9 @@ Gateway hops are already opened."
4557 ;; Foreign and out-of-band methods are not supported for multi-hops. 4560 ;; Foreign and out-of-band methods are not supported for multi-hops.
4558 (when (cdr target-alist) 4561 (when (cdr target-alist)
4559 (setq choices target-alist) 4562 (setq choices target-alist)
4560 (while choices 4563 (while (setq item (pop choices))
4561 (setq item (pop choices)) 4564 (when (or (not (tramp-get-method-parameter item 'tramp-login-program))
4562 (when 4565 (tramp-get-method-parameter item 'tramp-copy-program))
4563 (or
4564 (not
4565 (tramp-get-method-parameter
4566 (tramp-file-name-method item) 'tramp-login-program))
4567 (tramp-get-method-parameter
4568 (tramp-file-name-method item) 'tramp-copy-program))
4569 (tramp-error 4566 (tramp-error
4570 vec 'file-error 4567 vec 'file-error
4571 "Method `%s' is not supported for multi-hops." 4568 "Method `%s' is not supported for multi-hops."
@@ -4582,8 +4579,7 @@ Gateway hops are already opened."
4582 ;; There are multi-hops. 4579 ;; There are multi-hops.
4583 (cdr target-alist) 4580 (cdr target-alist)
4584 ;; The host name is used for the remote shell command. 4581 ;; The host name is used for the remote shell command.
4585 (member 4582 (member '("%h") (tramp-get-method-parameter v 'tramp-login-args))
4586 '("%h") (tramp-get-method-parameter method 'tramp-login-args))
4587 ;; The host is local. We cannot use `tramp-local-host-p' 4583 ;; The host is local. We cannot use `tramp-local-host-p'
4588 ;; here, because it opens a connection as well. 4584 ;; here, because it opens a connection as well.
4589 (string-match tramp-local-host-regexp host)) 4585 (string-match tramp-local-host-regexp host))
@@ -4600,8 +4596,7 @@ Gateway hops are already opened."
4600 (cond 4596 (cond
4601 ;; No options to be computed. 4597 ;; No options to be computed.
4602 ((or (null tramp-use-ssh-controlmaster-options) 4598 ((or (null tramp-use-ssh-controlmaster-options)
4603 (null (assoc "%c" (tramp-get-method-parameter 4599 (null (assoc "%c" (tramp-get-method-parameter vec 'tramp-login-args))))
4604 (tramp-file-name-method vec) 'tramp-login-args))))
4605 "") 4600 "")
4606 4601
4607 ;; There is already a value to be used. 4602 ;; There is already a value to be used.
@@ -4764,22 +4759,18 @@ connection if a previous connection has died for some reason."
4764 (l-host (tramp-file-name-host hop)) 4759 (l-host (tramp-file-name-host hop))
4765 (l-port nil) 4760 (l-port nil)
4766 (login-program 4761 (login-program
4767 (tramp-get-method-parameter 4762 (tramp-get-method-parameter hop 'tramp-login-program))
4768 l-method 'tramp-login-program))
4769 (login-args 4763 (login-args
4770 (tramp-get-method-parameter 4764 (tramp-get-method-parameter hop 'tramp-login-args))
4771 l-method 'tramp-login-args))
4772 (login-env 4765 (login-env
4773 (tramp-get-method-parameter 4766 (tramp-get-method-parameter hop 'tramp-login-env))
4774 l-method 'tramp-login-env))
4775 (async-args 4767 (async-args
4776 (tramp-get-method-parameter 4768 (tramp-get-method-parameter hop 'tramp-async-args))
4777 l-method 'tramp-async-args))
4778 (connection-timeout 4769 (connection-timeout
4779 (tramp-get-method-parameter 4770 (tramp-get-method-parameter
4780 l-method 'tramp-connection-timeout)) 4771 hop 'tramp-connection-timeout))
4781 (gw-args 4772 (gw-args
4782 (tramp-get-method-parameter l-method 'tramp-gw-args)) 4773 (tramp-get-method-parameter hop 'tramp-gw-args))
4783 (gw (let ((tramp-verbose 0)) 4774 (gw (let ((tramp-verbose 0))
4784 (tramp-get-file-property hop "" "gateway" nil))) 4775 (tramp-get-file-property hop "" "gateway" nil)))
4785 (g-method (and gw (tramp-file-name-method gw))) 4776 (g-method (and gw (tramp-file-name-method gw)))
@@ -5121,12 +5112,13 @@ Return ATTR."
5121 (let ((method (tramp-file-name-method vec)) 5112 (let ((method (tramp-file-name-method vec))
5122 (user (tramp-file-name-user vec)) 5113 (user (tramp-file-name-user vec))
5123 (host (tramp-file-name-real-host vec)) 5114 (host (tramp-file-name-real-host vec))
5124 (localname (tramp-shell-quote-argument 5115 (localname (tramp-file-name-localname vec)))
5125 (tramp-file-name-localname vec))))
5126 (when (string-match tramp-ipv6-regexp host) 5116 (when (string-match tramp-ipv6-regexp host)
5127 (setq host (format "[%s]" host))) 5117 (setq host (format "[%s]" host)))
5118 (unless (string-match "ftp$" method)
5119 (setq localname (tramp-shell-quote-argument localname)))
5128 (cond 5120 (cond
5129 ((tramp-get-method-parameter method 'tramp-remote-copy-program) 5121 ((tramp-get-method-parameter vec 'tramp-remote-copy-program)
5130 localname) 5122 localname)
5131 ((not (zerop (length user))) 5123 ((not (zerop (length user)))
5132 (shell-quote-argument (format "%s@%s:%s" user host localname))) 5124 (shell-quote-argument (format "%s@%s:%s" user host localname)))
@@ -5136,7 +5128,7 @@ Return ATTR."
5136 "Return t if this is an out-of-band method, nil otherwise." 5128 "Return t if this is an out-of-band method, nil otherwise."
5137 (and 5129 (and
5138 ;; It shall be an out-of-band method. 5130 ;; It shall be an out-of-band method.
5139 (tramp-get-method-parameter (tramp-file-name-method vec) 'tramp-copy-program) 5131 (tramp-get-method-parameter vec 'tramp-copy-program)
5140 ;; There must be a size, otherwise the file doesn't exist. 5132 ;; There must be a size, otherwise the file doesn't exist.
5141 (numberp size) 5133 (numberp size)
5142 ;; Either the file size is large enough, or (in rare cases) there 5134 ;; Either the file size is large enough, or (in rare cases) there
@@ -5178,13 +5170,15 @@ Return ATTR."
5178 (tramp-send-command-and-read 5170 (tramp-send-command-and-read
5179 vec 5171 vec
5180 (format 5172 (format
5181 "%s -l %s 'echo %s \\\"$PATH\\\"'" 5173 "%s %s %s 'echo %s \\\"$PATH\\\"'"
5182 (tramp-get-method-parameter 5174 (tramp-get-method-parameter vec 'tramp-remote-shell)
5183 (tramp-file-name-method vec) 'tramp-remote-shell) 5175 (mapconcat
5176 'identity
5177 (tramp-get-method-parameter vec 'tramp-remote-shell-login)
5178 " ")
5184 (mapconcat 5179 (mapconcat
5185 'identity 5180 'identity
5186 (tramp-get-method-parameter 5181 (tramp-get-method-parameter vec 'tramp-remote-shell-args)
5187 (tramp-file-name-method vec) 'tramp-remote-shell-args)
5188 " ") 5182 " ")
5189 (tramp-shell-quote-argument tramp-end-of-heredoc)) 5183 (tramp-shell-quote-argument tramp-end-of-heredoc))
5190 nil (regexp-quote tramp-end-of-heredoc))))) 5184 nil (regexp-quote tramp-end-of-heredoc)))))
@@ -5636,8 +5630,6 @@ function cell is returned to be applied on a buffer."
5636;; * Don't use globbing for directories with many files, as this is 5630;; * Don't use globbing for directories with many files, as this is
5637;; likely to produce long command lines, and some shells choke on 5631;; likely to produce long command lines, and some shells choke on
5638;; long command lines. 5632;; long command lines.
5639;; * Make it work for different encodings, and for different file name
5640;; encodings, too. (Daniel Pittman)
5641;; * Don't search for perl5 and perl. Instead, only search for perl and 5633;; * Don't search for perl5 and perl. Instead, only search for perl and
5642;; then look if it's the right version (with `perl -v'). 5634;; then look if it's the right version (with `perl -v').
5643;; * When editing a remote CVS controlled file as a different user, VC 5635;; * When editing a remote CVS controlled file as a different user, VC
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index fc23a0bfeb5..beb87f61aaa 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -210,6 +210,12 @@ pair of the form (KEY VALUE). The following KEYs are defined:
210 for it. Also note that \"/bin/sh\" exists on all Unixen, 210 for it. Also note that \"/bin/sh\" exists on all Unixen,
211 this might not be true for the value that you decide to use. 211 this might not be true for the value that you decide to use.
212 You Have Been Warned. 212 You Have Been Warned.
213 * `tramp-remote-shell-login'
214 This specifies the arguments to let `tramp-remote-shell' run
215 as a login shell. It defaults to (\"-l\"), but some shells,
216 like ksh, require another argument. See
217 `tramp-connection-properties' for a way to overwrite the
218 default value.
213 * `tramp-remote-shell-args' 219 * `tramp-remote-shell-args'
214 For implementation of `shell-command', this specifies the 220 For implementation of `shell-command', this specifies the
215 arguments to let `tramp-remote-shell' run a single command. 221 arguments to let `tramp-remote-shell' run a single command.
@@ -1099,11 +1105,20 @@ calling HANDLER.")
1099;; internal data structure. Convenience functions for internal 1105;; internal data structure. Convenience functions for internal
1100;; data structure. 1106;; data structure.
1101 1107
1102(defun tramp-get-method-parameter (method param) 1108(defun tramp-get-method-parameter (vec param)
1103 "Return the method parameter PARAM. 1109 "Return the method parameter PARAM.
1104If the `tramp-methods' entry does not exist, return nil." 1110If VEC is a vector, check first in connection properties.
1105 (let ((entry (assoc param (assoc method tramp-methods)))) 1111Afterwards, check in `tramp-methods'. If the `tramp-methods'
1106 (when entry (cadr entry)))) 1112entry does not exist, return nil."
1113 (let ((hash-entry
1114 (replace-regexp-in-string "^tramp-" "" (symbol-name param))))
1115 (if (tramp-connection-property-p vec hash-entry)
1116 ;; We use the cached property.
1117 (tramp-get-connection-property vec hash-entry nil)
1118 ;; Use the static value from `tramp-methods'.
1119 (let ((methods-entry
1120 (assoc param (assoc (tramp-file-name-method vec) tramp-methods))))
1121 (when methods-entry (cadr methods-entry))))))
1107 1122
1108(defun tramp-file-name-p (vec) 1123(defun tramp-file-name-p (vec)
1109 "Check, whether VEC is a Tramp object." 1124 "Check, whether VEC is a Tramp object."
@@ -1167,7 +1182,7 @@ If the `tramp-methods' entry does not exist, return nil."
1167 (or (and (stringp host) 1182 (or (and (stringp host)
1168 (string-match tramp-host-with-port-regexp host) 1183 (string-match tramp-host-with-port-regexp host)
1169 (string-to-number (match-string 2 host))) 1184 (string-to-number (match-string 2 host)))
1170 (tramp-get-method-parameter method 'tramp-default-port))))) 1185 (tramp-get-method-parameter vec 'tramp-default-port)))))
1171 1186
1172;;;###tramp-autoload 1187;;;###tramp-autoload
1173(defun tramp-tramp-file-p (name) 1188(defun tramp-tramp-file-p (name)
@@ -3092,8 +3107,7 @@ User is always nil."
3092 ;; name handlers. 3107 ;; name handlers.
3093 (when (and (or beg end) 3108 (when (and (or beg end)
3094 (tramp-get-method-parameter 3109 (tramp-get-method-parameter
3095 (tramp-file-name-method v) 3110 v 'tramp-login-program))
3096 'tramp-login-program))
3097 (setq remote-copy (tramp-make-tramp-temp-file v)) 3111 (setq remote-copy (tramp-make-tramp-temp-file v))
3098 ;; This is defined in tramp-sh.el. Let's assume 3112 ;; This is defined in tramp-sh.el. Let's assume
3099 ;; this is loaded already. 3113 ;; this is loaded already.
@@ -3144,7 +3158,7 @@ User is always nil."
3144 3158
3145 (when (and (null remote-copy) 3159 (when (and (null remote-copy)
3146 (tramp-get-method-parameter 3160 (tramp-get-method-parameter
3147 method 'tramp-copy-keep-tmpfile)) 3161 v 'tramp-copy-keep-tmpfile))
3148 ;; We keep the local file for performance reasons, 3162 ;; We keep the local file for performance reasons,
3149 ;; useful for "rsync". 3163 ;; useful for "rsync".
3150 (setq tramp-temp-buffer-file-name local-copy)) 3164 (setq tramp-temp-buffer-file-name local-copy))
@@ -3228,12 +3242,10 @@ User is always nil."
3228 (args (append 3242 (args (append
3229 (cons 3243 (cons
3230 (tramp-get-method-parameter 3244 (tramp-get-method-parameter
3231 (tramp-file-name-method 3245 (tramp-dissect-file-name default-directory)
3232 (tramp-dissect-file-name default-directory))
3233 'tramp-remote-shell) 3246 'tramp-remote-shell)
3234 (tramp-get-method-parameter 3247 (tramp-get-method-parameter
3235 (tramp-file-name-method 3248 (tramp-dissect-file-name default-directory)
3236 (tramp-dissect-file-name default-directory))
3237 'tramp-remote-shell-args)) 3249 'tramp-remote-shell-args))
3238 (list (substring command 0 asynchronous)))) 3250 (list (substring command 0 asynchronous))))
3239 current-buffer-p 3251 current-buffer-p
@@ -3952,8 +3964,7 @@ be granted."
3952 ;; The method shall be applied to one of the shell file name 3964 ;; The method shall be applied to one of the shell file name
3953 ;; handlers. `tramp-local-host-p' is also called for "smb" and 3965 ;; handlers. `tramp-local-host-p' is also called for "smb" and
3954 ;; alike, where it must fail. 3966 ;; alike, where it must fail.
3955 (tramp-get-method-parameter 3967 (tramp-get-method-parameter vec 'tramp-login-program)
3956 (tramp-file-name-method vec) 'tramp-login-program)
3957 ;; The local temp directory must be writable for the other user. 3968 ;; The local temp directory must be writable for the other user.
3958 (file-writable-p 3969 (file-writable-p
3959 (tramp-make-tramp-file-name 3970 (tramp-make-tramp-file-name
@@ -3969,18 +3980,19 @@ be granted."
3969 3980
3970(defun tramp-get-remote-tmpdir (vec) 3981(defun tramp-get-remote-tmpdir (vec)
3971 "Return directory for temporary files on the remote host identified by VEC." 3982 "Return directory for temporary files on the remote host identified by VEC."
3972 (with-tramp-connection-property vec "tmpdir" 3983 (when (file-remote-p (tramp-get-connection-property vec "tmpdir" ""))
3973 (let ((dir (tramp-make-tramp-file-name 3984 ;; Compatibility code: Cached value shall be the local path only.
3974 (tramp-file-name-method vec) 3985 (tramp-set-connection-property vec "tmpdir" 'undef))
3975 (tramp-file-name-user vec) 3986 (let ((dir (tramp-make-tramp-file-name
3976 (tramp-file-name-host vec) 3987 (tramp-file-name-method vec)
3977 (or 3988 (tramp-file-name-user vec)
3978 (tramp-get-method-parameter 3989 (tramp-file-name-host vec)
3979 (tramp-file-name-method vec) 'tramp-tmpdir) 3990 (or (tramp-get-method-parameter vec 'tramp-tmpdir) "/tmp"))))
3980 "/tmp")))) 3991 (with-tramp-connection-property vec "tmpdir"
3981 (if (and (file-directory-p dir) (file-writable-p dir)) 3992 (or (and (file-directory-p dir) (file-writable-p dir)
3982 dir 3993 (file-remote-p dir 'localname))
3983 (tramp-error vec 'file-error "Directory %s not accessible" dir))))) 3994 (tramp-error vec 'file-error "Directory %s not accessible" dir)))
3995 dir))
3984 3996
3985;;;###tramp-autoload 3997;;;###tramp-autoload
3986(defun tramp-make-tramp-temp-file (vec) 3998(defun tramp-make-tramp-temp-file (vec)
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index beb040955e7..2f575f93037 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -31,7 +31,7 @@
31;; should be changed only there. 31;; should be changed only there.
32 32
33;;;###tramp-autoload 33;;;###tramp-autoload
34(defconst tramp-version "2.2.12" 34(defconst tramp-version "2.2.13-pre"
35 "This version of Tramp.") 35 "This version of Tramp.")
36 36
37;;;###tramp-autoload 37;;;###tramp-autoload
@@ -58,7 +58,7 @@
58 (= emacs-major-version 21) 58 (= emacs-major-version 21)
59 (>= emacs-minor-version 4))) 59 (>= emacs-minor-version 4)))
60 "ok" 60 "ok"
61 (format "Tramp 2.2.12 is not fit for %s" 61 (format "Tramp 2.2.13-pre is not fit for %s"
62 (when (string-match "^.*$" (emacs-version)) 62 (when (string-match "^.*$" (emacs-version))
63 (match-string 0 (emacs-version))))))) 63 (match-string 0 (emacs-version)))))))
64 (unless (string-match "\\`ok\\'" x) (error "%s" x))) 64 (unless (string-match "\\`ok\\'" x) (error "%s" x)))