From dba28077d303d2afb44f2b8ea05e99c935d1636f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kai=20Gro=C3=9Fjohann?= Date: Mon, 2 Sep 2002 12:53:12 +0000 Subject: [PATCH] * net/tramp.el: Version 2.0.15 released. (require 'base64): Most modern Emacsen have the base64 encode/decode functions built in, so test to see if they are bound before we go blindly requiring base64.el. From Steve Youngs . (tramp-feature-write-region-fix): XEmacs doesn't have a 'find-operation-coding-system' and this variable doesn't seem to be used anywhere so wrap it in (unless (featurep 'xemacs)). From Steve Youngs . (tramp-methods): Remove duplicate definition of ssh1-old and ssh2-old. (tramp-open-connection-su): Use user name "root" if no user name is given. From Michael Albinus : * net/tramp.el (tramp-invoke-ange-ftp): (tramp-ange-ftp-file-name-p): Check for Xemacs. (tramp-do-copy-or-rename-file): Don't pass KEEP-DATE to tramp-invoke-ange-ftp 'rename. (tramp-handle-write-region): Don't pass LOCKNAME and CONFIRM to tramp-invoke-ange-ftp 'write-region. (tramp-handle-set-file-modes): Change order of FILENAME and MODE passing to tramp-invoke-ange-ftp 'set-file-modes. (tramp-invoke-ange-ftp): `tramp-disable-ange-ftp' must be called again after activating `ange-ftp'. --- lisp/ChangeLog | 28 ++++++ lisp/net/tramp.el | 274 +++++++----------------------------------------------- 2 files changed, 61 insertions(+), 241 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8ae2be957ac..7f7e86f114f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,31 @@ +2002-09-02 Kai Gro,b_(Bjohann + + * net/tramp.el: Version 2.0.15 released. + (require 'base64): Most modern Emacsen have the base64 + encode/decode functions built in, so test to see if they are bound + before we go blindly requiring base64.el. From Steve Youngs + . + (tramp-feature-write-region-fix): XEmacs doesn't have a + 'find-operation-coding-system' and this variable doesn't seem to + be used anywhere so wrap it in (unless (featurep 'xemacs)). From + Steve Youngs . + (tramp-methods): Remove duplicate definition of ssh1-old and + ssh2-old. + (tramp-open-connection-su): Use user name "root" if no user name + is given. + + From Michael Albinus : + * net/tramp.el (tramp-invoke-ange-ftp): + (tramp-ange-ftp-file-name-p): Check for Xemacs. + (tramp-do-copy-or-rename-file): Don't pass KEEP-DATE to + tramp-invoke-ange-ftp 'rename. + (tramp-handle-write-region): Don't pass LOCKNAME and CONFIRM to + tramp-invoke-ange-ftp 'write-region. + (tramp-handle-set-file-modes): Change order of FILENAME and MODE + passing to tramp-invoke-ange-ftp 'set-file-modes. + (tramp-invoke-ange-ftp): `tramp-disable-ange-ftp' must be called + again after activating `ange-ftp'. + 2002-09-02 Kim F. Storm * ido.el (ido-ignore-item-temp-list): New variable. diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 700681415e9..fb94491ae0c 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1,4 +1,4 @@ -;;; tramp.el --- Transparent Remote Access, Multiple Protocol -*- coding: iso-8859-1; -*- +;;; tramp.el --- Transparent Remote Access, Multiple Protocol -*- coding: iso-8859-1; -*- ;; Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. @@ -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.14" +(defconst tramp-version "2.0.15" "This version of tramp.") (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" @@ -80,7 +80,12 @@ (require 'timer) (require 'format-spec) ;from Gnus 5.8, also in tar ball -(require 'base64) ;for the mimencode methods +;; The explicit check is not necessary in Emacs, which provides the +;; feature even if implemented in C, but it appears to be necessary +;; in XEmacs. +(unless (and (fboundp 'base64-encode-region) + (fboundp 'base64-decode-region)) + (require 'base64)) ;for the mimencode methods (require 'shell) (require 'advice) @@ -317,30 +322,6 @@ This variable defaults to CMD.EXE on Windows NT, and to the value of (tramp-su-args nil) (tramp-telnet-program nil) (tramp-telnet-args nil)) - ("ssh1-old" - (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh1") - (tramp-rcp-program nil) - (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-e" "none")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) - ("ssh2-old" - (tramp-connection-function tramp-open-connection-rsh) - (tramp-rsh-program "ssh2") - (tramp-rcp-program nil) - (tramp-remote-sh "/bin/sh") - (tramp-rsh-args ("-e" "none")) - (tramp-rcp-args nil) - (tramp-rcp-keep-date-arg nil) - (tramp-su-program nil) - (tramp-su-args nil) - (tramp-telnet-program nil) - (tramp-telnet-args nil)) ("telnet" (tramp-connection-function tramp-open-connection-telnet) (tramp-rsh-program nil) @@ -1414,10 +1395,13 @@ This is used to map a mode number to a permission string.") This variable is buffer-local in every buffer.") (make-variable-buffer-local 'tramp-last-cmd-time) +;; This variable does not have the right value in XEmacs. What should +;; I use instead of find-operation-coding-system in XEmacs? (defvar tramp-feature-write-region-fix - (let ((file-coding-system-alist '(("test" emacs-mule)))) - (find-operation-coding-system 'write-region 0 0 "" nil "test")) - "Internal variable to say if `write-region' chooses the right coding. + (unless (featurep 'xemacs) + (let ((file-coding-system-alist '(("test" emacs-mule)))) + (find-operation-coding-system 'write-region 0 0 "" nil "test"))) + "Internal variable to say if `write-region' chooses the right coding. Older versions of Emacs chose the coding system for `write-region' based on the FILENAME argument, even if VISIT was a string.") @@ -1975,7 +1959,7 @@ if the remote host can't provide the modtime." "Like `set-file-modes' for tramp files." (with-parsed-tramp-file-name filename nil (when (tramp-ange-ftp-file-name-p multi-method method) - (tramp-invoke-ange-ftp 'set-file-modes filename mode)) + (tramp-invoke-ange-ftp 'set-file-modes mode filename)) (save-excursion (unless (zerop (tramp-send-command-and-check multi-method method user host @@ -2374,9 +2358,11 @@ and `rename'. FILENAME and NEWNAME must be absolute file names." ;; Possibly invoke Ange-FTP. (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 - (if (eq op 'copy) 'copy-file 'rename-file) - filename newname ok-if-already-exists keep-date)) + (if (eq op 'copy) + (tramp-invoke-ange-ftp + 'copy-file filename newname ok-if-already-exists keep-date) + (tramp-invoke-ange-ftp + 'rename-file filename newname ok-if-already-exists))) ;; Check if we can use a shortcut. (if (and (equal v1-multi-method v2-multi-method) (equal v1-method v2-method) @@ -2956,7 +2942,7 @@ This will break if COMMAND prints a newline, followed by the value of (with-parsed-tramp-file-name filename nil (when (tramp-ange-ftp-file-name-p multi-method method) (tramp-invoke-ange-ftp 'write-region - start end filename append visit lockname confirm)) + start end filename append visit)) (let ((curbuf (current-buffer)) (rcp-program (tramp-get-rcp-program multi-method method)) (rcp-args (tramp-get-rcp-args multi-method method)) @@ -3228,7 +3214,9 @@ necessary anymore." (defun tramp-invoke-ange-ftp (operation &rest args) "Invoke the Ange-FTP handler function and throw." - (or (boundp 'ange-ftp-name-format) (require 'ange-ftp)) + (or (boundp 'ange-ftp-name-format) + (and (require 'ange-ftp) + (tramp-disable-ange-ftp))) (let ((ange-ftp-name-format (list (nth 0 tramp-file-name-structure) (nth 3 tramp-file-name-structure) @@ -3240,7 +3228,9 @@ necessary anymore." (defun tramp-ange-ftp-file-name-p (multi-method method) "Check if it's a filename that should be forwarded to Ange-FTP." - (and (null multi-method) (string= method tramp-ftp-method))) + (and (not (featurep 'xemacs)) + (null multi-method) + (string= method tramp-ftp-method))) ;;; Interactions with other packages: @@ -3836,42 +3826,6 @@ Maybe the different regular expressions need to be tuned. (erase-buffer) (tramp-process-actions p multi-method method user host tramp-actions-before-shell) - -;; (tramp-message 9 "Waiting for login prompt...") -;; (unless (tramp-wait-for-regexp p nil tramp-login-prompt-regexp) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find remote login prompt")) -;; (erase-buffer) -;; ;; Remote login defaults to local one. -;; (tramp-message 9 "Sending login name %s" (or user (user-login-name))) -;; (process-send-string p (concat (or user (user-login-name)) -;; tramp-rsh-end-of-line)) -;; (tramp-message 9 "Waiting for password prompt...") -;; (unless (setq found (tramp-wait-for-regexp -;; p nil tramp-password-prompt-regexp)) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find remote password prompt")) -;; (erase-buffer) -;; (setq pw (tramp-read-passwd (car found))) -;; (tramp-message 9 "Sending password") -;; (process-send-string p (concat pw tramp-rsh-end-of-line)) -;; (tramp-message 9 "Waiting 30s for remote shell to come up...") -;; (unless (setq found -;; (tramp-wait-for-regexp -;; p 30 (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" -;; tramp-wrong-passwd-regexp -;; shell-prompt-pattern -;; tramp-shell-prompt-pattern))) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find remote shell prompt")) -;; (when (nth 1 found) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Login failed: %s" (nth 1 found))) - (tramp-open-connection-setup-interactive-shell p multi-method method user host) (tramp-post-connection multi-method method user host))))) @@ -3936,45 +3890,6 @@ arguments, and xx will be used as the host name to connect to. (set-buffer buf) (tramp-process-actions p multi-method method user host tramp-actions-before-shell) - -;; (tramp-message 9 "Waiting 60s for shell or passwd prompt from %s" host) -;; (setq found -;; (tramp-wait-for-regexp -;; p 60 -;; (format -;; "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" -;; tramp-password-prompt-regexp -;; shell-prompt-pattern tramp-shell-prompt-pattern))) -;; (unless found -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find remote shell or passwd prompt")) -;; (when (nth 1 found) -;; (when (tramp-method-out-of-band-p multi-method method) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error (concat "Out of band method `%s' not applicable" -;; " for remote shell asking for a password") -;; method)) -;; (erase-buffer) -;; (tramp-message 9 "Sending password...") -;; (tramp-enter-password p (nth 1 found)) -;; (tramp-message 9 "Sent password, waiting 60s for remote shell prompt") -;; (setq found (tramp-wait-for-regexp -;; p 60 -;; (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" -;; tramp-wrong-passwd-regexp -;; shell-prompt-pattern -;; tramp-shell-prompt-pattern)))) -;; (unless found -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find remote shell prompt")) -;; (when (nth 1 found) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Login failed: %s" (nth 1 found))) - (tramp-message 7 "Initializing remote shell") (tramp-open-connection-setup-interactive-shell p multi-method method user host) @@ -4003,10 +3918,9 @@ prompt than you do, so it is not at all unlikely that the variable "Cannot connect to different host `%s' with `su' connection method" host)) (when (not user) - (error "Must give user name for `su' connection method")) + (setq user "root")) (tramp-pre-connection multi-method method user host) - (tramp-message 7 "Opening connection for `%s' using `%s'..." - (or user (user-login-name)) method) + (tramp-message 7 "Opening connection for `%s' using `%s'..." user method) (let ((process-environment (copy-sequence process-environment))) (setenv "TERM" tramp-terminal-type) (let* ((default-directory (tramp-temporary-file-directory)) @@ -4027,37 +3941,6 @@ prompt than you do, so it is not at all unlikely that the variable (set-buffer (tramp-get-buffer multi-method method user host)) (tramp-process-actions p multi-method method user host tramp-actions-before-shell) - -;; (tramp-message 9 "Waiting 30s for shell or password prompt...") -;; (unless (setq found (tramp-wait-for-regexp -;; p 30 -;; (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" -;; tramp-password-prompt-regexp -;; shell-prompt-pattern -;; tramp-shell-prompt-pattern))) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find shell or password prompt")) -;; (when (nth 1 found) -;; (erase-buffer) -;; (setq pw (tramp-read-passwd (car found))) -;; (tramp-message 9 "Sending password") -;; (process-send-string p (concat pw tramp-rsh-end-of-line)) -;; (tramp-message 9 "Waiting 30s for remote shell to come up...") -;; (unless (setq found -;; (tramp-wait-for-regexp -;; p 30 (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" -;; tramp-wrong-passwd-regexp -;; shell-prompt-pattern -;; tramp-shell-prompt-pattern))) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find remote shell prompt")) -;; (when (nth 1 found) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "`su' failed: %s" (nth 1 found)))) - (tramp-open-connection-setup-interactive-shell p multi-method method user host) (tramp-post-connection multi-method method @@ -4120,7 +4003,7 @@ log in as u2 to h2." (entry (assoc m tramp-multi-connection-function-alist)) (multi-func (nth 1 entry)) (command (nth 2 entry))) - ;; The multi-funcs don't need to do save-match-data, as that + ;; The multi-funcs don't need to do save-match-data, as that ;; is done here. (funcall multi-func p m u h command) (erase-buffer) @@ -4150,40 +4033,7 @@ If USER is nil, uses the return value of (user-login-name) instead." (tramp-message 9 "Sending telnet command `%s'" cmd1) (process-send-string p cmd) (tramp-process-multi-actions p method user host - tramp-multi-actions) - -;; (tramp-message 9 "Waiting 30s for login prompt from %s" host) -;; (unless (tramp-wait-for-regexp p 30 tramp-login-prompt-regexp) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find login prompt from host %s" host)) -;; (erase-buffer) -;; (tramp-message 9 "Sending login name %s" (or user (user-login-name))) -;; (process-send-string p (concat (or user (user-login-name)) tramp-rsh-end-of-line)) -;; (tramp-message 9 "Waiting for password prompt") -;; (unless (setq found (tramp-wait-for-regexp p nil tramp-password-prompt-regexp)) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find password prompt from host %s" host)) -;; (erase-buffer) -;; (setq pw (tramp-read-passwd -;; (format "Password for %s@%s, %s" (or user (user-login-name)) host found))) -;; (tramp-message 9 "Sending password") -;; (process-send-string p (concat pw tramp-rsh-end-of-line)) -;; (tramp-message 9 "Waiting 60s for remote shell to come up...") -;; (unless (setq found (tramp-wait-for-regexp -;; p 60 (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" -;; tramp-wrong-passwd-regexp -;; shell-prompt-pattern -;; tramp-shell-prompt-pattern))) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find shell prompt from host %s" host)) -;; (when (nth 1 found) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Login to %s failed: %s" (nth 2 found))) - )) + tramp-multi-actions))) ;; HHH: Changed. Multi method. Don't know how to handle this in the case ;; of no user name provided. Hack to make it work as it did before: @@ -4209,36 +4059,7 @@ If USER is nil, uses the return value of (user-login-name) instead." (tramp-message 9 "Sending rlogin command `%s'" cmd1) (process-send-string p cmd) (tramp-process-multi-actions p method user host - tramp-multi-actions) -;; (tramp-message 9 "Waiting 60s for shell or passwd prompt from %s" host) -;; (unless (setq found -;; (tramp-wait-for-regexp p 60 -;; (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" -;; tramp-password-prompt-regexp -;; shell-prompt-pattern -;; tramp-shell-prompt-pattern))) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find remote shell or passwd prompt")) -;; (when (nth 1 found) -;; (erase-buffer) -;; (tramp-message 9 "Sending password...") -;; (tramp-enter-password p (nth 1 found)) -;; (tramp-message 9 "Sent password, waiting 60s for remote shell prompt") -;; (setq found (tramp-wait-for-regexp p 60 -;; (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" -;; tramp-wrong-passwd-regexp -;; shell-prompt-pattern -;; tramp-shell-prompt-pattern)))) -;; (unless found -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find remote shell prompt")) -;; (when (nth 1 found) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Login failed: %s" (nth 1 found))) - )) + tramp-multi-actions))) ;; HHH: Changed. Multi method. Don't know how to handle this in the case ;; of no user name provided. Hack to make it work as it did before: @@ -4265,36 +4086,7 @@ character." (tramp-message 9 "Sending su command `%s'" cmd1) (process-send-string p cmd) (tramp-process-multi-actions p method user host - tramp-multi-actions) -;; (tramp-message 9 "Waiting 60s for shell or passwd prompt for %s" (or user (user-login-name))) -;; (unless (setq found (tramp-wait-for-regexp -;; p 60 (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" -;; tramp-password-prompt-regexp -;; shell-prompt-pattern -;; tramp-shell-prompt-pattern))) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find shell or passwd prompt for %s" -;; (or user (user-login-name)))) -;; (when (nth 1 found) -;; (tramp-message 9 "Sending password...") -;; (tramp-enter-password p (nth 1 found)) -;; (erase-buffer) -;; (tramp-message 9 "Sent password, waiting 60s for remote shell prompt") -;; (setq found (tramp-wait-for-regexp p 60 -;; (format "\\(%s\\)\\|\\(%s\\)\\|\\(%s\\)\\'" -;; tramp-wrong-passwd-regexp -;; shell-prompt-pattern -;; tramp-shell-prompt-pattern)))) -;; (unless found -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Couldn't find remote shell prompt")) -;; (when (nth 1 found) -;; (pop-to-buffer (buffer-name)) -;; (kill-process p) -;; (error "Login failed: %s" (nth 1 found))) - )) + tramp-multi-actions))) ;; Utility functions. -- 2.11.4.GIT