[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/net/tramp.el
From: |
Kai Großjohann |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/net/tramp.el |
Date: |
Sat, 03 Aug 2002 05:23:26 -0400 |
Index: emacs/lisp/net/tramp.el
diff -c emacs/lisp/net/tramp.el:1.12 emacs/lisp/net/tramp.el:1.13
*** emacs/lisp/net/tramp.el:1.12 Tue Jul 30 16:24:27 2002
--- emacs/lisp/net/tramp.el Sat Aug 3 05:23:25 2002
***************
*** 69,75 ****
;;; Code:
! (defconst tramp-version "2.0.5"
"This version of tramp.")
(defconst tramp-bug-report-address "address@hidden"
--- 69,78 ----
;;; Code:
! ;; 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.6"
"This version of tramp.")
(defconst tramp-bug-report-address "address@hidden"
***************
*** 632,639 ****
:group 'tramp
:type '(repeat (list string function string)))
! (defcustom tramp-default-method "sm"
! ;;(if (featurep 'xemacs) "sm" "ftp")
"*Default method to use for transferring files.
See `tramp-methods' for possibilities.
Also see `tramp-default-method-alist'.
--- 635,641 ----
:group 'tramp
:type '(repeat (list string function string)))
! (defcustom tramp-default-method "ssh"
"*Default method to use for transferring files.
See `tramp-methods' for possibilities.
Also see `tramp-default-method-alist'.
***************
*** 707,715 ****
:type 'regexp)
(defcustom tramp-wrong-passwd-regexp
! (concat "^.*\\(Permission denied.\\|Login [Ii]ncorrect\\|"
! "Received signal [0-9]+\\|Connection \\(refused\\|closed\\)\\|"
! "Sorry, try again.\\|Name or service not known\\).*")
"*Regexp matching a `login failed' message.
The regexp should match at end of buffer."
:group 'tramp
--- 709,730 ----
:type 'regexp)
(defcustom tramp-wrong-passwd-regexp
! (concat "^.*"
! ;; These strings should be on the last line
! (regexp-opt '("Permission denied."
! "Login incorrect"
! "Login Incorrect"
! "Connection refused"
! "Connection closed"
! "Sorry, try again."
! "Name or service not known"
! "Host key verification failed.") t)
! ".*"
! "\\|"
! "^.*\\("
! ;; Here comes a list of regexes, separated by \\|
! "Received signal [0-9]+"
! "\\).*")
"*Regexp matching a `login failed' message.
The regexp should match at end of buffer."
:group 'tramp
***************
*** 1145,1150 ****
--- 1160,1170 ----
In the connection buffer, this variable has the value of the like-named
method parameter, as specified in `tramp-methods' (which see).")
+ (defvar tramp-su-program nil
+ "This internal variable holds a parameter for `tramp-methods'.
+ In the connection buffer, this variable has the value of the like-named
+ method parameter, as specified in `tramp-methods' (which see).")
+
;; CCC `local in each buffer'?
(defvar tramp-ls-command nil
"This command is used to get a long listing with numeric user and group ids.
***************
*** 1220,1232 ****
;; Escape sequence %s is replaced with name of Perl binary.")
;; These two use base64 encoding.
! (defvar tramp-perl-encode
"perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)'"
"Perl program to use for encoding a file.
Escape sequence %s is replaced with name of Perl binary.")
(defvar tramp-perl-decode
! "perl -MMIME::Base64 -0777 -ne 'print decode_base64($_)'"
"Perl program to use for decoding a file.
Escape sequence %s is replaced with name of Perl binary.")
--- 1240,1340 ----
;; Escape sequence %s is replaced with name of Perl binary.")
;; These two use base64 encoding.
! (defvar tramp-perl-encode-with-module
"perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)'"
"Perl program to use for encoding a file.
+ Escape sequence %s is replaced with name of Perl binary.
+ This implementation requires the MIME::Base64 Perl module to be installed
+ on the remote host.")
+
+ (defvar tramp-perl-decode-with-module
+ "perl -MMIME::Base64 -0777 -ne 'print decode_base64($_)'"
+ "Perl program to use for decoding a file.
+ Escape sequence %s is replaced with name of Perl binary.
+ This implementation requires the MIME::Base64 Perl module to be installed
+ on the remote host.")
+
+ (defvar tramp-perl-encode
+ "%s -e '
+ # This script contributed by Juanma Barranquero <address@hidden>.
+ # Copyright (C) 2002 Free Software Foundation, Inc.
+ use strict;
+
+ my %trans = do {
+ my $i = 0;
+ map {(substr(unpack(q(B8), chr $i++), 2, 6), $_)}
+ split //,
q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/);
+ };
+
+ binmode(\*STDIN);
+
+ # We read in chunks of 54 bytes, to generate output lines
+ # of 72 chars (plus end of line)
+ $/ = \54;
+
+ while (my $data = <STDIN>) {
+ my $pad = q();
+
+ # Only for the last chunk, and only if did not fill the last three-byte
packet
+ if (eof) {
+ my $mod = length($data) % 3;
+ $pad = q(=) x (3 - $mod) if $mod;
+ }
+
+ # Not the fastest method, but it is simple: unpack to binary string, split
+ # by groups of 6 bits and convert back from binary to byte; then map into
+ # the translation table
+ print
+ join q(),
+ map($trans{$_},
+ (substr(unpack(q(B*), $data) . q(00000), 0, 432) =~ /....../g)),
+ $pad,
+ qq(\n);
+ }
+ '"
+ "Perl program to use for encoding a file.
Escape sequence %s is replaced with name of Perl binary.")
(defvar tramp-perl-decode
! "%s -e '
! # This script contributed by Juanma Barranquero <address@hidden>.
! # Copyright (C) 2002 Free Software Foundation, Inc.
! use strict;
!
! my %trans = do {
! my $i = 0;
! map {($_, sprintf(q(%06b), $i++))}
! split //,
q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/)
! };
!
! my %bytes = map {(unpack(q(B8), chr $_), chr $_)} 0 .. 255;
!
! binmode(\*STDOUT);
!
! # We are going to accumulate into $pending to accept any line length
! # (we do not check they are <= 76 chars as the RFC says)
! my $pending = q();
!
! while (my $data = <STDIN>) {
! chomp $data;
!
! # If we find one or two =, we have reached the end and
! # any following data is to be discarded
! my $finished = $data =~ s/(==?).*/$1/;
! $pending .= $data;
!
! my $len = length($pending);
! my $chunk = substr($pending, 0, $len & ~3, q());
!
! # Easy method: translate from chars to (pregenerated) six-bit packets,
join,
! # split in 8-bit chunks and convert back to char.
! print join q(),
! map $bytes{$_},
! ((join q(), map {$trans{$_} || q()} split //, $chunk) =~ /......../g);
!
! last if $finished;
! }
! '"
"Perl program to use for decoding a file.
Escape sequence %s is replaced with name of Perl binary.")
***************
*** 1512,1521 ****
(defun tramp-handle-file-truename (filename &optional counter prev-dirs)
"Like `file-truename' for tramp files."
(with-parsed-tramp-file-name filename nil
! ;; Ange-FTP does not support truename processing. It returns the
! ;; file name as-is. So that's what we do, too.
(when (tramp-ange-ftp-file-name-p multi-method method)
! filename)
(let* ((steps (tramp-split-string path "/"))
(pathdir (let ((directory-sep-char ?/))
(file-name-as-directory path)))
--- 1620,1630 ----
(defun tramp-handle-file-truename (filename &optional counter prev-dirs)
"Like `file-truename' for tramp files."
(with-parsed-tramp-file-name filename nil
! ;; Ange-FTP does not support truename processing, but for
! ;; convenience we pretend it did and forward the call to Ange-FTP
! ;; anyway. Ange-FTP then just invokes `identity'.
(when (tramp-ange-ftp-file-name-p multi-method method)
! (tramp-invoke-ange-ftp 'file-truename filename))
(let* ((steps (tramp-split-string path "/"))
(pathdir (let ((directory-sep-char ?/))
(file-name-as-directory path)))
***************
*** 1546,1552 ****
(tramp-make-tramp-file-name
multi-method method user host
(mapconcat 'identity
! (append '("") (reverse result) (list
thisstep))
"/")))))
(cond ((string= "." thisstep)
(tramp-message-for-buffer multi-method method user host
--- 1655,1663 ----
(tramp-make-tramp-file-name
multi-method method user host
(mapconcat 'identity
! (append '("")
! (reverse result)
! (list thisstep))
"/")))))
(cond ((string= "." thisstep)
(tramp-message-for-buffer multi-method method user host
***************
*** 1733,1739 ****
(let ((f (buffer-file-name))
(coding-system-used nil))
(with-parsed-tramp-file-name f nil
! ;; This operation is not handled by Ange-FTP!
(when (tramp-ange-ftp-file-name-p multi-method method)
(throw 'tramp-forward-to-ange-ftp
(tramp-run-real-handler 'set-visited-file-modtime
--- 1844,1854 ----
(let ((f (buffer-file-name))
(coding-system-used nil))
(with-parsed-tramp-file-name f nil
! ;; This operation is not handled by Ange-FTP! Compare this
! ;; behavior with `file-truename' which Ange-FTP does not really
! ;; handle, either, but at least it pretends to. I wonder if
! ;; Ange-FTP should also pretend to grok
! ;; `set-visited-file-modtime', for consistency?
(when (tramp-ange-ftp-file-name-p multi-method method)
(throw 'tramp-forward-to-ange-ftp
(tramp-run-real-handler 'set-visited-file-modtime
***************
*** 2297,2309 ****
(with-parsed-tramp-file-name dir nil
(when (tramp-ange-ftp-file-name-p multi-method method)
(tramp-invoke-ange-ftp 'make-directory dir parents))
! (tramp-barf-unless-okay
! multi-method method user host
! (format " %s %s"
! (if parents "mkdir -p" "mkdir")
! (tramp-shell-quote-argument path))
! nil 'file-error
! "Couldn't make directory %s" dir)))
;; CCC error checking?
(defun tramp-handle-delete-directory (directory)
--- 2412,2425 ----
(with-parsed-tramp-file-name dir nil
(when (tramp-ange-ftp-file-name-p multi-method method)
(tramp-invoke-ange-ftp 'make-directory dir parents))
! (save-excursion
! (tramp-barf-unless-okay
! multi-method method user host
! (format " %s %s"
! (if parents "mkdir -p" "mkdir")
! (tramp-shell-quote-argument path))
! nil 'file-error
! "Couldn't make directory %s" dir))))
;; CCC error checking?
(defun tramp-handle-delete-directory (directory)
***************
*** 3087,3097 ****
(string-match "\\?" name)
(string-match "\\[.*\\]" name))
(save-excursion
- ;; Dissect NAME.
(let (bufstr)
- ;; Perhaps invoke Ange-FTP.
- (when (string= method tramp-ftp-method)
- (signal 'tramp-run-ange-ftp (list 0)))
;; CCC: To do it right, we should quote certain characters
;; in the file name, but since the echo command is going to
;; break anyway when there are spaces in the file names, we
--- 3203,3209 ----
***************
*** 3485,3493 ****
(defun tramp-action-permission-denied (p multi-method method user host)
"Signal permission denied."
(tramp-message 9 "Permission denied by remote host.")
(kill-process p)
- (erase-buffer)
(throw 'tramp-action 'permission-denied))
(defun tramp-action-yesno (p multi-method method user host)
--- 3597,3605 ----
(defun tramp-action-permission-denied (p multi-method method user host)
"Signal permission denied."
+ (pop-to-buffer (tramp-get-buffer multi-method method user host))
(tramp-message 9 "Permission denied by remote host.")
(kill-process p)
(throw 'tramp-action 'permission-denied))
(defun tramp-action-yesno (p multi-method method user host)
***************
*** 4399,4405 ****
" -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n"
"}"))
(tramp-wait-for-output)
! (tramp-message 5 "Sending the Perl `mime-encode' implementation.")
(tramp-send-linewise
multi-method method user host
(concat "tramp_encode () {\n"
--- 4511,4517 ----
" -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n"
"}"))
(tramp-wait-for-output)
! (tramp-message 5 "Sending the Perl `mime-encode' implementations.")
(tramp-send-linewise
multi-method method user host
(concat "tramp_encode () {\n"
***************
*** 4407,4419 ****
" 2>/dev/null"
"\n}"))
(tramp-wait-for-output)
! (tramp-message 5 "Sending the Perl `mime-decode' implementation.")
(tramp-send-linewise
multi-method method user host
(concat "tramp_decode () {\n"
(format tramp-perl-decode tramp-remote-perl)
" 2>/dev/null"
"\n}"))
(tramp-wait-for-output))))
;; Find ln(1)
(erase-buffer)
--- 4519,4545 ----
" 2>/dev/null"
"\n}"))
(tramp-wait-for-output)
! (tramp-send-linewise
! multi-method method user host
! (concat "tramp_encode_with_module () {\n"
! (format tramp-perl-encode-with-module tramp-remote-perl)
! " 2>/dev/null"
! "\n}"))
! (tramp-wait-for-output)
! (tramp-message 5 "Sending the Perl `mime-decode' implementations.")
(tramp-send-linewise
multi-method method user host
(concat "tramp_decode () {\n"
(format tramp-perl-decode tramp-remote-perl)
" 2>/dev/null"
"\n}"))
+ (tramp-wait-for-output)
+ (tramp-send-linewise
+ multi-method method user host
+ (concat "tramp_decode_with_module () {\n"
+ (format tramp-perl-decode-with-module tramp-remote-perl)
+ " 2>/dev/null"
+ "\n}"))
(tramp-wait-for-output))))
;; Find ln(1)
(erase-buffer)
***************
*** 4467,4472 ****
--- 4593,4600 ----
nil uudecode-decode-region)
("uuencode xxx" "uudecode -p"
nil uudecode-decode-region)
+ ("tramp_encode_with_module" "tramp_decode_with_module"
+ base64-encode-region base64-decode-region)
("tramp_encode" "tramp_decode"
base64-encode-region base64-decode-region))
"List of coding commands for inline transfer.
***************
*** 5537,5547 ****
;;; TODO:
! ;; * Revise the comments near the beginning of the file.
;; * Cooperate with PCL-CVS. It uses start-process, which doesn't
;; work for remote files.
;; * Rewrite `tramp-shell-quote-argument' to abstain from using
! ;; `shell-quote-argument'.
;; * Completion gets confused when you leave out the method name.
;; * Support `dired-compress-file' filename handler.
;; * In Emacs 21, `insert-directory' shows total number of bytes used
--- 5665,5686 ----
;;; TODO:
! ;; * Add fallback for inline encodings. This should be used
! ;; if the remote end doesn't support mimencode or a similar program.
! ;; For reading files from the remote host, we can just parse the output
! ;; of `od -b'. For writing files to the remote host, we construct
! ;; a shell program which contains only "safe" ascii characters
! ;; and which writes the right bytes to the file. We can use printf(1)
! ;; or "echo -e" or the printf function in awk and use octal escapes
! ;; for the "dangerous" characters. The null byte might be a problem.
! ;; On some systems, the octal escape doesn't work. So we try the following
! ;; two commands to write a null byte:
! ;; dd if=/dev/zero bs=1 count=1
! ;; echo | tr '\n' '\000'
;; * Cooperate with PCL-CVS. It uses start-process, which doesn't
;; work for remote files.
;; * Rewrite `tramp-shell-quote-argument' to abstain from using
! ;; `shell-quote-argument'.
;; * Completion gets confused when you leave out the method name.
;; * Support `dired-compress-file' filename handler.
;; * In Emacs 21, `insert-directory' shows total number of bytes used
- [Emacs-diffs] Changes to emacs/lisp/net/tramp.el,
Kai Großjohann <=
- [Emacs-diffs] Changes to emacs/lisp/net/tramp.el, Kai Großjohann, 2002/08/03
- [Emacs-diffs] Changes to emacs/lisp/net/tramp.el, Kai Großjohann, 2002/08/03
- [Emacs-diffs] Changes to emacs/lisp/net/tramp.el, Andreas Schwab, 2002/08/03
- [Emacs-diffs] Changes to emacs/lisp/net/tramp.el, Kai Großjohann, 2002/08/04
- [Emacs-diffs] Changes to emacs/lisp/net/tramp.el, Kai Großjohann, 2002/08/04
- [Emacs-diffs] Changes to emacs/lisp/net/tramp.el, Kai Großjohann, 2002/08/05
- [Emacs-diffs] Changes to emacs/lisp/net/tramp.el, Kai Großjohann, 2002/08/07
- [Emacs-diffs] Changes to emacs/lisp/net/tramp.el, Kai Großjohann, 2002/08/21
- [Emacs-diffs] Changes to emacs/lisp/net/tramp.el, Kai Großjohann, 2002/08/22