diff options
| author | Kai Großjohann | 2002-07-21 13:49:06 +0000 |
|---|---|---|
| committer | Kai Großjohann | 2002-07-21 13:49:06 +0000 |
| commit | 90dc758dc0e1d2f8c5d204366c280d5c29f43aa3 (patch) | |
| tree | d2e310ae193dc48dd1fcd2934f57c2f3e1c5b1aa | |
| parent | 905fe32703e3124afca2a2a42e41291d3ba6cad0 (diff) | |
| download | emacs-90dc758dc0e1d2f8c5d204366c280d5c29f43aa3.tar.gz emacs-90dc758dc0e1d2f8c5d204366c280d5c29f43aa3.zip | |
Bump version to 2.0.2.
(tramp-methods): Rename methods invoking "ssh1" or "ssh2" to
longer names. Use old names "sm1", "sm2" and so on for methods
invoking "ssh -1" or "ssh -2".
(tramp-multi-file-name-structure-separate): Typo, its name was set
to "tramp-file-name-structure-separate". Trivial patch. From
Steve Youngs <youngs@xemacs.org>.
(tramp-multi-sh-program): New variable.
(tramp-open-connection-multi): Use it. Now you can use multi
methods from Windows (at least in principle).
(tramp-do-copy-or-rename-via-buffer): New function.
(tramp-do-copy-or-rename-file): Use it. Change and simplify
logic. Omit special case of invoking rcp directly to copy the
files.
(tramp-open-connection-su, tramp-multi-connect-telnet)
(tramp-multi-connect-rlogin, tramp-multi-connect-su)
(tramp-make-tramp-file-name, tramp-make-tramp-multi-file-name):
Use backticks in format-spec for brevity and to avoid
character/number confusion in XEmacs.
| -rw-r--r-- | lisp/ChangeLog | 22 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 318 | ||||
| -rw-r--r-- | man/tramp.texi | 16 |
3 files changed, 238 insertions, 118 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 297d18956c9..b67c3d795fe 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,25 @@ | |||
| 1 | 2002-07-21 Kai Gro,b_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE> | ||
| 2 | |||
| 3 | * net/tramp.el: Bump version to 2.0.2. | ||
| 4 | (tramp-methods): Rename methods invoking "ssh1" or "ssh2" to | ||
| 5 | longer names. Use old names "sm1", "sm2" and so on for methods | ||
| 6 | invoking "ssh -1" or "ssh -2". | ||
| 7 | (tramp-multi-file-name-structure-separate): Typo, its name was set | ||
| 8 | to "tramp-file-name-structure-separate". Trivial patch. From | ||
| 9 | Steve Youngs <youngs@xemacs.org>. | ||
| 10 | (tramp-multi-sh-program): New variable. | ||
| 11 | (tramp-open-connection-multi): Use it. Now you can use multi | ||
| 12 | methods from Windows (at least in principle). | ||
| 13 | (tramp-do-copy-or-rename-via-buffer): New function. | ||
| 14 | (tramp-do-copy-or-rename-file): Use it. Change and simplify | ||
| 15 | logic. Omit special case of invoking rcp directly to copy the | ||
| 16 | files. | ||
| 17 | (tramp-open-connection-su, tramp-multi-connect-telnet) | ||
| 18 | (tramp-multi-connect-rlogin, tramp-multi-connect-su) | ||
| 19 | (tramp-make-tramp-file-name, tramp-make-tramp-multi-file-name): | ||
| 20 | Use backticks in format-spec for brevity and to avoid | ||
| 21 | character/number confusion in XEmacs. | ||
| 22 | |||
| 1 | 2002-07-20 Richard M. Stallman <rms@gnu.org> | 23 | 2002-07-20 Richard M. Stallman <rms@gnu.org> |
| 2 | 24 | ||
| 3 | * wid-edit.el (widget-documentation-string-value-create): | 25 | * wid-edit.el (widget-documentation-string-value-create): |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 6491a4cade9..662690e3f0a 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -69,7 +69,7 @@ | |||
| 69 | 69 | ||
| 70 | ;;; Code: | 70 | ;;; Code: |
| 71 | 71 | ||
| 72 | (defconst tramp-version "2.0.1" | 72 | (defconst tramp-version "2.0.2" |
| 73 | "This version of tramp.") | 73 | "This version of tramp.") |
| 74 | (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" | 74 | (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" |
| 75 | "Email address to send bug reports to.") | 75 | "Email address to send bug reports to.") |
| @@ -131,6 +131,25 @@ use for the remote host." | |||
| 131 | :group 'tramp | 131 | :group 'tramp |
| 132 | :type '(file :must-match t)) | 132 | :type '(file :must-match t)) |
| 133 | 133 | ||
| 134 | (defcustom tramp-multi-sh-program | ||
| 135 | (if (memq system-type '(windows-nt)) | ||
| 136 | "cmd.exe" | ||
| 137 | tramp-sh-program) | ||
| 138 | "*Use this program for bootstrapping multi-hop connections. | ||
| 139 | This variable is similar to `tramp-sh-program', but it is only used | ||
| 140 | when initializing a multi-hop connection. Therefore, the set of | ||
| 141 | commands sent to this shell is quite restricted, and if you are | ||
| 142 | careful it works to use CMD.EXE under Windows (instead of a Bourne-ish | ||
| 143 | shell which does not normally exist on Windows anyway). | ||
| 144 | |||
| 145 | To use multi-hop methods from Windows, you also need suitable entries | ||
| 146 | in `tramp-multi-connection-function-alist' for the first hop. | ||
| 147 | |||
| 148 | This variable defaults to CMD.EXE on Windows NT, and to the value of | ||
| 149 | `tramp-sh-program' on other systems." | ||
| 150 | :group 'tramp | ||
| 151 | :type '(file :must-match t)) | ||
| 152 | |||
| 134 | ;; CCC I have changed all occurrences of comint-quote-filename with | 153 | ;; CCC I have changed all occurrences of comint-quote-filename with |
| 135 | ;; tramp-shell-quote-argument, except in tramp-handle-expand-many-files. | 154 | ;; tramp-shell-quote-argument, except in tramp-handle-expand-many-files. |
| 136 | ;; There, comint-quote-filename was removed altogether. If it turns | 155 | ;; There, comint-quote-filename was removed altogether. If it turns |
| @@ -178,6 +197,36 @@ use for the remote host." | |||
| 178 | (tramp-telnet-program nil) | 197 | (tramp-telnet-program nil) |
| 179 | (tramp-telnet-args nil)) | 198 | (tramp-telnet-args nil)) |
| 180 | ("scp1" (tramp-connection-function tramp-open-connection-rsh) | 199 | ("scp1" (tramp-connection-function tramp-open-connection-rsh) |
| 200 | (tramp-rsh-program "ssh") | ||
| 201 | (tramp-rcp-program "scp") | ||
| 202 | (tramp-remote-sh "/bin/sh") | ||
| 203 | (tramp-rsh-args ("-1" "-e" "none")) | ||
| 204 | (tramp-rcp-args ("-1")) | ||
| 205 | (tramp-rcp-keep-date-arg "-p") | ||
| 206 | (tramp-su-program nil) | ||
| 207 | (tramp-su-args nil) | ||
| 208 | (tramp-encoding-command nil) | ||
| 209 | (tramp-decoding-command nil) | ||
| 210 | (tramp-encoding-function nil) | ||
| 211 | (tramp-decoding-function nil) | ||
| 212 | (tramp-telnet-program nil) | ||
| 213 | (tramp-telnet-args nil)) | ||
| 214 | ("scp2" (tramp-connection-function tramp-open-connection-rsh) | ||
| 215 | (tramp-rsh-program "ssh") | ||
| 216 | (tramp-rcp-program "scp") | ||
| 217 | (tramp-remote-sh "/bin/sh") | ||
| 218 | (tramp-rsh-args ("-2" "-e" "none")) | ||
| 219 | (tramp-rcp-args ("-2")) | ||
| 220 | (tramp-rcp-keep-date-arg "-p") | ||
| 221 | (tramp-su-program nil) | ||
| 222 | (tramp-su-args nil) | ||
| 223 | (tramp-encoding-command nil) | ||
| 224 | (tramp-decoding-command nil) | ||
| 225 | (tramp-encoding-function nil) | ||
| 226 | (tramp-decoding-function nil) | ||
| 227 | (tramp-telnet-program nil) | ||
| 228 | (tramp-telnet-args nil)) | ||
| 229 | ("scp-ssh1" (tramp-connection-function tramp-open-connection-rsh) | ||
| 181 | (tramp-rsh-program "ssh1") | 230 | (tramp-rsh-program "ssh1") |
| 182 | (tramp-rcp-program "scp1") | 231 | (tramp-rcp-program "scp1") |
| 183 | (tramp-remote-sh "/bin/sh") | 232 | (tramp-remote-sh "/bin/sh") |
| @@ -192,7 +241,7 @@ use for the remote host." | |||
| 192 | (tramp-decoding-function nil) | 241 | (tramp-decoding-function nil) |
| 193 | (tramp-telnet-program nil) | 242 | (tramp-telnet-program nil) |
| 194 | (tramp-telnet-args nil)) | 243 | (tramp-telnet-args nil)) |
| 195 | ("scp2" (tramp-connection-function tramp-open-connection-rsh) | 244 | ("scp-ssh2" (tramp-connection-function tramp-open-connection-rsh) |
| 196 | (tramp-rsh-program "ssh2") | 245 | (tramp-rsh-program "ssh2") |
| 197 | (tramp-rcp-program "scp2") | 246 | (tramp-rcp-program "scp2") |
| 198 | (tramp-remote-sh "/bin/sh") | 247 | (tramp-remote-sh "/bin/sh") |
| @@ -255,6 +304,38 @@ use for the remote host." | |||
| 255 | (tramp-telnet-program nil) | 304 | (tramp-telnet-program nil) |
| 256 | (tramp-telnet-args nil)) | 305 | (tramp-telnet-args nil)) |
| 257 | ("su1" (tramp-connection-function tramp-open-connection-rsh) | 306 | ("su1" (tramp-connection-function tramp-open-connection-rsh) |
| 307 | (tramp-rsh-program "ssh") | ||
| 308 | (tramp-rcp-program nil) | ||
| 309 | (tramp-remote-sh "/bin/sh") | ||
| 310 | (tramp-rsh-args ("-1" "-e" "none")) | ||
| 311 | (tramp-rcp-args ("-1")) | ||
| 312 | (tramp-rcp-keep-date-arg nil) | ||
| 313 | (tramp-su-program nil) | ||
| 314 | (tramp-su-args nil) | ||
| 315 | (tramp-encoding-command "uuencode xxx") | ||
| 316 | (tramp-decoding-command | ||
| 317 | "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )") | ||
| 318 | (tramp-encoding-function nil) | ||
| 319 | (tramp-decoding-function uudecode-decode-region) | ||
| 320 | (tramp-telnet-program nil) | ||
| 321 | (tramp-telnet-args nil)) | ||
| 322 | ("su2" (tramp-connection-function tramp-open-connection-rsh) | ||
| 323 | (tramp-rsh-program "ssh") | ||
| 324 | (tramp-rcp-program nil) | ||
| 325 | (tramp-remote-sh "/bin/sh") | ||
| 326 | (tramp-rsh-args ("-2" "-e" "none")) | ||
| 327 | (tramp-rcp-args ("-2")) | ||
| 328 | (tramp-rcp-keep-date-arg nil) | ||
| 329 | (tramp-su-program nil) | ||
| 330 | (tramp-su-args nil) | ||
| 331 | (tramp-encoding-command "uuencode xxx") | ||
| 332 | (tramp-decoding-command | ||
| 333 | "( uudecode -o - 2>/dev/null || uudecode -p 2>/dev/null )") | ||
| 334 | (tramp-encoding-function nil) | ||
| 335 | (tramp-decoding-function uudecode-decode-region) | ||
| 336 | (tramp-telnet-program nil) | ||
| 337 | (tramp-telnet-args nil)) | ||
| 338 | ("su-ssh1" (tramp-connection-function tramp-open-connection-rsh) | ||
| 258 | (tramp-rsh-program "ssh1") | 339 | (tramp-rsh-program "ssh1") |
| 259 | (tramp-rcp-program nil) | 340 | (tramp-rcp-program nil) |
| 260 | (tramp-remote-sh "/bin/sh") | 341 | (tramp-remote-sh "/bin/sh") |
| @@ -270,7 +351,7 @@ use for the remote host." | |||
| 270 | (tramp-decoding-function uudecode-decode-region) | 351 | (tramp-decoding-function uudecode-decode-region) |
| 271 | (tramp-telnet-program nil) | 352 | (tramp-telnet-program nil) |
| 272 | (tramp-telnet-args nil)) | 353 | (tramp-telnet-args nil)) |
| 273 | ("su2" (tramp-connection-function tramp-open-connection-rsh) | 354 | ("su-ssh2" (tramp-connection-function tramp-open-connection-rsh) |
| 274 | (tramp-rsh-program "ssh2") | 355 | (tramp-rsh-program "ssh2") |
| 275 | (tramp-rcp-program nil) | 356 | (tramp-rcp-program nil) |
| 276 | (tramp-remote-sh "/bin/sh") | 357 | (tramp-remote-sh "/bin/sh") |
| @@ -331,6 +412,36 @@ use for the remote host." | |||
| 331 | (tramp-decoding-function base64-decode-region) | 412 | (tramp-decoding-function base64-decode-region) |
| 332 | (tramp-telnet-program nil)) | 413 | (tramp-telnet-program nil)) |
| 333 | ("sm1" (tramp-connection-function tramp-open-connection-rsh) | 414 | ("sm1" (tramp-connection-function tramp-open-connection-rsh) |
| 415 | (tramp-rsh-program "ssh") | ||
| 416 | (tramp-rcp-program nil) | ||
| 417 | (tramp-remote-sh "/bin/sh") | ||
| 418 | (tramp-rsh-args ("-1" "-e" "none")) | ||
| 419 | (tramp-rcp-args ("-1")) | ||
| 420 | (tramp-rcp-keep-date-arg nil) | ||
| 421 | (tramp-su-program nil) | ||
| 422 | (tramp-su-args nil) | ||
| 423 | (tramp-encoding-command "mimencode -b") | ||
| 424 | (tramp-decoding-command "mimencode -u -b") | ||
| 425 | (tramp-encoding-function base64-encode-region) | ||
| 426 | (tramp-decoding-function base64-decode-region) | ||
| 427 | (tramp-telnet-program nil) | ||
| 428 | (tramp-telnet-args nil)) | ||
| 429 | ("sm2" (tramp-connection-function tramp-open-connection-rsh) | ||
| 430 | (tramp-rsh-program "ssh") | ||
| 431 | (tramp-rcp-program nil) | ||
| 432 | (tramp-remote-sh "/bin/sh") | ||
| 433 | (tramp-rsh-args ("-2" "-e" "none")) | ||
| 434 | (tramp-rcp-args ("-2")) | ||
| 435 | (tramp-rcp-keep-date-arg nil) | ||
| 436 | (tramp-su-program nil) | ||
| 437 | (tramp-su-args nil) | ||
| 438 | (tramp-encoding-command "mimencode -b") | ||
| 439 | (tramp-decoding-command "mimencode -u -b") | ||
| 440 | (tramp-encoding-function base64-encode-region) | ||
| 441 | (tramp-decoding-function base64-decode-region) | ||
| 442 | (tramp-telnet-program nil) | ||
| 443 | (tramp-telnet-args nil)) | ||
| 444 | ("sm-ssh1" (tramp-connection-function tramp-open-connection-rsh) | ||
| 334 | (tramp-rsh-program "ssh1") | 445 | (tramp-rsh-program "ssh1") |
| 335 | (tramp-rcp-program nil) | 446 | (tramp-rcp-program nil) |
| 336 | (tramp-remote-sh "/bin/sh") | 447 | (tramp-remote-sh "/bin/sh") |
| @@ -345,7 +456,7 @@ use for the remote host." | |||
| 345 | (tramp-decoding-function base64-decode-region) | 456 | (tramp-decoding-function base64-decode-region) |
| 346 | (tramp-telnet-program nil) | 457 | (tramp-telnet-program nil) |
| 347 | (tramp-telnet-args nil)) | 458 | (tramp-telnet-args nil)) |
| 348 | ("sm2" (tramp-connection-function tramp-open-connection-rsh) | 459 | ("sm-ssh2" (tramp-connection-function tramp-open-connection-rsh) |
| 349 | (tramp-rsh-program "ssh2") | 460 | (tramp-rsh-program "ssh2") |
| 350 | (tramp-rcp-program nil) | 461 | (tramp-rcp-program nil) |
| 351 | (tramp-remote-sh "/bin/sh") | 462 | (tramp-remote-sh "/bin/sh") |
| @@ -1032,7 +1143,7 @@ Also see `tramp-make-tramp-file-format', `tramp-file-name-structure', and `tramp | |||
| 1032 | Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp. | 1143 | Emacs (not XEmacs) uses a unified filename syntax for Ange-FTP and Tramp. |
| 1033 | See `tramp-file-name-structure-unified' for details.") | 1144 | See `tramp-file-name-structure-unified' for details.") |
| 1034 | 1145 | ||
| 1035 | (defconst tramp-file-name-structure-separate | 1146 | (defconst tramp-multi-file-name-structure-separate |
| 1036 | (list (concat | 1147 | (list (concat |
| 1037 | ;; prefix | 1148 | ;; prefix |
| 1038 | "\\`/\\[\\(\\([a-z0-9]+\\)?\\)" | 1149 | "\\`/\\[\\(\\([a-z0-9]+\\)?\\)" |
| @@ -2287,80 +2398,73 @@ and `rename'. FILENAME and NEWNAME must be absolute file names." | |||
| 2287 | (when (file-exists-p newname) | 2398 | (when (file-exists-p newname) |
| 2288 | (signal 'file-already-exists | 2399 | (signal 'file-already-exists |
| 2289 | (list newname)))) | 2400 | (list newname)))) |
| 2290 | (with-parsed-tramp-file-name filename v1 | 2401 | (let ((t1 (tramp-tramp-file-p filename)) |
| 2291 | (with-parsed-tramp-file-name newname v2 | 2402 | (t2 (tramp-tramp-file-p newname))) |
| 2292 | (when (and (tramp-ange-ftp-file-name-p v1-multi-method v1-method) | 2403 | ;; Check which ones of source and target are Tramp files. |
| 2293 | (tramp-ange-ftp-file-name-p v2-multi-method v2-method)) | 2404 | (cond |
| 2294 | (tramp-invoke-ange-ftp | 2405 | ((and t1 t2) |
| 2295 | (if (eq op 'copy) 'copy-file 'rename-file) | 2406 | ;; Both are Tramp files. |
| 2296 | filename newname ok-if-already-exists keep-date)) | 2407 | (with-parsed-tramp-file-name filename v1 |
| 2297 | (let* ((mmeth (tramp-file-name-multi-method (or v1 v2))) | 2408 | (with-parsed-tramp-file-name newname v2 |
| 2298 | (meth (tramp-file-name-method (or v1 v2))) | 2409 | ;; Possibly invoke Ange-FTP. |
| 2299 | (rcp-program (tramp-get-rcp-program mmeth meth)) | 2410 | (when (and (tramp-ange-ftp-file-name-p v1-multi-method v1-method) |
| 2300 | (rcp-args (tramp-get-rcp-args mmeth meth)) | 2411 | (tramp-ange-ftp-file-name-p v2-multi-method v2-method)) |
| 2301 | (trampbuf (get-buffer-create "*tramp output*"))) | 2412 | (tramp-invoke-ange-ftp |
| 2302 | ;; Check if we can use a shortcut. | 2413 | (if (eq op 'copy) 'copy-file 'rename-file) |
| 2303 | (if (and v1-method v2-method | 2414 | filename newname ok-if-already-exists keep-date)) |
| 2304 | (equal v1-multi-method v2-multi-method) | 2415 | ;; Check if we can use a shortcut. |
| 2305 | (equal v1-method v2-method) | 2416 | (if (and (equal v1-multi-method v2-multi-method) |
| 2306 | (equal v1-host v2-host) | 2417 | (equal v1-method v2-method) |
| 2307 | (equal v1-user v2-user)) | 2418 | (equal v1-host v2-host) |
| 2308 | ;; Shortcut: if method, host, user are the same for both | 2419 | (equal v1-user v2-user)) |
| 2309 | ;; files, we invoke `cp' or `mv' on the remote host directly. | 2420 | ;; Shortcut: if method, host, user are the same for both |
| 2310 | (tramp-do-copy-or-rename-file-directly | 2421 | ;; files, we invoke `cp' or `mv' on the remote host |
| 2311 | op | 2422 | ;; directly. |
| 2312 | v1-multi-method v1-method v1-user v1-host v1-path v2-path | 2423 | (tramp-do-copy-or-rename-file-directly |
| 2313 | keep-date) | 2424 | op v1-multi-method v1-method v1-user v1-host |
| 2314 | ;; New algorithm: copy file first. Then, if operation is | 2425 | v1-path v2-path keep-date) |
| 2315 | ;; `rename', go back and delete the original file if the copy | 2426 | ;; The shortcut was not possible. So we copy the |
| 2316 | ;; was successful. | 2427 | ;; file first. If the operation was `rename', we go |
| 2317 | (if rcp-program | 2428 | ;; back and delete the original file (if the copy was |
| 2318 | ;; The following code uses a tramp program to copy the file. | 2429 | ;; successful). The approach is simple-minded: we |
| 2319 | (let ((f1 (if (not v1) | 2430 | ;; create a new buffer, insert the contents of the |
| 2320 | filename | 2431 | ;; source file into it, then write out the buffer to |
| 2321 | (tramp-make-rcp-program-file-name | 2432 | ;; the target file. The advantage is that it doesn't |
| 2322 | v1-user v1-host | 2433 | ;; matter which filename handlers are used for the |
| 2323 | (tramp-shell-quote-argument v1-path)))) | 2434 | ;; source and target file. |
| 2324 | (f2 (if (not v2) | 2435 | |
| 2325 | newname | 2436 | ;; CCC: If both source and target are Tramp files, |
| 2326 | (tramp-make-rcp-program-file-name | 2437 | ;; and both are using the same rcp-program, then we |
| 2327 | v2-user v2-host | 2438 | ;; can invoke rcp directly. Note that |
| 2328 | (tramp-shell-quote-argument v2-path)))) | 2439 | ;; default-directory should point to a local |
| 2329 | (default-directory | 2440 | ;; directory if we want to invoke rcp. |
| 2330 | (if (tramp-tramp-file-p default-directory) | 2441 | (tramp-do-copy-or-rename-via-buffer |
| 2331 | (tramp-temporary-file-directory) | 2442 | op filename newname keep-date))))) |
| 2332 | default-directory))) | 2443 | ((or t1 t2) |
| 2333 | (when keep-date | 2444 | ;; Use the generic method via a Tramp buffer. |
| 2334 | (add-to-list 'rcp-args | 2445 | (tramp-do-copy-or-rename-via-buffer op filename newname keep-date)) |
| 2335 | (tramp-get-rcp-keep-date-arg mmeth meth))) | 2446 | (t |
| 2336 | (save-excursion (set-buffer trampbuf) (erase-buffer)) | 2447 | ;; One of them must be a Tramp file. |
| 2337 | (unless (equal 0 (apply #'call-process | 2448 | (error "Tramp implementation says this cannot happen"))))) |
| 2338 | (tramp-get-rcp-program mmeth meth) | 2449 | |
| 2339 | nil trampbuf nil | 2450 | (defun tramp-do-copy-or-rename-via-buffer (op filename newname keep-date) |
| 2340 | (append rcp-args (list f1 f2)))) | 2451 | "Use an Emacs buffer to copy or rename a file. |
| 2341 | (pop-to-buffer trampbuf) | 2452 | First arg OP is either `copy' or `rename' and indicates the operation. |
| 2342 | (error (concat "tramp-do-copy-or-rename-file: %s" | 2453 | FILENAME is the source file, NEWNAME the target file. |
| 2343 | " didn't work, see buffer `%s' for details") | 2454 | KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME." |
| 2344 | (tramp-get-rcp-program mmeth meth) trampbuf))) | 2455 | (let ((trampbuf (get-buffer-create "*tramp output*"))) |
| 2345 | ;; The following code uses an inline method for copying. | 2456 | (when keep-date |
| 2346 | ;; Let's start with a simple-minded approach: we create a new | 2457 | (tramp-message |
| 2347 | ;; buffer, insert the contents of the source file into it, | 2458 | 1 (concat "Warning: cannot preserve file time stamp" |
| 2348 | ;; then write out the buffer. This should work fine, whether | 2459 | " with inline copying across machines"))) |
| 2349 | ;; the source or the target files are tramp files. | 2460 | (save-excursion |
| 2350 | ;; CCC TODO: error checking | 2461 | (set-buffer trampbuf) (erase-buffer) |
| 2351 | (when keep-date | 2462 | (insert-file-contents-literally filename) |
| 2352 | (tramp-message | 2463 | (let ((coding-system-for-write 'no-conversion)) |
| 2353 | 1 (concat "Warning: cannot preserve file time stamp" | 2464 | (write-region (point-min) (point-max) newname))) |
| 2354 | " with inline copying across machines"))) | 2465 | ;; If the operation was `rename', delete the original file. |
| 2355 | (save-excursion | 2466 | (unless (eq op 'copy) |
| 2356 | (set-buffer trampbuf) (erase-buffer) | 2467 | (delete-file filename)))) |
| 2357 | (insert-file-contents-literally filename) | ||
| 2358 | (let ((coding-system-for-write 'no-conversion)) | ||
| 2359 | (write-region (point-min) (point-max) newname)))) | ||
| 2360 | |||
| 2361 | ;; If the operation was `rename', delete the original file. | ||
| 2362 | (unless (eq op 'copy) | ||
| 2363 | (delete-file filename))))))) | ||
| 2364 | 2468 | ||
| 2365 | (defun tramp-do-copy-or-rename-file-directly | 2469 | (defun tramp-do-copy-or-rename-file-directly |
| 2366 | (op multi-method method user host path1 path2 keep-date) | 2470 | (op multi-method method user host path1 path2 keep-date) |
| @@ -3771,8 +3875,7 @@ at all unlikely that this variable is set up wrongly!" | |||
| 3771 | (tramp-get-su-program multi-method method) | 3875 | (tramp-get-su-program multi-method method) |
| 3772 | (mapcar | 3876 | (mapcar |
| 3773 | '(lambda (x) | 3877 | '(lambda (x) |
| 3774 | (format-spec | 3878 | (format-spec x `((?u ,user)))) |
| 3775 | x (list (cons ?u user)))) | ||
| 3776 | (tramp-get-su-args multi-method method)))) | 3879 | (tramp-get-su-args multi-method method)))) |
| 3777 | (found nil) | 3880 | (found nil) |
| 3778 | (pw nil)) | 3881 | (pw nil)) |
| @@ -3847,7 +3950,7 @@ log in as u2 to h2." | |||
| 3847 | tramp-dos-coding-system)) | 3950 | tramp-dos-coding-system)) |
| 3848 | (p (start-process (tramp-buffer-name multi-method method user host) | 3951 | (p (start-process (tramp-buffer-name multi-method method user host) |
| 3849 | (tramp-get-buffer multi-method method user host) | 3952 | (tramp-get-buffer multi-method method user host) |
| 3850 | tramp-sh-program)) | 3953 | tramp-multi-sh-program)) |
| 3851 | (num-hops (length method)) | 3954 | (num-hops (length method)) |
| 3852 | (i 0)) | 3955 | (i 0)) |
| 3853 | (process-kill-without-query p) | 3956 | (process-kill-without-query p) |
| @@ -3887,10 +3990,8 @@ set in `tramp-rsh-end-of-line'. Use `%%' if you want a literal percent | |||
| 3887 | character. | 3990 | character. |
| 3888 | 3991 | ||
| 3889 | If USER is nil, uses the return value of (user-login-name) instead." | 3992 | If USER is nil, uses the return value of (user-login-name) instead." |
| 3890 | (let ((cmd (format-spec command (list (cons ?h host) | 3993 | (let ((cmd (format-spec command `((?h ,host) (?n ,tramp-rsh-end-of-line)))) |
| 3891 | (cons ?n tramp-rsh-end-of-line)))) | 3994 | (cmd1 (format-spec command `((?h ,host) (?n "")))) |
| 3892 | (cmd1 (format-spec command (list (cons ?h host) | ||
| 3893 | (cons ?n "")))) | ||
| 3894 | found pw) | 3995 | found pw) |
| 3895 | (erase-buffer) | 3996 | (erase-buffer) |
| 3896 | (tramp-message 9 "Sending telnet command `%s'" cmd1) | 3997 | (tramp-message 9 "Sending telnet command `%s'" cmd1) |
| @@ -3939,12 +4040,12 @@ will be replaced with the value of `tramp-rsh-end-of-line'. You can use | |||
| 3939 | `%%' if you want to use a literal percent character. | 4040 | `%%' if you want to use a literal percent character. |
| 3940 | 4041 | ||
| 3941 | If USER is nil, uses the return value of (user-login-name) instead." | 4042 | If USER is nil, uses the return value of (user-login-name) instead." |
| 3942 | (let ((cmd (format-spec command (list (cons ?h host) | 4043 | (let ((cmd (format-spec command `((?h ,host) |
| 3943 | (cons ?u (or user (user-login-name))) | 4044 | (?u ,(or user (user-login-name))) |
| 3944 | (cons ?n tramp-rsh-end-of-line)))) | 4045 | (?n ,tramp-rsh-end-of-line)))) |
| 3945 | (cmd1 (format-spec command (list (cons ?h host) | 4046 | (cmd1 (format-spec command `((?h ,host) |
| 3946 | (cons ?u (or user (user-login-name))) | 4047 | (?u ,(or user (user-login-name))) |
| 3947 | (cons ?n "")))) | 4048 | (?n "")))) |
| 3948 | found) | 4049 | found) |
| 3949 | (erase-buffer) | 4050 | (erase-buffer) |
| 3950 | (tramp-message 9 "Sending rlogin command `%s'" cmd1) | 4051 | (tramp-message 9 "Sending rlogin command `%s'" cmd1) |
| @@ -3992,10 +4093,10 @@ You can use percent escapes in the COMMAND. `%u' is replaced with the | |||
| 3992 | user name, and `%n' is replaced with the value of | 4093 | user name, and `%n' is replaced with the value of |
| 3993 | `tramp-rsh-end-of-line'. Use `%%' if you want a literal percent | 4094 | `tramp-rsh-end-of-line'. Use `%%' if you want a literal percent |
| 3994 | character." | 4095 | character." |
| 3995 | (let ((cmd (format-spec command (list (cons ?u (or user (user-login-name))) | 4096 | (let ((cmd (format-spec command `((?u ,(or user (user-login-name))) |
| 3996 | (cons ?n tramp-rsh-end-of-line)))) | 4097 | (?n ,tramp-rsh-end-of-line)))) |
| 3997 | (cmd1 (format-spec command (list (cons ?u (or user (user-login-name))) | 4098 | (cmd1 (format-spec command `((?u ,(or user (user-login-name))) |
| 3998 | (cons ?n "")))) | 4099 | (?n "")))) |
| 3999 | found) | 4100 | found) |
| 4000 | (erase-buffer) | 4101 | (erase-buffer) |
| 4001 | (tramp-message 9 "Sending su command `%s'" cmd1) | 4102 | (tramp-message 9 "Sending su command `%s'" cmd1) |
| @@ -4826,14 +4927,9 @@ remote path name." | |||
| 4826 | (tramp-make-tramp-multi-file-name multi-method method user host path) | 4927 | (tramp-make-tramp-multi-file-name multi-method method user host path) |
| 4827 | (if user | 4928 | (if user |
| 4828 | (format-spec tramp-make-tramp-file-format | 4929 | (format-spec tramp-make-tramp-file-format |
| 4829 | (list (cons ?m method) | 4930 | `((?m ,method) (?u ,user) (?h ,host) (?p ,path))) |
| 4830 | (cons ?u user) | ||
| 4831 | (cons ?h host) | ||
| 4832 | (cons ?p path))) | ||
| 4833 | (format-spec tramp-make-tramp-file-user-nil-format | 4931 | (format-spec tramp-make-tramp-file-user-nil-format |
| 4834 | (list (cons ?m method) | 4932 | `((?m ,method) (?h ,host) (?p ,path)))))) |
| 4835 | (cons ?h host) | ||
| 4836 | (cons ?p path)))))) | ||
| 4837 | 4933 | ||
| 4838 | ;; CCC: Henrik Holm: Not Changed. Multi Method. What should be done | 4934 | ;; CCC: Henrik Holm: Not Changed. Multi Method. What should be done |
| 4839 | ;; with this when USER is nil? | 4935 | ;; with this when USER is nil? |
| @@ -4844,21 +4940,15 @@ remote path name." | |||
| 4844 | (let* ((prefix-format (nth 0 tramp-make-multi-tramp-file-format)) | 4940 | (let* ((prefix-format (nth 0 tramp-make-multi-tramp-file-format)) |
| 4845 | (hop-format (nth 1 tramp-make-multi-tramp-file-format)) | 4941 | (hop-format (nth 1 tramp-make-multi-tramp-file-format)) |
| 4846 | (path-format (nth 2 tramp-make-multi-tramp-file-format)) | 4942 | (path-format (nth 2 tramp-make-multi-tramp-file-format)) |
| 4847 | (prefix (format-spec prefix-format (list (cons ?m multi-method)))) | 4943 | (prefix (format-spec prefix-format `((?m ,multi-method)))) |
| 4848 | (hops "") | 4944 | (hops "") |
| 4849 | (path (format-spec path-format (list (cons ?p path)))) | 4945 | (path (format-spec path-format `((?p ,path)))) |
| 4850 | (i 0) | 4946 | (i 0) |
| 4851 | (len (length method))) | 4947 | (len (length method))) |
| 4852 | (while (< i len) | 4948 | (while (< i len) |
| 4853 | (let ((m (aref method i)) | 4949 | (let ((m (aref method i)) (u (aref user i)) (h (aref host i))) |
| 4854 | (u (aref user i)) | 4950 | (setq hops (concat hops (format-spec hop-format |
| 4855 | (h (aref host i))) | 4951 | `((?m ,m) (?u ,u) (?h ,h))))) |
| 4856 | (setq hops (concat hops | ||
| 4857 | (format-spec | ||
| 4858 | hop-format | ||
| 4859 | (list (cons ?m m) | ||
| 4860 | (cons ?u u) | ||
| 4861 | (cons ?h h))))) | ||
| 4862 | (incf i))) | 4952 | (incf i))) |
| 4863 | (concat prefix hops path))) | 4953 | (concat prefix hops path))) |
| 4864 | 4954 | ||
diff --git a/man/tramp.texi b/man/tramp.texi index d27f6c942cf..5b764386eab 100644 --- a/man/tramp.texi +++ b/man/tramp.texi | |||
| @@ -632,9 +632,16 @@ transfer files between the machines. | |||
| 632 | This is identical to the previous option except that the @command{ssh} | 632 | This is identical to the previous option except that the @command{ssh} |
| 633 | package is used, making the connection more secure. | 633 | package is used, making the connection more secure. |
| 634 | 634 | ||
| 635 | There are also two variants, @option{sm1} and @option{sm2} that use the | 635 | There are also two variants, @option{sm1} and @option{sm2}, that call |
| 636 | @command{ssh1} and @command{ssh2} commands explicitly. If you don't know | 636 | @samp{ssh -1} and @samp{ssh -2}, respectively. This way, you can |
| 637 | what these are, you do not need these options. | 637 | explicitly select whether you want to use the SSH protocol version 1 |
| 638 | or 2 to connect to the remote host. (You can also specify in | ||
| 639 | @file{~/.ssh/config}, the SSH configuration file, which protocol | ||
| 640 | should be used, and use the regular @option{sm} method.) | ||
| 641 | |||
| 642 | There are also two variants, @option{sm-ssh1} and @option{sm-ssh2} | ||
| 643 | that use the @command{ssh1} and @command{ssh2} commands explicitly. If | ||
| 644 | you don't know what these are, you do not need these options. | ||
| 638 | 645 | ||
| 639 | All the methods based on @command{ssh} have an additional kludgy | 646 | All the methods based on @command{ssh} have an additional kludgy |
| 640 | feature: you can specify a host name which looks like @file{host#42} | 647 | feature: you can specify a host name which looks like @file{host#42} |
| @@ -683,7 +690,8 @@ between the machines. | |||
| 683 | 690 | ||
| 684 | As with the @command{ssh} and base64 option (@option{sm}) above, this | 691 | As with the @command{ssh} and base64 option (@option{sm}) above, this |
| 685 | provides the @option{su1} and @option{su2} methods to explicitly | 692 | provides the @option{su1} and @option{su2} methods to explicitly |
| 686 | select an ssh version. | 693 | select an SSH protocol version, and the @option{su-ssh1} and |
| 694 | @option{su-ssh2} variants to call specific SSH binaries. | ||
| 687 | 695 | ||
| 688 | Note that this method does not invoke the @command{su} program, see | 696 | Note that this method does not invoke the @command{su} program, see |
| 689 | below for methods which use that. | 697 | below for methods which use that. |