aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Großjohann2002-08-03 09:23:25 +0000
committerKai Großjohann2002-08-03 09:23:25 +0000
commitb1d06e759a648bf657b510ca8d0234f097c51c10 (patch)
tree2dcec272c5e83ae002cd5e18daed5a978d896381
parent336cd99d1bf52bc68e1aab92f4a6e4e390b0407f (diff)
downloademacs-b1d06e759a648bf657b510ca8d0234f097c51c10.tar.gz
emacs-b1d06e759a648bf657b510ca8d0234f097c51c10.zip
Version 2.0.6.
(tramp-default-method): Change to "ssh" from "sm". (tramp-wrong-passwd-regexp): Restructure. Add additional alternative. (tramp-su-program): New internal variable for method parameter. (tramp-perl-encode-with-module, tramp-perl-decode-with-module): New variables. Very short Perl one-liner, but requires Perl module MIME::Base64 to be installed on the remote site. (tramp-perl-encode, tramp-perl-decode): New base64 encoder/decoder. From Juanma Barranquero <lektu@terra.es>. (tramp-handle-file-truename): Invoke Ange-FTP properly (even though Ange-FTP doesn't do anything for this operation). (tramp-handle-set-visited-file-modtime): Comment change. (tramp-handle-make-directory): Save-excursion. (tramp-handle-expand-many-files): Don't try to invoke Ange-FTP twice, once is enough. (tramp-action-permission-denied): Show *tramp/foo* buffer so the user knows what's wrong. (tramp-post-connection): Support the two Perl encoders and decoders. (tramp-coding-commands): Ditto. Add some todo items.
-rw-r--r--lisp/ChangeLog24
-rw-r--r--lisp/net/tramp.el197
2 files changed, 192 insertions, 29 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 8853ba55178..fd3be9a8166 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,27 @@
12002-08-03 Kai Gro,b_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
2
3 * net/tramp.el: Version 2.0.6.
4 (tramp-default-method): Change to "ssh" from "sm".
5 (tramp-wrong-passwd-regexp): Restructure. Add additional
6 alternative.
7 (tramp-su-program): New internal variable for method parameter.
8 (tramp-perl-encode-with-module, tramp-perl-decode-with-module):
9 New variables. Very short Perl one-liner, but requires Perl
10 module MIME::Base64 to be installed on the remote site.
11 (tramp-perl-encode, tramp-perl-decode): New base64
12 encoder/decoder. From Juanma Barranquero <lektu@terra.es>.
13 (tramp-handle-file-truename): Invoke Ange-FTP properly (even
14 though Ange-FTP doesn't do anything for this operation).
15 (tramp-handle-set-visited-file-modtime): Comment change.
16 (tramp-handle-make-directory): Save-excursion.
17 (tramp-handle-expand-many-files): Don't try to invoke Ange-FTP
18 twice, once is enough.
19 (tramp-action-permission-denied): Show *tramp/foo* buffer so the
20 user knows what's wrong.
21 (tramp-post-connection): Support the two Perl encoders and
22 decoders.
23 (tramp-coding-commands): Ditto. Add some todo items.
24
12002-08-02 Richard M. Stallman <rms@gnu.org> 252002-08-02 Richard M. Stallman <rms@gnu.org>
2 26
3 * international/mule.el (merge-coding-systems): New function. 27 * international/mule.el (merge-coding-systems): New function.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 26141c0aa20..e6a13a07489 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -69,7 +69,10 @@
69 69
70;;; Code: 70;;; Code:
71 71
72(defconst tramp-version "2.0.5" 72;; In the Tramp CVS repository, the version numer is auto-frobbed from
73;; the Makefile, so you should edit the top-level Makefile to change
74;; the version number.
75(defconst tramp-version "2.0.6"
73 "This version of tramp.") 76 "This version of tramp.")
74 77
75(defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org" 78(defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org"
@@ -632,8 +635,7 @@ various functions for details."
632 :group 'tramp 635 :group 'tramp
633 :type '(repeat (list string function string))) 636 :type '(repeat (list string function string)))
634 637
635(defcustom tramp-default-method "sm" 638(defcustom tramp-default-method "ssh"
636 ;;(if (featurep 'xemacs) "sm" "ftp")
637 "*Default method to use for transferring files. 639 "*Default method to use for transferring files.
638See `tramp-methods' for possibilities. 640See `tramp-methods' for possibilities.
639Also see `tramp-default-method-alist'. 641Also see `tramp-default-method-alist'.
@@ -707,9 +709,22 @@ The `sudo' program appears to insert a `^@' character into the prompt."
707 :type 'regexp) 709 :type 'regexp)
708 710
709(defcustom tramp-wrong-passwd-regexp 711(defcustom tramp-wrong-passwd-regexp
710 (concat "^.*\\(Permission denied.\\|Login [Ii]ncorrect\\|" 712 (concat "^.*"
711 "Received signal [0-9]+\\|Connection \\(refused\\|closed\\)\\|" 713 ;; These strings should be on the last line
712 "Sorry, try again.\\|Name or service not known\\).*") 714 (regexp-opt '("Permission denied."
715 "Login incorrect"
716 "Login Incorrect"
717 "Connection refused"
718 "Connection closed"
719 "Sorry, try again."
720 "Name or service not known"
721 "Host key verification failed.") t)
722 ".*"
723 "\\|"
724 "^.*\\("
725 ;; Here comes a list of regexes, separated by \\|
726 "Received signal [0-9]+"
727 "\\).*")
713 "*Regexp matching a `login failed' message. 728 "*Regexp matching a `login failed' message.
714The regexp should match at end of buffer." 729The regexp should match at end of buffer."
715 :group 'tramp 730 :group 'tramp
@@ -1145,6 +1160,11 @@ method parameter, as specified in `tramp-methods' (which see).")
1145In the connection buffer, this variable has the value of the like-named 1160In the connection buffer, this variable has the value of the like-named
1146method parameter, as specified in `tramp-methods' (which see).") 1161method parameter, as specified in `tramp-methods' (which see).")
1147 1162
1163(defvar tramp-su-program nil
1164 "This internal variable holds a parameter for `tramp-methods'.
1165In the connection buffer, this variable has the value of the like-named
1166method parameter, as specified in `tramp-methods' (which see).")
1167
1148;; CCC `local in each buffer'? 1168;; CCC `local in each buffer'?
1149(defvar tramp-ls-command nil 1169(defvar tramp-ls-command nil
1150 "This command is used to get a long listing with numeric user and group ids. 1170 "This command is used to get a long listing with numeric user and group ids.
@@ -1220,13 +1240,101 @@ on the remote file system.")
1220;; Escape sequence %s is replaced with name of Perl binary.") 1240;; Escape sequence %s is replaced with name of Perl binary.")
1221 1241
1222;; These two use base64 encoding. 1242;; These two use base64 encoding.
1223(defvar tramp-perl-encode 1243(defvar tramp-perl-encode-with-module
1224 "perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)'" 1244 "perl -MMIME::Base64 -0777 -ne 'print encode_base64($_)'"
1225 "Perl program to use for encoding a file. 1245 "Perl program to use for encoding a file.
1246Escape sequence %s is replaced with name of Perl binary.
1247This implementation requires the MIME::Base64 Perl module to be installed
1248on the remote host.")
1249
1250(defvar tramp-perl-decode-with-module
1251 "perl -MMIME::Base64 -0777 -ne 'print decode_base64($_)'"
1252 "Perl program to use for decoding a file.
1253Escape sequence %s is replaced with name of Perl binary.
1254This implementation requires the MIME::Base64 Perl module to be installed
1255on the remote host.")
1256
1257(defvar tramp-perl-encode
1258 "%s -e '
1259# This script contributed by Juanma Barranquero <lektu@terra.es>.
1260# Copyright (C) 2002 Free Software Foundation, Inc.
1261use strict;
1262
1263my %trans = do {
1264 my $i = 0;
1265 map {(substr(unpack(q(B8), chr $i++), 2, 6), $_)}
1266 split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/);
1267};
1268
1269binmode(\*STDIN);
1270
1271# We read in chunks of 54 bytes, to generate output lines
1272# of 72 chars (plus end of line)
1273$/ = \54;
1274
1275while (my $data = <STDIN>) {
1276 my $pad = q();
1277
1278 # Only for the last chunk, and only if did not fill the last three-byte packet
1279 if (eof) {
1280 my $mod = length($data) % 3;
1281 $pad = q(=) x (3 - $mod) if $mod;
1282 }
1283
1284 # Not the fastest method, but it is simple: unpack to binary string, split
1285 # by groups of 6 bits and convert back from binary to byte; then map into
1286 # the translation table
1287 print
1288 join q(),
1289 map($trans{$_},
1290 (substr(unpack(q(B*), $data) . q(00000), 0, 432) =~ /....../g)),
1291 $pad,
1292 qq(\n);
1293}
1294'"
1295 "Perl program to use for encoding a file.
1226Escape sequence %s is replaced with name of Perl binary.") 1296Escape sequence %s is replaced with name of Perl binary.")
1227 1297
1228(defvar tramp-perl-decode 1298(defvar tramp-perl-decode
1229 "perl -MMIME::Base64 -0777 -ne 'print decode_base64($_)'" 1299 "%s -e '
1300# This script contributed by Juanma Barranquero <lektu@terra.es>.
1301# Copyright (C) 2002 Free Software Foundation, Inc.
1302use strict;
1303
1304my %trans = do {
1305 my $i = 0;
1306 map {($_, sprintf(q(%06b), $i++))}
1307 split //, q(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/)
1308};
1309
1310my %bytes = map {(unpack(q(B8), chr $_), chr $_)} 0 .. 255;
1311
1312binmode(\*STDOUT);
1313
1314# We are going to accumulate into $pending to accept any line length
1315# (we do not check they are <= 76 chars as the RFC says)
1316my $pending = q();
1317
1318while (my $data = <STDIN>) {
1319 chomp $data;
1320
1321 # If we find one or two =, we have reached the end and
1322 # any following data is to be discarded
1323 my $finished = $data =~ s/(==?).*/$1/;
1324 $pending .= $data;
1325
1326 my $len = length($pending);
1327 my $chunk = substr($pending, 0, $len & ~3, q());
1328
1329 # Easy method: translate from chars to (pregenerated) six-bit packets, join,
1330 # split in 8-bit chunks and convert back to char.
1331 print join q(),
1332 map $bytes{$_},
1333 ((join q(), map {$trans{$_} || q()} split //, $chunk) =~ /......../g);
1334
1335 last if $finished;
1336}
1337'"
1230 "Perl program to use for decoding a file. 1338 "Perl program to use for decoding a file.
1231Escape sequence %s is replaced with name of Perl binary.") 1339Escape sequence %s is replaced with name of Perl binary.")
1232 1340
@@ -1512,10 +1620,11 @@ target of the symlink differ."
1512(defun tramp-handle-file-truename (filename &optional counter prev-dirs) 1620(defun tramp-handle-file-truename (filename &optional counter prev-dirs)
1513 "Like `file-truename' for tramp files." 1621 "Like `file-truename' for tramp files."
1514 (with-parsed-tramp-file-name filename nil 1622 (with-parsed-tramp-file-name filename nil
1515 ;; Ange-FTP does not support truename processing. It returns the 1623 ;; Ange-FTP does not support truename processing, but for
1516 ;; file name as-is. So that's what we do, too. 1624 ;; convenience we pretend it did and forward the call to Ange-FTP
1625 ;; anyway. Ange-FTP then just invokes `identity'.
1517 (when (tramp-ange-ftp-file-name-p multi-method method) 1626 (when (tramp-ange-ftp-file-name-p multi-method method)
1518 filename) 1627 (tramp-invoke-ange-ftp 'file-truename filename))
1519 (let* ((steps (tramp-split-string path "/")) 1628 (let* ((steps (tramp-split-string path "/"))
1520 (pathdir (let ((directory-sep-char ?/)) 1629 (pathdir (let ((directory-sep-char ?/))
1521 (file-name-as-directory path))) 1630 (file-name-as-directory path)))
@@ -1546,7 +1655,9 @@ target of the symlink differ."
1546 (tramp-make-tramp-file-name 1655 (tramp-make-tramp-file-name
1547 multi-method method user host 1656 multi-method method user host
1548 (mapconcat 'identity 1657 (mapconcat 'identity
1549 (append '("") (reverse result) (list thisstep)) 1658 (append '("")
1659 (reverse result)
1660 (list thisstep))
1550 "/"))))) 1661 "/")))))
1551 (cond ((string= "." thisstep) 1662 (cond ((string= "." thisstep)
1552 (tramp-message-for-buffer multi-method method user host 1663 (tramp-message-for-buffer multi-method method user host
@@ -1733,7 +1844,11 @@ is initially created and is kept cached by the remote shell."
1733 (let ((f (buffer-file-name)) 1844 (let ((f (buffer-file-name))
1734 (coding-system-used nil)) 1845 (coding-system-used nil))
1735 (with-parsed-tramp-file-name f nil 1846 (with-parsed-tramp-file-name f nil
1736 ;; This operation is not handled by Ange-FTP! 1847 ;; This operation is not handled by Ange-FTP! Compare this
1848 ;; behavior with `file-truename' which Ange-FTP does not really
1849 ;; handle, either, but at least it pretends to. I wonder if
1850 ;; Ange-FTP should also pretend to grok
1851 ;; `set-visited-file-modtime', for consistency?
1737 (when (tramp-ange-ftp-file-name-p multi-method method) 1852 (when (tramp-ange-ftp-file-name-p multi-method method)
1738 (throw 'tramp-forward-to-ange-ftp 1853 (throw 'tramp-forward-to-ange-ftp
1739 (tramp-run-real-handler 'set-visited-file-modtime 1854 (tramp-run-real-handler 'set-visited-file-modtime
@@ -2297,13 +2412,14 @@ If KEEP-DATE is non-nil, preserve the time stamp when copying."
2297 (with-parsed-tramp-file-name dir nil 2412 (with-parsed-tramp-file-name dir nil
2298 (when (tramp-ange-ftp-file-name-p multi-method method) 2413 (when (tramp-ange-ftp-file-name-p multi-method method)
2299 (tramp-invoke-ange-ftp 'make-directory dir parents)) 2414 (tramp-invoke-ange-ftp 'make-directory dir parents))
2300 (tramp-barf-unless-okay 2415 (save-excursion
2301 multi-method method user host 2416 (tramp-barf-unless-okay
2302 (format " %s %s" 2417 multi-method method user host
2303 (if parents "mkdir -p" "mkdir") 2418 (format " %s %s"
2304 (tramp-shell-quote-argument path)) 2419 (if parents "mkdir -p" "mkdir")
2305 nil 'file-error 2420 (tramp-shell-quote-argument path))
2306 "Couldn't make directory %s" dir))) 2421 nil 'file-error
2422 "Couldn't make directory %s" dir))))
2307 2423
2308;; CCC error checking? 2424;; CCC error checking?
2309(defun tramp-handle-delete-directory (directory) 2425(defun tramp-handle-delete-directory (directory)
@@ -3087,11 +3203,7 @@ necessary anymore."
3087 (string-match "\\?" name) 3203 (string-match "\\?" name)
3088 (string-match "\\[.*\\]" name)) 3204 (string-match "\\[.*\\]" name))
3089 (save-excursion 3205 (save-excursion
3090 ;; Dissect NAME.
3091 (let (bufstr) 3206 (let (bufstr)
3092 ;; Perhaps invoke Ange-FTP.
3093 (when (string= method tramp-ftp-method)
3094 (signal 'tramp-run-ange-ftp (list 0)))
3095 ;; CCC: To do it right, we should quote certain characters 3207 ;; CCC: To do it right, we should quote certain characters
3096 ;; in the file name, but since the echo command is going to 3208 ;; in the file name, but since the echo command is going to
3097 ;; break anyway when there are spaces in the file names, we 3209 ;; break anyway when there are spaces in the file names, we
@@ -3485,9 +3597,9 @@ Returns nil if none was found, else the command is returned."
3485 3597
3486(defun tramp-action-permission-denied (p multi-method method user host) 3598(defun tramp-action-permission-denied (p multi-method method user host)
3487 "Signal permission denied." 3599 "Signal permission denied."
3600 (pop-to-buffer (tramp-get-buffer multi-method method user host))
3488 (tramp-message 9 "Permission denied by remote host.") 3601 (tramp-message 9 "Permission denied by remote host.")
3489 (kill-process p) 3602 (kill-process p)
3490 (erase-buffer)
3491 (throw 'tramp-action 'permission-denied)) 3603 (throw 'tramp-action 'permission-denied))
3492 3604
3493(defun tramp-action-yesno (p multi-method method user host) 3605(defun tramp-action-yesno (p multi-method method user host)
@@ -4399,7 +4511,7 @@ locale to C and sets up the remote shell search path."
4399 " -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n" 4511 " -e '" tramp-perl-file-attributes "' $1 2>/dev/null\n"
4400 "}")) 4512 "}"))
4401 (tramp-wait-for-output) 4513 (tramp-wait-for-output)
4402 (tramp-message 5 "Sending the Perl `mime-encode' implementation.") 4514 (tramp-message 5 "Sending the Perl `mime-encode' implementations.")
4403 (tramp-send-linewise 4515 (tramp-send-linewise
4404 multi-method method user host 4516 multi-method method user host
4405 (concat "tramp_encode () {\n" 4517 (concat "tramp_encode () {\n"
@@ -4407,13 +4519,27 @@ locale to C and sets up the remote shell search path."
4407 " 2>/dev/null" 4519 " 2>/dev/null"
4408 "\n}")) 4520 "\n}"))
4409 (tramp-wait-for-output) 4521 (tramp-wait-for-output)
4410 (tramp-message 5 "Sending the Perl `mime-decode' implementation.") 4522 (tramp-send-linewise
4523 multi-method method user host
4524 (concat "tramp_encode_with_module () {\n"
4525 (format tramp-perl-encode-with-module tramp-remote-perl)
4526 " 2>/dev/null"
4527 "\n}"))
4528 (tramp-wait-for-output)
4529 (tramp-message 5 "Sending the Perl `mime-decode' implementations.")
4411 (tramp-send-linewise 4530 (tramp-send-linewise
4412 multi-method method user host 4531 multi-method method user host
4413 (concat "tramp_decode () {\n" 4532 (concat "tramp_decode () {\n"
4414 (format tramp-perl-decode tramp-remote-perl) 4533 (format tramp-perl-decode tramp-remote-perl)
4415 " 2>/dev/null" 4534 " 2>/dev/null"
4416 "\n}")) 4535 "\n}"))
4536 (tramp-wait-for-output)
4537 (tramp-send-linewise
4538 multi-method method user host
4539 (concat "tramp_decode_with_module () {\n"
4540 (format tramp-perl-decode-with-module tramp-remote-perl)
4541 " 2>/dev/null"
4542 "\n}"))
4417 (tramp-wait-for-output)))) 4543 (tramp-wait-for-output))))
4418 ;; Find ln(1) 4544 ;; Find ln(1)
4419 (erase-buffer) 4545 (erase-buffer)
@@ -4467,6 +4593,8 @@ locale to C and sets up the remote shell search path."
4467 nil uudecode-decode-region) 4593 nil uudecode-decode-region)
4468 ("uuencode xxx" "uudecode -p" 4594 ("uuencode xxx" "uudecode -p"
4469 nil uudecode-decode-region) 4595 nil uudecode-decode-region)
4596 ("tramp_encode_with_module" "tramp_decode_with_module"
4597 base64-encode-region base64-decode-region)
4470 ("tramp_encode" "tramp_decode" 4598 ("tramp_encode" "tramp_decode"
4471 base64-encode-region base64-decode-region)) 4599 base64-encode-region base64-decode-region))
4472 "List of coding commands for inline transfer. 4600 "List of coding commands for inline transfer.
@@ -5537,11 +5665,22 @@ TRAMP.
5537 5665
5538;;; TODO: 5666;;; TODO:
5539 5667
5540;; * Revise the comments near the beginning of the file. 5668;; * Add fallback for inline encodings. This should be used
5669;; if the remote end doesn't support mimencode or a similar program.
5670;; For reading files from the remote host, we can just parse the output
5671;; of `od -b'. For writing files to the remote host, we construct
5672;; a shell program which contains only "safe" ascii characters
5673;; and which writes the right bytes to the file. We can use printf(1)
5674;; or "echo -e" or the printf function in awk and use octal escapes
5675;; for the "dangerous" characters. The null byte might be a problem.
5676;; On some systems, the octal escape doesn't work. So we try the following
5677;; two commands to write a null byte:
5678;; dd if=/dev/zero bs=1 count=1
5679;; echo | tr '\n' '\000'
5541;; * Cooperate with PCL-CVS. It uses start-process, which doesn't 5680;; * Cooperate with PCL-CVS. It uses start-process, which doesn't
5542;; work for remote files. 5681;; work for remote files.
5543;; * Rewrite `tramp-shell-quote-argument' to abstain from using 5682;; * Rewrite `tramp-shell-quote-argument' to abstain from using
5544;; `shell-quote-argument'. 5683;; `shell-quote-argument'.
5545;; * Completion gets confused when you leave out the method name. 5684;; * Completion gets confused when you leave out the method name.
5546;; * Support `dired-compress-file' filename handler. 5685;; * Support `dired-compress-file' filename handler.
5547;; * In Emacs 21, `insert-directory' shows total number of bytes used 5686;; * In Emacs 21, `insert-directory' shows total number of bytes used