# HG changeset patch # User Kai Grojohann # Date 1032702914 0 # Node ID 20336ef6b20a9588a30cb62e524e68e64ca7a6d9 # Parent b31c8ab7336afd2dad2dd4ebb023edee4fc14d20 Version 2.0.21 released. (tramp-handle-file-newer-than-file-p): If mtime of both files is known, return a useful result. Better error message in case one is a Tramp file and one isn't. (tramp-handle-file-local-copy, tramp-handle-write-region) (tramp-find-shell, tramp-open-connection-telnet) (tramp-open-connection-rsh, tramp-open-connection-su) (tramp-open-connection-setup-interactive-shell) (tramp-post-connection, tramp-maybe-open-connection) (tramp-method-out-of-band-p): Correct number of args for `tramp-get-rsh-program' and similar functions. diff -r b31c8ab7336a -r 20336ef6b20a lisp/ChangeLog --- a/lisp/ChangeLog Sun Sep 22 13:23:36 2002 +0000 +++ b/lisp/ChangeLog Sun Sep 22 13:55:14 2002 +0000 @@ -1,6 +1,20 @@ +2002-09-22 Kai Gro,b_(Bjohann + + * net/tramp.el: Version 2.0.21 released. + (tramp-handle-file-newer-than-file-p): If mtime of both files is + known, return a useful result. Better error message in case one + is a Tramp file and one isn't. + (tramp-handle-file-local-copy, tramp-handle-write-region) + (tramp-find-shell, tramp-open-connection-telnet) + (tramp-open-connection-rsh, tramp-open-connection-su) + (tramp-open-connection-setup-interactive-shell) + (tramp-post-connection, tramp-maybe-open-connection) + (tramp-method-out-of-band-p): Correct number of args for + `tramp-get-rsh-program' and similar functions. + 2002-09-22 Kai Gro,b_(Bjohann - Version 2.0.20 released. + * net/tramp.el: Version 2.0.20 released. 2002-09-20 Kai Gro,b_(Bjohann diff -r b31c8ab7336a -r 20336ef6b20a lisp/net/tramp.el --- a/lisp/net/tramp.el Sun Sep 22 13:23:36 2002 +0000 +++ b/lisp/net/tramp.el Sun Sep 22 13:55:14 2002 +0000 @@ -72,7 +72,7 @@ ;; In the Tramp CVS repository, the version numer is auto-frobbed from ;; the Makefile, so you should edit the top-level Makefile to change ;; the version number. -(defconst tramp-version "2.0.20" +(defconst tramp-version "2.0.21" "This version of tramp.") (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" @@ -2173,33 +2173,54 @@ nil) ((not (file-exists-p file2)) t) - ;; We are sure both files exist at this point. We assume that - ;; both files are Tramp files, otherwise we issue an error - ;; message. Todo: make a better error message. + ;; We are sure both files exist at this point. (t (save-excursion - (with-parsed-tramp-file-name file1 v1 - (with-parsed-tramp-file-name file2 v2 - (when (and (tramp-ange-ftp-file-name-p v1-multi-method v1-method) - (tramp-ange-ftp-file-name-p v2-multi-method v2-method)) - (tramp-invoke-ange-ftp 'file-newer-than-file-p - file1 file2)) - (unless (and (equal v1-multi-method v2-multi-method) - (equal v1-method v2-method) - (equal v1-user v2-user) - (equal v1-host v2-host)) - (signal 'file-error - (list "Files must have same method, user, host" - file1 file2))) + ;; We try to get the mtime of both files. If they are not + ;; equal to the "dont-know" value, then we subtract the times + ;; and obtain the result. + (let ((fa1 (file-attributes file1)) + (fa2 (file-attributes file2))) + (if (and (not (equal (nth 5 fa1) '(0 0))) + (not (equal (nth 5 fa2) '(0 0)))) + (> 0 (car (subtract-time (nth 5 fa1) (nth 5 fa2)))) + ;; If one of them is the dont-know value, then we can + ;; still try to run a shell command on the remote host. + ;; However, this only works if both files are Tramp + ;; files and both have the same method, same user, same + ;; host. (unless (and (tramp-tramp-file-p file1) (tramp-tramp-file-p file2)) - (signal 'file-error - (list "Files must be tramp files on same host" - file1 file2))) - (if (tramp-get-test-groks-nt - v1-multi-method v1-method v1-user v1-host) - (zerop (tramp-run-test2 "test" file1 file2 "-nt")) - (zerop (tramp-run-test2 "tramp_test_nt" file1 file2))))))))) + (signal + 'file-error + (list + "Cannot check if Tramp file is newer than non-Tramp file" + file1 file2))) + (with-parsed-tramp-file-name file1 v1 + (with-parsed-tramp-file-name file2 v2 + (when (and (tramp-ange-ftp-file-name-p + v1-multi-method v1-method) + (tramp-ange-ftp-file-name-p + v2-multi-method v2-method)) + (tramp-invoke-ange-ftp 'file-newer-than-file-p + file1 file2)) + (unless (and (equal v1-multi-method v2-multi-method) + (equal v1-method v2-method) + (equal v1-user v2-user) + (equal v1-host v2-host)) + (signal 'file-error + (list "Files must have same method, user, host" + file1 file2))) + (unless (and (tramp-tramp-file-p file1) + (tramp-tramp-file-p file2)) + (signal 'file-error + (list "Files must be tramp files on same host" + file1 file2))) + (if (tramp-get-test-groks-nt + v1-multi-method v1-method v1-user v1-host) + (zerop (tramp-run-test2 "test" file1 file2 "-nt")) + (zerop (tramp-run-test2 + "tramp_test_nt" file1 file2))))))))))) ;; Functions implemented using the basic functions above. @@ -2952,10 +2973,12 @@ (let ((trampbuf (get-buffer-create "*tramp output*")) (rcp-program (tramp-get-rcp-program multi-method - (tramp-find-method multi-method method user host))) + (tramp-find-method multi-method method user host) + user host)) (rcp-args (tramp-get-rcp-args multi-method - (tramp-find-method multi-method method user host))) + (tramp-find-method multi-method method user host) + user host)) tmpfil) (unless (file-exists-p filename) (error "Cannot make local copy of non-existing file `%s'" @@ -3122,10 +3145,12 @@ start end filename append visit)) (let ((curbuf (current-buffer)) (rcp-program (tramp-get-rcp-program - multi-method (tramp-find-method multi-method method user host))) + multi-method (tramp-find-method multi-method method user host) + user host)) (rcp-args (tramp-get-rcp-args multi-method - (tramp-find-method multi-method method user host))) + (tramp-find-method multi-method method user host) + user host)) (rem-enc (tramp-get-remote-encoding 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)) @@ -4227,7 +4252,7 @@ 9 "Setting remote shell prompt...done") ) (t (tramp-message 5 "Remote `%s' groks tilde expansion, good" - (tramp-get-remote-sh multi-method method)))))) + (tramp-get-remote-sh multi-method method user host)))))) (defun tramp-check-ls-command (multi-method method user host cmd) "Checks whether the given `ls' executable groks `-n'. @@ -4481,11 +4506,13 @@ (tramp-get-buffer multi-method method user host) (tramp-get-telnet-program multi-method - (tramp-find-method multi-method method user host)) + (tramp-find-method multi-method method user host) + user host) host (tramp-get-telnet-args multi-method - (tramp-find-method multi-method method user host)))) + (tramp-find-method multi-method method user host) + user host))) (found nil) (pw nil)) (process-kill-without-query p) @@ -4536,10 +4563,12 @@ (buf (tramp-get-buffer multi-method method user host)) (rsh-program (tramp-get-rsh-program multi-method - (tramp-find-method multi-method method user host))) + (tramp-find-method multi-method method user host) + user host)) (rsh-args (tramp-get-rsh-args multi-method - (tramp-find-method multi-method method user host)))) + (tramp-find-method multi-method method user host) + user host))) ;; The following should be changed. We need a more general ;; mechanism to parse extra host args. (when (string-match "\\([^#]*\\)#\\(.*\\)" host) @@ -4609,13 +4638,15 @@ (tramp-get-buffer multi-method method user host) (tramp-get-su-program multi-method - (tramp-find-method multi-method method user host)) + (tramp-find-method multi-method method user host) + user host) (mapcar '(lambda (x) (format-spec x `((?u . ,(or user "root"))))) (tramp-get-su-args multi-method - (tramp-find-method multi-method method user host))))) + (tramp-find-method multi-method method user host) + user host)))) (found nil) (pw nil)) (process-kill-without-query p) @@ -4857,7 +4888,8 @@ ;; Pittman reports that the unusual positioning of the single quotes ;; makes it work under `rc', too. (process-send-string nil (format "exec env 'PS1=$ ' %s%s" - (tramp-get-remote-sh multi-method method) + (tramp-get-remote-sh + multi-method method user host) tramp-rsh-end-of-line)) (when tramp-debug-buffer (save-excursion @@ -4865,15 +4897,16 @@ (goto-char (point-max)) (tramp-insert-with-face 'bold (format "$ exec env PS1='$ ' %s\n" - (tramp-get-remote-sh multi-method method))))) + (tramp-get-remote-sh multi-method method user host))))) (tramp-message 9 "Waiting 30s for remote `%s' to come up..." - (tramp-get-remote-sh multi-method method)) + (tramp-get-remote-sh multi-method method user host)) (unless (tramp-wait-for-regexp p 30 (format "\\(%s\\|%s\\)\\'" shell-prompt-pattern tramp-shell-prompt-pattern)) (pop-to-buffer (buffer-name)) (error "Remote `%s' didn't come up. See buffer `%s' for details" - (tramp-get-remote-sh multi-method method) (buffer-name))) + (tramp-get-remote-sh multi-method method user host) + (buffer-name))) (tramp-message 9 "Setting up remote shell environment") (tramp-discard-garbage-erase-buffer p multi-method method user host) (process-send-string @@ -5099,7 +5132,8 @@ (tramp-wait-for-output) (unless (tramp-get-rcp-program multi-method - (tramp-find-method multi-method method user host)) + (tramp-find-method multi-method method user host) + user host) (tramp-message 5 "Sending the Perl `mime-encode' implementations.") (tramp-send-linewise multi-method method user host @@ -5140,7 +5174,8 @@ ;; Find the right encoding/decoding commands to use. (unless (tramp-get-rcp-program multi-method - (tramp-find-method multi-method method user host)) + (tramp-find-method multi-method method user host) + user host) (tramp-find-inline-encoding multi-method method user host)) ;; 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 @@ -5345,7 +5380,8 @@ (delete-process p)) (funcall (tramp-get-connection-function multi-method - (tramp-find-method multi-method method user host)) + (tramp-find-method multi-method method user host) + user host) multi-method method user host)))) (defun tramp-send-command @@ -5835,7 +5871,8 @@ to enter a password for the `tramp-rcp-program'." (tramp-get-rcp-program multi-method - (tramp-find-method multi-method method user host))) + (tramp-find-method multi-method method user host) + user host)) ;; Variables local to connection. diff -r b31c8ab7336a -r 20336ef6b20a man/tramp.texi --- a/man/tramp.texi Sun Sep 22 13:23:36 2002 +0000 +++ b/man/tramp.texi Sun Sep 22 13:55:14 2002 +0000 @@ -12,7 +12,7 @@ @c Makefile, so you should edit the top-level Makefile to change @c the version number. @macro trampver{} -2.0.20 +2.0.21 @end macro @c Entries for @command{install-info} to use