Sync with Tramp 2.0.50.

This commit is contained in:
Michael Albinus 2005-08-07 15:42:42 +00:00
parent f38be8010a
commit d2a2c17f0f
9 changed files with 344 additions and 295 deletions

View file

@ -1,3 +1,57 @@
2005-08-07 Michael Albinus <michael.albinus@gmx.de>
Sync with Tramp 2.0.50.
* tramp.el: Remove defvar of `last-coding-system-used' in the
XEmacs case; not necessary anymore.
(tramp-user-regexp): Allow "@" as part of user name.
(tramp-handle-set-visited-file-modtime)
(tramp-handle-insert-file-contents)
(tramp-handle-write-region): No special handling for
`last-coding-system-used, because this is done in
`tramp-accept-process-output' now.
(tramp-accept-process-output): New defun.
(tramp-process-one-action, tramp-process-one-multi-action)
(tramp-wait-for-regexp, tramp-wait-for-output)
(tramp-discard-garbage-erase-buffer): Call it. Reported by David
Howells <dhowells@redhat.com>.
(clear-visited-file-modtime): Defadvice removed. The check for
unset buffer's modtime does not need to be based on
`tramp-buffer-file-attributes'. Suggested by RMS.
(tramp-message): Insert "\n" if not being at beginning of line.
(tramp-find-shell): Use `tramp-barf-if-no-shell-prompt' for code
sequence with same logic.
(tramp-completion-handle-expand-file-name): Discard call of
`tramp-drop-volume-letter'. It is not necessary, and there have
been problems with (expand-file-name "~/.netrc" "/") in ange-ftp.
Reported by Richard G. Bielawski
<Richard.G.Bielawski@wellsfargo.com>.
(tramp-do-copy-or-rename-file-out-of-band): Transfer message
should always be visible.
(tramp-handle-insert-directory, tramp-setup-complete)
(tramp-set-process-query-on-exit-flag)
(tramp-append-tramp-buffers): Pacify byte-compiler.
(tramp-bug): Delete non-existing variables from list. Apply
`tramp-load-report-modules' as pre-hook. Mask
`tramp-password-prompt-regexp', `tramp-shell-prompt-pattern' and
`shell-prompt-pattern' because of non-7bit characters. Reported
by Sebastian Luque <sluque@mun.ca>.
(tramp-reporter-dump-variable, tramp-load-report-modules): New
defuns.
(tramp-match-string-list): Remove function.
(tramp-wait-for-regexp): Remove call of that function. Suggested
by Kim F. Storm <storm@cua.dk>.
(tramp-set-auto-save-file-modes): Use octal integer code #o600
instead of octal character code ?\600. The latter resulted in a
syntax error with XEmacs.
* tramp-smb.el: Remove defvar of `last-coding-system-used' in the
XEmacs case; not necessary anymore.
(tramp-smb-handle-write-region): No special handling for
`last-coding-system-used, because this is done in
`tramp-accept-process-output' now.
(tramp-smb-wait-for-output): Call `tramp-accept-process-output'.
2005-08-06 Luc Teirlinck <teirllm@auburn.edu>
* wid-edit.el (widget-choice-value-create): Unconditionally

View file

@ -1,8 +1,8 @@
;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP and EFS -*- coding: iso-8859-1; -*-
;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP -*- coding: iso-8859-1; -*-
;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
;; Author: Michael Albinus <Michael.Albinus@alcatel.de>
;; Author: Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, processes
;; This file is part of GNU Emacs.

View file

@ -46,11 +46,6 @@
(defalias 'warnings 'identity) ; Pacify Emacs byte-compiler
(byte-compiler-options (warnings (- unused-vars))))))
;; XEmacs byte-compiler raises warning abouts `last-coding-system-used'.
(eval-when-compile
(unless (boundp 'last-coding-system-used)
(defvar last-coding-system-used nil)))
;; Define SMB method ...
(defcustom tramp-smb-method "smb"
"*Method to connect SAMBA and M$ SMB servers."
@ -598,13 +593,6 @@ Catches errors for shares like \"C$/\", which are common in Microsoft Windows."
(let ((share (tramp-smb-get-share localname))
(file (tramp-smb-get-localname localname t))
(curbuf (current-buffer))
;; We use this to save the value of `last-coding-system-used'
;; after writing the tmp file. At the end of the function,
;; we set `last-coding-system-used' to this saved value.
;; This way, any intermediary coding systems used while
;; talking to the remote shell or suchlike won't hose this
;; variable. This approach was snarfed from ange-ftp.el.
coding-system-used
tmpfil)
;; Write region into a tmp file.
(setq tmpfil (tramp-make-temp-file))
@ -616,9 +604,6 @@ Catches errors for shares like \"C$/\", which are common in Microsoft Windows."
(if confirm ; don't pass this arg unless defined for backward compat.
(list start end tmpfil append 'no-message lockname confirm)
(list start end tmpfil append 'no-message lockname)))
;; Now, `last-coding-system-used' has the right value. Remember it.
(when (boundp 'last-coding-system-used)
(setq coding-system-used last-coding-system-used))
(tramp-smb-maybe-open-connection user host share)
(tramp-message-for-buffer
@ -636,10 +621,7 @@ Catches errors for shares like \"C$/\", which are common in Microsoft Windows."
(error "Buffer has changed from `%s' to `%s'"
curbuf (current-buffer)))
(when (eq visit t)
(set-visited-file-modtime))
;; Make `last-coding-system-used' have the right value.
(when (boundp 'last-coding-system-used)
(setq last-coding-system-used coding-system-used))))))
(set-visited-file-modtime))))))
;; Internal file name functions
@ -1000,7 +982,7 @@ Returns nil if an error message has appeared."
(while (and (not found) (not err))
;; Accept pending output.
(accept-process-output proc)
(tramp-accept-process-output proc)
;; Search for prompt.
(goto-char (point-min))

View file

@ -3,7 +3,7 @@
;; Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
;; Author: Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
;; Author: Kai Gro,A_(Bjohann <kai.grossjohann@gmx.net>
;; Keywords: comm, terminals
;; This file is free software; you can redistribute it and/or modify

View file

@ -4,7 +4,8 @@
;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
;; 2005 Free Software Foundation, Inc.
;; Author: kai.grossjohann@gmx.net
;; Author: Kai Gro,A_(Bjohann <kai.grossjohann@gmx.net>
;; Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, processes
;; This file is part of GNU Emacs.
@ -147,11 +148,6 @@ Nil means to use a separate filename syntax for Tramp.")
(when (boundp 'byte-compile-not-obsolete-var)
(setq byte-compile-not-obsolete-var 'directory-sep-char)))
;; XEmacs byte-compiler raises warning abouts `last-coding-system-used'.
(eval-when-compile
(unless (boundp 'last-coding-system-used)
(defvar last-coding-system-used nil)))
;;; User Customizable Internal Variables:
(defgroup tramp nil
@ -1031,7 +1027,7 @@ Derived from `tramp-postfix-multi-hop-format'."
:type 'regexp)
(defcustom tramp-user-regexp
"[^:@/ \t]*"
"[^:/ \t]*"
"*Regexp matching user names."
:group 'tramp
:type 'regexp)
@ -1914,7 +1910,9 @@ This function expects to be called from the tramp buffer only!"
tramp-current-multi-method tramp-current-method
tramp-current-user tramp-current-host))
(goto-char (point-max))
(tramp-insert-with-face
(unless (bolp)
(insert "\n"))
(tramp-insert-with-face
'italic
(concat "# " (apply #'format fmt-string args) "\n"))))))
@ -2370,16 +2368,13 @@ target of the symlink differ."
(buffer-name)))
(if time-list
(tramp-run-real-handler 'set-visited-file-modtime (list time-list))
(let ((f (buffer-file-name))
(coding-system-used nil))
(let ((f (buffer-file-name)))
(with-parsed-tramp-file-name f nil
(let* ((attr (file-attributes f))
;; '(-1 65535) means file doesn't exists yet.
(modtime (or (nth 5 attr) '(-1 65535))))
;; We use '(0 0) as a don't-know value. See also
;; `tramp-handle-file-attributes-with-ls'.
(when (boundp 'last-coding-system-used)
(setq coding-system-used last-coding-system-used))
(if (not (equal modtime '(0 0)))
(tramp-run-real-handler 'set-visited-file-modtime (list modtime))
(save-excursion
@ -2392,9 +2387,7 @@ target of the symlink differ."
(setq attr (buffer-substring (point)
(progn (end-of-line) (point)))))
(setq tramp-buffer-file-attributes attr))
(when (boundp 'last-coding-system-used)
(setq last-coding-system-used coding-system-used))
nil)))))
nil)))))
;; CCC continue here
@ -2412,7 +2405,7 @@ of."
;; recorded last modification time.
(if (or (not (buffer-file-name))
(eq (visited-file-modtime) 0))
t
t
(let ((f (buffer-file-name)))
(with-parsed-tramp-file-name f nil
(let* ((attr (file-attributes f))
@ -2447,12 +2440,6 @@ of."
;; if and only if that agrees with the buffer's record.
(t (equal mt '(-1 65535))))))))))
(defadvice clear-visited-file-modtime (after tramp activate)
"Set `tramp-buffer-file-attributes' back to nil.
Tramp uses this variable as an emulation for the actual modtime of the file,
if the remote host can't provide the modtime."
(setq tramp-buffer-file-attributes nil))
(defun tramp-handle-set-file-modes (filename mode)
"Like `set-file-modes' for tramp files."
(with-parsed-tramp-file-name filename nil
@ -3137,8 +3124,7 @@ be a local filename. The method used must be an out-of-band method."
tramp-current-method method
tramp-current-user user
tramp-current-host host)
(tramp-message
5 "Transferring %s to file %s..." filename newname)
(message "Transferring %s to %s..." filename newname)
;; Use rcp-like program for file transfer.
(let ((p (apply 'start-process (buffer-name trampbuf) trampbuf
@ -3147,8 +3133,7 @@ be a local filename. The method used must be an out-of-band method."
(tramp-process-actions p multi-method method user host
tramp-actions-copy-out-of-band))
(kill-buffer trampbuf)
(tramp-message
5 "Transferring %s to file %s...done" filename newname)
(message "Transferring %s to %s...done" filename newname)
;; Set the mode.
(unless keep-date
@ -3319,7 +3304,7 @@ This is like `dired-recursive-delete-directory' for tramp files."
(filename switches &optional wildcard full-directory-p)
"Like `insert-directory' for tramp files."
(if (and (boundp 'ls-lisp-use-insert-directory-program)
(not ls-lisp-use-insert-directory-program))
(not (symbol-value 'ls-lisp-use-insert-directory-program)))
(tramp-run-real-handler 'insert-directory
(list filename switches wildcard full-directory-p))
;; For the moment, we assume that the remote "ls" program does not
@ -3505,7 +3490,7 @@ the result will be a local, non-Tramp, filename."
;; Remote commands.
(defvar tramp-async-proc nil
"Global variable keeping asyncronous process object.
"Global variable keeping asynchronous process object.
Used in `tramp-handle-shell-command'")
(defun tramp-handle-shell-command (command &optional output-buffer error-buffer)
@ -3762,7 +3747,6 @@ This will break if COMMAND prints a newline, followed by the value of
'insert-file-contents)
'file-local-copy)))
(file-local-copy filename)))
(coding-system-used nil)
(result nil))
(when visit
(setq buffer-file-name filename)
@ -3772,15 +3756,10 @@ This will break if COMMAND prints a newline, followed by the value of
multi-method method user host
9 "Inserting local temp file `%s'..." local-copy)
(setq result (insert-file-contents local-copy nil beg end replace))
;; Now `last-coding-system-used' has right value. Remember it.
(when (boundp 'last-coding-system-used)
(setq coding-system-used last-coding-system-used))
(tramp-message-for-buffer
multi-method method user host
9 "Inserting local temp file `%s'...done" local-copy)
(delete-file local-copy)
(when (boundp 'last-coding-system-used)
(setq last-coding-system-used coding-system-used))
(list (expand-file-name filename)
(second result))))))
@ -3845,7 +3824,7 @@ This will break if COMMAND prints a newline, followed by the value of
;; (string= lockname filename))
;; (error
;; "tramp-handle-write-region: LOCKNAME must be nil or equal FILENAME"))
;; XEmacs takes a coding system as the sevent argument, not `confirm'
;; XEmacs takes a coding system as the seventh argument, not `confirm'
(when (and (not (featurep 'xemacs))
confirm (file-exists-p filename))
(unless (y-or-n-p (format "File %s exists; overwrite anyway? "
@ -3859,13 +3838,6 @@ This will break if COMMAND prints a newline, followed by the value of
(loc-dec (tramp-get-local-decoding multi-method method user host))
(trampbuf (get-buffer-create "*tramp output*"))
(modes (file-modes filename))
;; We use this to save the value of `last-coding-system-used'
;; after writing the tmp file. At the end of the function,
;; we set `last-coding-system-used' to this saved value.
;; This way, any intermediary coding systems used while
;; talking to the remote shell or suchlike won't hose this
;; variable. This approach was snarfed from ange-ftp.el.
coding-system-used
tmpfil)
;; Write region into a tmp file. This isn't really needed if we
;; use an encoding function, but currently we use it always
@ -3887,9 +3859,6 @@ This will break if COMMAND prints a newline, followed by the value of
;; the backup file. This case `save-buffer' handles
;; permissions.
(when modes (set-file-modes tmpfil modes))
;; Now, `last-coding-system-used' has the right value. Remember it.
(when (boundp 'last-coding-system-used)
(setq coding-system-used last-coding-system-used))
;; This is a bit lengthy due to the different methods possible for
;; file transfer. First, we check whether the method uses an rcp
;; program. If so, we call it. Otherwise, both encoding and
@ -3991,9 +3960,6 @@ This will break if COMMAND prints a newline, followed by the value of
;; We must pass modtime explicitely, because filename can be different
;; from (buffer-file-name), f.e. if `file-precious-flag' is set.
(nth 5 (file-attributes filename))))
;; Make `last-coding-system-used' have the right value.
(when (boundp 'last-coding-system-used)
(setq last-coding-system-used coding-system-used))
(when (or (eq visit t)
(eq visit nil)
(stringp visit))
@ -4301,7 +4267,7 @@ necessary anymore."
(symbol-function 'PC-expand-many-files))
(defun PC-expand-many-files (name)
(if (tramp-tramp-file-p name)
(expand-many-files name)
(funcall (symbol-function 'expand-many-files) name)
(tramp-save-PC-expand-many-files name))))
;; Why isn't eval-after-load sufficient?
@ -4825,12 +4791,11 @@ User may be nil."
(defun tramp-completion-handle-expand-file-name (name &optional dir)
"Like `expand-file-name' for tramp files."
(let ((fullname (concat (or dir default-directory) name)))
(tramp-drop-volume-letter
(if (tramp-completion-mode fullname)
(tramp-run-real-handler
'expand-file-name (list name dir))
(tramp-completion-run-real-handler
'expand-file-name (list name dir))))))
(if (tramp-completion-mode fullname)
(tramp-run-real-handler
'expand-file-name (list name dir))
(tramp-completion-run-real-handler
'expand-file-name (list name dir)))))
;;; Internal Functions:
@ -5127,12 +5092,9 @@ file exists and nonzero exit status otherwise."
(tramp-send-command
multi-method method user host
(concat "PS1='$ ' exec " shell)) ;
(unless (tramp-wait-for-regexp
(get-buffer-process (current-buffer))
60 (format "\\(\\(%s\\)\\|\\(%s\\)\\)\\'"
tramp-shell-prompt-pattern shell-prompt-pattern))
(pop-to-buffer (buffer-name))
(error "Couldn't find remote `%s' prompt" shell))
(tramp-barf-if-no-shell-prompt
(get-buffer-process (current-buffer))
60 "Couldn't find remote `%s' prompt" shell)
(tramp-message
9 "Setting remote shell prompt...")
;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we
@ -5331,7 +5293,7 @@ The terminal type can be configured with `tramp-terminal-type'."
(tramp-message 9 "Waiting 60s for prompt from remote shell")
(with-timeout (60 (throw 'tramp-action 'timeout))
(while (not found)
(accept-process-output p 1)
(tramp-accept-process-output p 1)
(goto-char (point-min))
(setq todo actions)
(while todo
@ -5368,7 +5330,7 @@ The terminal type can be configured with `tramp-terminal-type'."
(tramp-message 9 "Waiting 60s for prompt from remote shell")
(with-timeout (60 (throw 'tramp-action 'timeout))
(while (not found)
(accept-process-output p 1)
(tramp-accept-process-output p 1)
(setq todo actions)
(goto-char (point-min))
(while todo
@ -5757,6 +5719,14 @@ character."
;; Utility functions.
(defun tramp-accept-process-output
(&optional process timeout timeout-msecs)
"Like `accept-process-output' for Tramp processes.
This is needed in order to hide `last-coding-system-used', which is set
for process communication also."
(let (last-coding-system-used)
(accept-process-output process timeout timeout-msecs)))
(defun tramp-wait-for-regexp (proc timeout regexp)
"Wait for a REGEXP to appear from process PROC within TIMEOUT seconds.
Expects the output of PROC to be sent to the current buffer. Returns
@ -5773,20 +5743,18 @@ nil."
timeout))
(with-timeout (timeout)
(while (not found)
(accept-process-output proc 1)
(tramp-accept-process-output proc 1)
(unless (memq (process-status proc) '(run open))
(error "Process has died"))
(goto-char (point-min))
(setq found (when (re-search-forward regexp nil t)
(tramp-match-string-list)))))))
(setq found (re-search-forward regexp nil t))))))
(t
(while (not found)
(accept-process-output proc 1)
(tramp-accept-process-output proc 1)
(unless (memq (process-status proc) '(run open))
(error "Process has died"))
(goto-char (point-min))
(setq found (when (re-search-forward regexp nil t)
(tramp-match-string-list))))))
(setq found (re-search-forward regexp nil t)))))
(when tramp-debug-buffer
(append-to-buffer
(tramp-get-debug-buffer tramp-current-multi-method tramp-current-method
@ -6399,7 +6367,7 @@ Sends COMMAND, then waits 30 seconds for shell prompt."
timeout))
(with-timeout (timeout)
(while (not found)
(accept-process-output proc 1)
(tramp-accept-process-output proc 1)
(unless (memq (process-status proc) '(run open))
(error "Process has died"))
(goto-char (point-max))
@ -6407,7 +6375,7 @@ Sends COMMAND, then waits 30 seconds for shell prompt."
(setq found (looking-at end-of-output))))))
(t
(while (not found)
(accept-process-output proc 1)
(tramp-accept-process-output proc 1)
(unless (memq (process-status proc) '(run open))
(error "Process has died"))
(goto-char (point-max))
@ -6444,18 +6412,6 @@ Sends COMMAND, then waits 30 seconds for shell prompt."
;; Return value is whether end-of-output sentinel was found.
found))
(defun tramp-match-string-list (&optional string)
"Returns list of all match strings.
That is, (list (match-string 0) (match-string 1) ...), according to the
number of matches."
(let* ((nmatches (/ (length (match-data)) 2))
(i (- nmatches 1))
(res nil))
(while (>= i 0)
(setq res (cons (match-string i string) res))
(setq i (- i 1)))
res))
(defun tramp-send-command-and-check (multi-method method user host command
&optional subshell)
"Run COMMAND and check its exit status.
@ -6556,7 +6512,7 @@ MULTI-METHOD, METHOD, USER, and HOST specify the connection."
If `tramp-discard-garbage' is nil, just erase buffer."
(if (not tramp-discard-garbage)
(erase-buffer)
(while (prog1 (erase-buffer) (accept-process-output p 0.25))
(while (prog1 (erase-buffer) (tramp-accept-process-output p 0.25))
(when tramp-debug-buffer
(save-excursion
(set-buffer (tramp-get-debug-buffer multi-method method user host))
@ -6993,7 +6949,7 @@ as default."
;; auto-saved file belonging to another original file. This could
;; be a security threat.
(set-file-modes buffer-auto-save-file-name
(or (file-modes bfn) ?\600)))))
(or (file-modes bfn) #o600)))))
(unless (or (> emacs-major-version 21)
(and (featurep 'xemacs)
@ -7130,10 +7086,11 @@ it does the right thing."
"Specify if query is needed for process when Emacs is exited.
If the second argument flag is non-nil, Emacs will query the user before
exiting if process is running."
(funcall
(if (fboundp 'set-process-query-on-exit-flag)
(set-process-query-on-exit-flag process flag)
(funcall (symbol-function 'process-kill-without-query)
process flag)))
(symbol-function 'set-process-query-on-exit-flag)
(symbol-function 'process-kill-without-query))
process flag))
;; ------------------------------------------------------------
@ -7213,20 +7170,19 @@ Only works for Bourne-like shells."
;; CCC: This check is now also really awful; we should search all
;; of the filename format, not just the prefix.
(when (string-match "\\[" tramp-prefix-format)
(defadvice file-expand-wildcards (around tramp-fix activate)
(let ((name (ad-get-arg 0)))
(if (tramp-tramp-file-p name)
;; If it's a Tramp file, dissect it and look if wildcards
;; need to be expanded at all.
(let ((v (tramp-dissect-file-name name)))
(if (string-match "[[*?]" (tramp-file-name-localname v))
(let ((res ad-do-it))
(setq ad-return-value (or res (list name))))
(setq ad-return-value (list name))))
;; If it is not a Tramp file, just run the original function.
(let ((res ad-do-it))
(setq ad-return-value (or res (list name)))))))
)
(defadvice file-expand-wildcards (around tramp-fix activate)
(let ((name (ad-get-arg 0)))
(if (tramp-tramp-file-p name)
;; If it's a Tramp file, dissect it and look if wildcards
;; need to be expanded at all.
(let ((v (tramp-dissect-file-name name)))
(if (string-match "[[*?]" (tramp-file-name-localname v))
(let ((res ad-do-it))
(setq ad-return-value (or res (list name))))
(setq ad-return-value (list name))))
;; If it is not a Tramp file, just run the original function.
(let ((res ad-do-it))
(setq ad-return-value (or res (list name))))))))
;; Tramp version is useful in a number of situations.
@ -7246,69 +7202,74 @@ Only works for Bourne-like shells."
(interactive)
(require 'reporter)
(catch 'dont-send
(let ((reporter-prompt-for-summary-p t))
(let ((reporter-prompt-for-summary-p t))
(reporter-submit-bug-report
tramp-bug-report-address ; to-address
(format "tramp (%s)" tramp-version) ; package name and version
`(;; Current state
tramp-ls-command
tramp-test-groks-nt
tramp-file-exists-command
tramp-current-multi-method
tramp-current-method
tramp-current-user
tramp-current-host
(delq nil
`(;; Current state
tramp-ls-command
tramp-test-groks-nt
tramp-file-exists-command
tramp-current-multi-method
tramp-current-method
tramp-current-user
tramp-current-host
;; System defaults
tramp-auto-save-directory ; vars to dump
tramp-default-method
tramp-rsh-end-of-line
tramp-default-password-end-of-line
tramp-remote-path
tramp-login-prompt-regexp
tramp-password-prompt-regexp
tramp-wrong-passwd-regexp
tramp-yesno-prompt-regexp
tramp-yn-prompt-regexp
tramp-terminal-prompt-regexp
tramp-temp-name-prefix
tramp-file-name-structure
tramp-file-name-regexp
tramp-multi-file-name-structure
tramp-multi-file-name-hop-structure
tramp-multi-methods
tramp-multi-connection-function-alist
tramp-methods
tramp-end-of-output
tramp-coding-commands
tramp-actions-before-shell
tramp-actions-copy-out-of-band
tramp-multi-actions
tramp-terminal-type
tramp-shell-prompt-pattern
tramp-chunksize
,(when (boundp 'tramp-backup-directory-alist)
'tramp-backup-directory-alist)
,(when (boundp 'tramp-bkup-backup-directory-info)
'tramp-bkup-backup-directory-info)
;; System defaults
tramp-auto-save-directory ; vars to dump
tramp-default-method
tramp-rsh-end-of-line
tramp-default-password-end-of-line
tramp-remote-path
tramp-login-prompt-regexp
;; Mask non-7bit characters
(tramp-password-prompt-regexp . tramp-reporter-dump-variable)
tramp-wrong-passwd-regexp
tramp-yesno-prompt-regexp
tramp-yn-prompt-regexp
tramp-terminal-prompt-regexp
tramp-temp-name-prefix
tramp-file-name-structure
tramp-file-name-regexp
tramp-multi-file-name-structure
tramp-multi-file-name-hop-structure
tramp-multi-methods
tramp-multi-connection-function-alist
tramp-methods
tramp-end-of-output
tramp-coding-commands
tramp-actions-before-shell
tramp-actions-copy-out-of-band
tramp-multi-actions
tramp-terminal-type
;; Mask non-7bit characters
(tramp-shell-prompt-pattern . tramp-reporter-dump-variable)
tramp-chunksize
,(when (boundp 'tramp-backup-directory-alist)
'tramp-backup-directory-alist)
,(when (boundp 'tramp-bkup-backup-directory-info)
'tramp-bkup-backup-directory-info)
;; Non-tramp variables of interest
shell-prompt-pattern
backup-by-copying
backup-by-copying-when-linked
backup-by-copying-when-mismatch
,(when (boundp 'backup-by-copying-when-privileged-mismatch)
'backup-by-copying-when-privileged-mismatch)
,(when (boundp 'password-cache)
'password-cache)
,(when (boundp 'password-cache-expiry)
'password-cache-expiry)
,(when (boundp 'backup-directory-alist)
'backup-directory-alist)
,(when (boundp 'bkup-backup-directory-info)
'bkup-backup-directory-info)
file-name-handler-alist)
nil ; pre-hook
;; Non-tramp variables of interest
;; Mask non-7bit characters
(shell-prompt-pattern . tramp-reporter-dump-variable)
backup-by-copying
backup-by-copying-when-linked
backup-by-copying-when-mismatch
,(when (boundp 'backup-by-copying-when-privileged-mismatch)
'backup-by-copying-when-privileged-mismatch)
,(when (boundp 'password-cache)
'password-cache)
,(when (boundp 'password-cache-expiry)
'password-cache-expiry)
,(when (boundp 'backup-directory-alist)
'backup-directory-alist)
,(when (boundp 'bkup-backup-directory-info)
'bkup-backup-directory-info)
file-name-handler-alist))
'tramp-load-report-modules ; pre-hook
'tramp-append-tramp-buffers ; post-hook
"\
Enter your bug report in this message, including as much detail as you
@ -7327,8 +7288,43 @@ report.
--bug report follows this line--
"))))
(defun tramp-append-tramp-buffers ()
"Append Tramp buffers into the bug report."
(defun tramp-reporter-dump-variable (varsym mailbuf)
"Pretty-print the value of the variable in symbol VARSYM.
Used for non-7bit chars in strings."
(let* ((reporter-eval-buffer (symbol-value 'reporter-eval-buffer))
(val (with-current-buffer reporter-eval-buffer
(symbol-value varsym))))
;; There are characters to be masked.
(when (and (boundp 'mm-7bit-chars)
(string-match
(concat "[^" (symbol-value 'mm-7bit-chars) "]") val))
(with-current-buffer reporter-eval-buffer
(set varsym (concat "(base64-decode-string \""
(base64-encode-string val)
"\")"))))
;; Dump variable.
(funcall (symbol-function 'reporter-dump-variable) varsym mailbuf)
;; Remove string quotation.
(forward-line -1)
(when (looking-at
(concat "\\(^.*\\)" "\"" ;; \1 "
"\\((base64-decode-string \\)" "\\\\" ;; \2 \
"\\(\".*\\)" "\\\\" ;; \3 \
"\\(\")\\)" "\"$")) ;; \4 "
(replace-match "\\1\\2\\3\\4")
(beginning-of-line)
(insert " ;; variable encoded due to non-printable characters\n"))
(forward-line 1)
;; Reset VARSYM to old value.
(with-current-buffer reporter-eval-buffer
(set varsym val))))
(defun tramp-load-report-modules ()
"Load needed modules for reporting."
;; We load message.el and mml.el from Gnus.
(if (featurep 'xemacs)
@ -7338,9 +7334,12 @@ report.
(require 'message nil 'noerror)
(require 'mml nil 'noerror))
(when (functionp 'message-mode)
(funcall 'message-mode))
(funcall (symbol-function 'message-mode)))
(when (functionp 'mml-mode)
(funcall 'mml-mode t))
(funcall (symbol-function 'mml-mode) t)))
(defun tramp-append-tramp-buffers ()
"Append Tramp buffers into the bug report."
(when (and
(eq major-mode 'message-mode)
@ -7394,10 +7393,10 @@ Therefore, the contents of files might be included in the debug buffer(s).")
(goto-char (point-max))
(insert "\n\n")
(dolist (buffer buffer-list)
(mml-insert-empty-tag
'part 'type "text/plain" 'encoding "base64"
'disposition "attachment" 'buffer (buffer-name buffer)
'description (buffer-name buffer)))
(funcall (symbol-function 'mml-insert-empty-tag)
'part 'type "text/plain" 'encoding "base64"
'disposition "attachment" 'buffer (buffer-name buffer)
'description (buffer-name buffer)))
(set-buffer-modified-p nil))
;; Don't send. Delete the message buffer.

View file

@ -4,7 +4,7 @@
;; Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
;; Author: Kai.Grossjohann@CS.Uni-Dortmund.DE
;; Author: Kai Gro,A_(Bjohann <kai.grossjohann@gmx.net>
;; Keywords: comm, processes
;; This file is part of GNU Emacs.
@ -30,7 +30,7 @@
;; are auto-frobbed from configure.ac, so you should edit that file and run
;; "autoconf && ./configure" to change them.
(defconst tramp-version "2.0.49"
(defconst tramp-version "2.0.50"
"This version of Tramp.")
(defconst tramp-bug-report-address "tramp-devel@gnu.org"

View file

@ -1,3 +1,13 @@
2005-08-07 Michael Albinus <michael.albinus@gmx.de>
Sync with Tramp 2.0.50.
* tramp.texi: Use @option{} consequently for method names.
(Inline methods, External transfer methods): Remove references to
Cygwin.
(Issues with Cygwin ssh): Explain trouble with Cygwin's ssh
implementation.
2005-08-06 Eli Zaretskii <eliz@gnu.org>
* mule.texi (Coding Systems): Rephrase the paragraph about

View file

@ -218,10 +218,10 @@ How file names, directories and localnames are mangled and managed
@chapter An overview of @value{tramp}
@cindex overview
After the installation of @value{tramp} into your @value{emacsname}, you
will be able to access files on remote machines as though they were
local. Access to the remote file system for editing files, version
control, and @command{dired} are transparently enabled.
After the installation of @value{tramp} into your @value{emacsname},
you will be able to access files on remote machines as though they
were local. Access to the remote file system for editing files,
version control, and @code{dired} are transparently enabled.
Your access to the remote machine can be with the @command{rsh},
@command{rlogin}, @command{telnet} programs or with any similar
@ -289,9 +289,9 @@ Communication with this process happens through an
goes into a buffer.
@item
The remote host may prompt for a login name (for @command{telnet}). The
login name is given in the file name, so @value{tramp} sends the login name and
a newline.
The remote host may prompt for a login name (for @command{telnet}).
The login name is given in the file name, so @value{tramp} sends the
login name and a newline.
@item
The remote host may prompt for a password or pass phrase (for
@ -365,7 +365,6 @@ you are finished, you type @kbd{C-x C-s} to save the buffer.
Again, @value{tramp} transfers the file contents to the remote host either
inline or out-of-band. This is the reverse of what happens when reading
the file.
@end itemize
I hope this has provided you with a basic overview of what happens
@ -653,7 +652,6 @@ easy to implement, so I haven't got around to it, yet.
@item @option{sshx}
@cindex method sshx
@cindex sshx method
@cindex Cygwin (with sshx method)
As you would expect, this is similar to @option{ssh}, only a little
different. Whereas @option{ssh} opens a normal interactive shell on
@ -674,9 +672,9 @@ in without such questions.
This is also useful for Windows users where @command{ssh}, when
invoked from an @value{emacsname} buffer, tells them that it is not
allocating a pseudo tty. When this happens, the login shell is wont
to not print any shell prompt, which confuses @value{tramp} mightily. For
reasons unknown, some Windows ports for @command{ssh} (maybe the
Cygwin one) require the doubled @samp{-t} option.
to not print any shell prompt, which confuses @value{tramp} mightily.
For reasons unknown, some Windows ports for @command{ssh} require the
doubled @samp{-t} option.
This supports the @samp{-p} kludge.
@ -817,7 +815,6 @@ This method supports the @samp{-p} hack.
@cindex scpx method
@cindex scp (with scpx method)
@cindex ssh (with scpx method)
@cindex Cygwin (with scpx method)
As you would expect, this is similar to @option{scp}, only a little
different. Whereas @option{scp} opens a normal interactive shell on
@ -832,7 +829,6 @@ This is also useful for Windows users where @command{ssh}, when
invoked from an @value{emacsname} buffer, tells them that it is not
allocating a pseudo tty. When this happens, the login shell is wont
to not print any shell prompt, which confuses @value{tramp} mightily.
Maybe this applies to the Cygwin port of SSH.
This method supports the @samp{-p} hack.
@ -1025,7 +1021,7 @@ For example:
'("sshf" tramp-multi-connect-rlogin "ssh %h -l %u -p 4400%n"))
@end lisp
Now you can use an @code{sshf} hop which connects to port 4400 instead of
Now you can use an @option{sshf} hop which connects to port 4400 instead of
the standard port.
@ -1074,16 +1070,16 @@ Another consideration with the selection of transfer methods is the
environment you will use them in and, especially when used over the
Internet, the security implications of your preferred method.
The @command{rsh} and @command{telnet} methods send your password as
plain text as you log in to the remote machine, as well as transferring
the files in such a way that the content can easily be read from other
machines.
The @option{rsh} and @option{telnet} methods send your password as
plain text as you log in to the remote machine, as well as
transferring the files in such a way that the content can easily be
read from other machines.
If you need to connect to remote systems that are accessible from the
Internet, you should give serious thought to using @command{ssh} based
Internet, you should give serious thought to using @option{ssh} based
methods to connect. These provide a much higher level of security,
making it a non-trivial exercise for someone to obtain your password or
read the content of the files you are editing.
making it a non-trivial exercise for someone to obtain your password
or read the content of the files you are editing.
@subsection Which method is the right one for me?
@ -1101,28 +1097,29 @@ methods might be more efficient, but I guess that most people will want
to edit mostly small files.
I guess that these days, most people can access a remote machine by
using @code{ssh}. So I suggest that you use the @code{ssh} method.
So, type @kbd{C-x C-f
using @command{ssh}. So I suggest that you use the @option{ssh}
method. So, type @kbd{C-x C-f
@value{prefix}ssh@value{postfixsinglehop}root@@otherhost@value{postfix}/etc/motd
@key{RET}} to edit the @file{/etc/motd} file on the other host.
If you can't use @code{ssh} to log in to the remote host, then select a
method that uses a program that works. For instance, Windows users
might like the @code{plink} method which uses the PuTTY implementation
of @code{ssh}. Or you use Kerberos and thus like @code{krlogin}.
If you can't use @option{ssh} to log in to the remote host, then
select a method that uses a program that works. For instance, Windows
users might like the @option{plink} method which uses the PuTTY
implementation of @command{ssh}. Or you use Kerberos and thus like
@option{krlogin}.
For the special case of editing files on the local host as another
user, see the @code{su} or @code{sudo} method. It offers shortened
syntax for the @samp{root} account, like
user, see the @option{su} or @option{sudo} methods. They offer
shortened syntax for the @samp{root} account, like
@file{@value{prefix}su@value{postfixsinglehop}@value{postfix}/etc/motd}.
People who edit large files may want to consider @code{scp} instead of
@code{ssh}, or @code{pscp} instead of @code{plink}. These out-of-band
methods are faster than inline methods for large files. Note, however,
that out-of-band methods suffer from some limitations. Please try
first whether you really get a noticeable speed advantage from using an
out-of-band method! Maybe even for large files, inline methods are
fast enough.
People who edit large files may want to consider @option{scp} instead
of @option{ssh}, or @option{pscp} instead of @option{plink}. These
out-of-band methods are faster than inline methods for large files.
Note, however, that out-of-band methods suffer from some limitations.
Please try first whether you really get a noticeable speed advantage
from using an out-of-band method! Maybe even for large files, inline
methods are fast enough.
@node Customizing Methods
@ -1365,16 +1362,16 @@ the remote host such that it behaves like @value{tramp} expects. This might
be inconvenient because you have to invest a lot of effort into shell
setup before you can begin to use @value{tramp}.
The package, therefore, pursues a combined approach. It tries to figure
out some of the more common setups, and only requires you to avoid
really exotic stuff. For example, it looks through a list of
The package, therefore, pursues a combined approach. It tries to
figure out some of the more common setups, and only requires you to
avoid really exotic stuff. For example, it looks through a list of
directories to find some programs on the remote host. And also, it
knows that it is not obvious how to check whether a file exists, and
therefore it tries different possibilities. (On some hosts and shells,
the command @code{test -e} does the trick, on some hosts the shell
builtin doesn't work but the program @code{/usr/bin/test -e} or
@code{/bin/test -e} works. And on still other hosts, @code{ls -d} is
the right way to do this.)
therefore it tries different possibilities. (On some hosts and
shells, the command @command{test -e} does the trick, on some hosts
the shell builtin doesn't work but the program @command{/usr/bin/test
-e} or @command{/bin/test -e} works. And on still other hosts,
@command{ls -d} is the right way to do this.)
Below you find a discussion of a few things that @value{tramp} does not deal
with, and that you therefore have to set up correctly.
@ -1409,11 +1406,11 @@ different user. The default value of
@code{shell-prompt-pattern}, which is reported to work well in many
circumstances.
@item @code{tset} and other questions
@item @command{tset} and other questions
@cindex Unix command tset
@cindex tset Unix command
Some people invoke the @code{tset} program from their shell startup
Some people invoke the @command{tset} program from their shell startup
scripts which asks the user about the terminal type of the shell.
Maybe some shells ask other questions when they are started. @value{tramp}
does not know how to answer these questions. There are two approaches
@ -1443,20 +1440,21 @@ This weird effect was actually reported by a @value{tramp} user!
@item Non-Bourne commands in @file{.profile}
After logging in to the remote host, @value{tramp} issues the command
@code{exec /bin/sh}. (Actually, the command is slightly different.)
When @code{/bin/sh} is executed, it reads some init files, such as
@file{~/.shrc} or @file{~/.profile}.
@command{exec /bin/sh}. (Actually, the command is slightly
different.) When @command{/bin/sh} is executed, it reads some init
files, such as @file{~/.shrc} or @file{~/.profile}.
Now, some people have a login shell which is not @code{/bin/sh} but a
Bourne-ish shell such as bash or ksh. Some of these people might put
their shell setup into the files @code{~/.shrc} or @code{~/.profile}.
their shell setup into the files @file{~/.shrc} or @file{~/.profile}.
This way, it is possible for non-Bourne constructs to end up in those
files. Then, @code{exec /bin/sh} might cause the Bourne shell to barf
on those constructs.
files. Then, @command{exec /bin/sh} might cause the Bourne shell to
barf on those constructs.
As an example, imagine somebody putting @code{export FOO=bar} into the
file @file{~/.profile}. The standard Bourne shell does not understand
this syntax and will emit a syntax error when it reaches this line.
As an example, imagine somebody putting @command{export FOO=bar} into
the file @file{~/.profile}. The standard Bourne shell does not
understand this syntax and will emit a syntax error when it reaches
this line.
Another example is the tilde (@code{~}) character, say when adding
@file{~/bin} to @code{$PATH}. Many Bourne shells will not expand this
@ -1467,8 +1465,8 @@ What can you do about this?
Well, one possibility is to make sure that everything in @file{~/.shrc}
and @file{~/.profile} on all remote hosts is Bourne-compatible. In the
above example, instead of @code{export FOO=bar}, you might use
@code{FOO=bar; export FOO} instead.
above example, instead of @command{export FOO=bar}, you might use
@command{FOO=bar; export FOO} instead.
The other possibility is to put your non-Bourne shell setup into some
other files. For example, bash reads the file @file{~/.bash_profile}
@ -1476,14 +1474,15 @@ instead of @file{~/.profile}, if the former exists. So bash
aficionados just rename their @file{~/.profile} to
@file{~/.bash_profile} on all remote hosts, and Bob's your uncle.
The @value{tramp} developers would like to circumvent this problem, so if you
have an idea about it, please tell us. However, we are afraid it is not
that simple: before saying @code{exec /bin/sh}, @value{tramp} does not know
which kind of shell it might be talking to. It could be a Bourne-ish
shell like ksh or bash, or it could be a csh derivative like tcsh, or
it could be zsh, or even rc. If the shell is Bourne-ish already, then
it might be prudent to omit the @code{exec /bin/sh} step. But how to
find out if the shell is Bourne-ish?
The @value{tramp} developers would like to circumvent this problem, so
if you have an idea about it, please tell us. However, we are afraid
it is not that simple: before saying @command{exec /bin/sh},
@value{tramp} does not know which kind of shell it might be talking
to. It could be a Bourne-ish shell like ksh or bash, or it could be a
csh derivative like tcsh, or it could be zsh, or even rc. If the
shell is Bourne-ish already, then it might be prudent to omit the
@command{exec /bin/sh} step. But how to find out if the shell is
Bourne-ish?
@end table
@ -1630,38 +1629,44 @@ This section needs a lot of work! Please help.
@cindex method sshx with Cygwin
@cindex sshx method with Cygwin
If you use the Cygwin installation of ssh (you have to explicitly select
it in the installer), then it should work out of the box to just select
@code{sshx} as the connection method. You can find information about
setting up Cygwin in their FAQ at @uref{http://cygwin.com/faq/}.
The recent Cygwin installation of @command{ssh} works only with a
Cygwinized @value{emacsname}. You can check it by typing @kbd{M-x
eshell}, and starting @kbd{ssh test.machine}. The problem is evident
if you see a message like this:
@example
Pseudo-terminal will not be allocated because stdin is not a terminal.
@end example
Older @command{ssh} versions of Cygwin are told to cooperate with
@value{tramp} selecting @option{sshx} as the connection method. You
can find information about setting up Cygwin in their FAQ at
@uref{http://cygwin.com/faq/}.
@cindex method scpx with Cygwin
@cindex scpx method with Cygwin
If you wish to use the @code{scpx} connection method, then you might
have the problem that @value{emacsname} calls @code{scp} with a
If you wish to use the @option{scpx} connection method, then you might
have the problem that @value{emacsname} calls @command{scp} with a
Windows filename such as @code{c:/foo}. The Cygwin version of
@code{scp} does not know about Windows filenames and interprets this
@command{scp} does not know about Windows filenames and interprets this
as a remote filename on the host @code{c}.
One possible workaround is to write a wrapper script for @code{scp}
One possible workaround is to write a wrapper script for @option{scp}
which converts the Windows filename to a Cygwinized filename.
I guess that another workaround is to run @value{emacsname} under
Cygwin, or to run a Cygwinized @value{emacsname}.
@cindex Cygwin and ssh-agent
@cindex SSH_AUTH_SOCK and @value{emacsname} on Windows
If you want to use either @code{ssh} based method on Windows, then you
might encounter problems with @code{ssh-agent}. Using this program,
you can avoid typing the pass-phrase every time you log in. However,
if you start @value{emacsname} from a desktop shortcut, then the
environment variable @code{SSH_AUTH_SOCK} is not set and so
@value{emacsname} and thus @value{tramp} and thus @code{ssh} and
@code{scp} started from @value{tramp} cannot communicate with
@code{ssh-agent}. It works better to start @value{emacsname} from
If you want to use either @option{ssh} based method on Windows, then
you might encounter problems with @command{ssh-agent}. Using this
program, you can avoid typing the pass-phrase every time you log in.
However, if you start @value{emacsname} from a desktop shortcut, then
the environment variable @code{SSH_AUTH_SOCK} is not set and so
@value{emacsname} and thus @value{tramp} and thus @command{ssh} and
@command{scp} started from @value{tramp} cannot communicate with
@command{ssh-agent}. It works better to start @value{emacsname} from
the shell.
If anyone knows how to start @code{ssh-agent} under Windows in such a
If anyone knows how to start @command{ssh-agent} under Windows in such a
way that desktop shortcuts can profit, please holler. I don't really
know anything at all about Windows@dots{}
@ -2108,10 +2113,10 @@ remote host.
There's this @file{~/.sh_history} file on the remote host which keeps
growing and growing. What's that?
Sometimes, @value{tramp} starts @code{ksh} on the remote host for tilde
expansion. Maybe @code{ksh} saves the history by default. @value{tramp}
tries to turn off saving the history, but maybe you have to help. For
example, you could put this in your @file{.kshrc}:
Sometimes, @value{tramp} starts @command{ksh} on the remote host for
tilde expansion. Maybe @command{ksh} saves the history by default.
@value{tramp} tries to turn off saving the history, but maybe you have
to help. For example, you could put this in your @file{.kshrc}:
@example
if [ -f $HOME/.sh_history ] ; then
@ -2316,18 +2321,18 @@ effect while preserving the @value{tramp} file name information.
@itemize @bullet
@item The uuencode method does not always work.
Due to the design of @value{tramp}, the encoding and decoding programs need to
read from stdin and write to stdout. On some systems, @code{uudecode -o
-} will read stdin and write the decoded file to stdout, on other
systems @code{uudecode -p} does the same thing. But some systems have
uudecode implementations which cannot do this at all---it is not
possible to call these uudecode implementations with suitable parameters
so that they write to stdout.
Due to the design of @value{tramp}, the encoding and decoding programs
need to read from stdin and write to stdout. On some systems,
@command{uudecode -o -} will read stdin and write the decoded file to
stdout, on other systems @command{uudecode -p} does the same thing.
But some systems have uudecode implementations which cannot do this at
all---it is not possible to call these uudecode implementations with
suitable parameters so that they write to stdout.
Of course, this could be circumvented: the @code{begin foo 644} line
could be rewritten to put in some temporary file name, then
@code{uudecode} could be called, then the temp file could be printed and
deleted.
@command{uudecode} could be called, then the temp file could be
printed and deleted.
But I have decided that this is too fragile to reliably work, so on some
systems you'll have to do without the uuencode methods.
@ -2368,13 +2373,12 @@ to the files @file{.../xemacs-packages/lisp/tramp/auto-autoloads.el*}.
In case of unified filenames, all @value{emacsname} download sites
are added to @code{tramp-default-method-alist} with default method
@code{ftp} @xref{Default Method}. These settings shouldn't be touched
@option{ftp} @xref{Default Method}. These settings shouldn't be touched
for proper working of the @value{emacsname} package system.
The syntax for unified filenames is described in the @value{tramp} manual
for @value{emacsothername}.
@end ifset
@end itemize
@node Concept Index

View file

@ -4,7 +4,7 @@
@c In the Tramp CVS, the version number is auto-frobbed from
@c configure.ac, so you should edit that file and run
@c "autoconf && ./configure" to change the version number.
@set trampver 2.0.49
@set trampver 2.0.50
@c Other flags from configuration
@set prefix /usr/local