aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2015-03-04 11:02:36 +0100
committerMichael Albinus2015-03-04 11:02:36 +0100
commit8ac08792a71e07bce0e62d93bed80553fbe95a40 (patch)
treef881f335b598b400c2023e5441d851f208203b44
parent5d9b1e100aa4ddb79471f7ec2347fdb65d6a9a70 (diff)
downloademacs-8ac08792a71e07bce0e62d93bed80553fbe95a40.tar.gz
emacs-8ac08792a71e07bce0e62d93bed80553fbe95a40.zip
Sync with Tramp upstream.
* net/tramp-cache.el (tramp-dump-connection-properties): Use `with-temp-file'. * net/tramp-sh.el (tramp-perl-file-attributes) (tramp-perl-directory-files-and-attributes): Escape apostrophs in file names. (tramp-do-file-attributes-with-stat): Quote file name. (tramp-sh-handle-directory-files-and-attributes): Fall back to `tramp-handle-directory-files-and-attributes' in case of problems. (tramp-do-directory-files-and-attributes-with-stat) (tramp-sh-handle-file-name-all-completions) (tramp-sh-handle-delete-directory) (tramp-sh-handle-expand-file-name, tramp-sh-handle-process-file): Normalize use of "cd". (tramp-do-directory-files-and-attributes-with-stat): Use the `quoting-style' arg of `ls' if possible. Make it also working for file names with apostrophs. (tramp-sh-handle-file-name-all-completions): Use arguments of `ls' in proper order. (tramp-do-copy-or-rename-file-via-buffer) (tramp-sh-handle-file-local-copy): Use `with-temp-file'. (tramp-get-remote-locale): Accept also \r in output. (tramp-get-ls-command-with-quoting-style): New defun. (tramp-get-inline-coding): Set `default-directory' to a local directory. Sporadically, `call-process-region' does not handle a remote default directory properly. * net/tramp.el (tramp): Add :link property. (tramp-login-prompt-regexp): Allow also "user", as required by Fritz!Box telnet. (tramp-autoload-file-name-handler): Use "/". (tramp-handle-unhandled-file-name-directory): Return nil when required by the spec. * net/trampver.el: Update release number.
-rw-r--r--lisp/ChangeLog38
-rw-r--r--lisp/net/tramp-cache.el6
-rw-r--r--lisp/net/tramp-sh.el186
-rw-r--r--lisp/net/tramp.el14
-rw-r--r--lisp/net/trampver.el4
5 files changed, 152 insertions, 96 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 60e2b50e5c4..8d7360f899c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,41 @@
12015-03-04 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp): Add :link property.
4 (tramp-login-prompt-regexp): Allow also "user", as required by
5 Fritz!Box telnet.
6 (tramp-autoload-file-name-handler): Use "/".
7 (tramp-handle-unhandled-file-name-directory): Return nil when
8 required by the spec.
9
10 * net/tramp-cache.el (tramp-dump-connection-properties):
11 Use `with-temp-file'.
12
13 * net/tramp-sh.el (tramp-perl-file-attributes)
14 (tramp-perl-directory-files-and-attributes): Escape apostrophs in
15 file names.
16 (tramp-do-file-attributes-with-stat): Quote file name.
17 (tramp-sh-handle-directory-files-and-attributes): Fall back to
18 `tramp-handle-directory-files-and-attributes' in case of problems.
19 (tramp-do-directory-files-and-attributes-with-stat)
20 (tramp-sh-handle-file-name-all-completions)
21 (tramp-sh-handle-delete-directory)
22 (tramp-sh-handle-expand-file-name, tramp-sh-handle-process-file):
23 Normalize use of "cd".
24 (tramp-do-directory-files-and-attributes-with-stat): Use the
25 `quoting-style' arg of `ls' if possible. Make it also working for
26 file names with apostrophs.
27 (tramp-sh-handle-file-name-all-completions): Use arguments of `ls'
28 in proper order.
29 (tramp-do-copy-or-rename-file-via-buffer)
30 (tramp-sh-handle-file-local-copy): Use `with-temp-file'.
31 (tramp-get-remote-locale): Accept also \r in output.
32 (tramp-get-ls-command-with-quoting-style): New defun.
33 (tramp-get-inline-coding): Set `default-directory' to a local
34 directory. Sporadically, `call-process-region' does not handle a
35 remote default directory properly.
36
37 * net/trampver.el: Update release number.
38
12015-03-03 Agustín Martín Domingo <agustin6martin@gmail.com> 392015-03-03 Agustín Martín Domingo <agustin6martin@gmail.com>
2 40
3 * textmodes/ispell.el (ispell-aspell-find-dictionary): Make sure 41 * textmodes/ispell.el (ispell-aspell-find-dictionary): Make sure
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index fb9d5e84c94..1e24ea53f43 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -362,7 +362,7 @@ KEY identifies the connection, it is either a process or a vector."
362 (remhash key cache))) 362 (remhash key cache)))
363 cache) 363 cache)
364 ;; Dump it. 364 ;; Dump it.
365 (with-temp-buffer 365 (with-temp-file tramp-persistency-file-name
366 (insert 366 (insert
367 ";; -*- emacs-lisp -*-" 367 ";; -*- emacs-lisp -*-"
368 ;; `time-stamp-string' might not exist in all (X)Emacs flavors. 368 ;; `time-stamp-string' might not exist in all (X)Emacs flavors.
@@ -376,9 +376,7 @@ KEY identifies the connection, it is either a process or a vector."
376 ";; Tramp connection history. Don't change this file.\n" 376 ";; Tramp connection history. Don't change this file.\n"
377 ";; You can delete it, forcing Tramp to reapply the checks.\n\n" 377 ";; You can delete it, forcing Tramp to reapply the checks.\n\n"
378 (with-output-to-string 378 (with-output-to-string
379 (pp (read (format "(%s)" (tramp-cache-print cache)))))) 379 (pp (read (format "(%s)" (tramp-cache-print cache)))))))))))
380 (write-region
381 (point-min) (point-max) tramp-persistency-file-name))))))
382 380
383(unless noninteractive 381(unless noninteractive
384 (add-hook 'kill-emacs-hook 'tramp-dump-connection-properties)) 382 (add-hook 'kill-emacs-hook 'tramp-dump-connection-properties))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index f3fdb63bb9e..580c5d08ecd 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -631,6 +631,7 @@ if (!@stat) {
631if (($stat[2] & 0170000) == 0120000) 631if (($stat[2] & 0170000) == 0120000)
632{ 632{
633 $type = readlink($ARGV[0]); 633 $type = readlink($ARGV[0]);
634 $type =~ s/\"/\\\\\"/g;
634 $type = \"\\\"$type\\\"\"; 635 $type = \"\\\"$type\\\"\";
635} 636}
636elsif (($stat[2] & 0170000) == 040000) 637elsif (($stat[2] & 0170000) == 040000)
@@ -680,6 +681,7 @@ for($i = 0; $i < $n; $i++)
680 if (($stat[2] & 0170000) == 0120000) 681 if (($stat[2] & 0170000) == 0120000)
681 { 682 {
682 $type = readlink($filename); 683 $type = readlink($filename);
684 $type =~ s/\"/\\\\\"/g;
683 $type = \"\\\"$type\\\"\"; 685 $type = \"\\\"$type\\\"\";
684 } 686 }
685 elsif (($stat[2] & 0170000) == 040000) 687 elsif (($stat[2] & 0170000) == 040000)
@@ -692,6 +694,7 @@ for($i = 0; $i < $n; $i++)
692 }; 694 };
693 $uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\"; 695 $uid = ($ARGV[1] eq \"integer\") ? $stat[4] : \"\\\"\" . getpwuid($stat[4]) . \"\\\"\";
694 $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\"; 696 $gid = ($ARGV[1] eq \"integer\") ? $stat[5] : \"\\\"\" . getgrgid($stat[5]) . \"\\\"\";
697 $filename =~ s/\"/\\\\\"/g;
695 printf( 698 printf(
696 \"(\\\"%%s\\\" %%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t (%%u . %%u) (%%u . %%u))\\n\", 699 \"(\\\"%%s\\\" %%s %%u %%s %%s (%%u %%u) (%%u %%u) (%%u %%u) %%u.0 %%u t (%%u . %%u) (%%u . %%u))\\n\",
697 $filename, 700 $filename,
@@ -1250,7 +1253,7 @@ target of the symlink differ."
1250 (format 1253 (format
1251 ;; On Opsware, pdksh (which is the true name of ksh there) doesn't 1254 ;; On Opsware, pdksh (which is the true name of ksh there) doesn't
1252 ;; parse correctly the sequence "((". Therefore, we add a space. 1255 ;; parse correctly the sequence "((". Therefore, we add a space.
1253 "( (%s %s || %s -h %s) && %s -c '((\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)' %s || echo nil)" 1256 "( (%s %s || %s -h %s) && %s -c '((\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)' \"%s\" || echo nil)"
1254 (tramp-get-file-exists-command vec) 1257 (tramp-get-file-exists-command vec)
1255 (tramp-shell-quote-argument localname) 1258 (tramp-shell-quote-argument localname)
1256 (tramp-get-test-command vec) 1259 (tramp-get-test-command vec)
@@ -1626,45 +1629,44 @@ be non-negative integers."
1626(defun tramp-sh-handle-directory-files-and-attributes 1629(defun tramp-sh-handle-directory-files-and-attributes
1627 (directory &optional full match nosort id-format) 1630 (directory &optional full match nosort id-format)
1628 "Like `directory-files-and-attributes' for Tramp files." 1631 "Like `directory-files-and-attributes' for Tramp files."
1629 (if (with-parsed-tramp-file-name directory nil 1632 (unless id-format (setq id-format 'integer))
1630 (not (or (tramp-get-remote-stat v) (tramp-get-remote-perl v)))) 1633 (when (file-directory-p directory)
1631 (tramp-handle-directory-files-and-attributes 1634 (setq directory (expand-file-name directory))
1632 directory full match nosort id-format) 1635 (let* ((temp
1633 1636 (copy-tree
1634 ;; Do it directly. 1637 (with-parsed-tramp-file-name directory nil
1635 (unless id-format (setq id-format 'integer)) 1638 (with-tramp-file-property
1636 (when (file-directory-p directory) 1639 v localname
1637 (setq directory (expand-file-name directory)) 1640 (format "directory-files-and-attributes-%s" id-format)
1638 (let* ((temp 1641 (save-excursion
1639 (copy-tree 1642 (mapcar
1640 (with-parsed-tramp-file-name directory nil 1643 (lambda (x)
1641 (with-tramp-file-property 1644 (cons (car x)
1642 v localname 1645 (tramp-convert-file-attributes v (cdr x))))
1643 (format "directory-files-and-attributes-%s" id-format) 1646 (or
1644 (save-excursion 1647 (cond
1645 (mapcar 1648 ((tramp-get-remote-stat v)
1646 (lambda (x) 1649 (tramp-do-directory-files-and-attributes-with-stat
1647 (cons (car x) 1650 v localname id-format))
1648 (tramp-convert-file-attributes v (cdr x)))) 1651 ((tramp-get-remote-perl v)
1649 (cond 1652 (tramp-do-directory-files-and-attributes-with-perl
1650 ((tramp-get-remote-stat v) 1653 v localname id-format))
1651 (tramp-do-directory-files-and-attributes-with-stat 1654 (t nil)))))))))
1652 v localname id-format)) 1655 result item)
1653 ((tramp-get-remote-perl v) 1656
1654 (tramp-do-directory-files-and-attributes-with-perl 1657 (while temp
1655 v localname id-format))))))))) 1658 (setq item (pop temp))
1656 result item) 1659 (when (or (null match) (string-match match (car item)))
1657 1660 (when full
1658 (while temp 1661 (setcar item (expand-file-name (car item) directory)))
1659 (setq item (pop temp)) 1662 (push item result)))
1660 (when (or (null match) (string-match match (car item))) 1663
1661 (when full 1664 (or (if nosort
1662 (setcar item (expand-file-name (car item) directory))) 1665 result
1663 (push item result))) 1666 (sort result (lambda (x y) (string< (car x) (car y)))))
1664 1667 ;; The scripts could fail, for example with huge file size.
1665 (if nosort 1668 (tramp-handle-directory-files-and-attributes
1666 result 1669 directory full match nosort id-format)))))
1667 (sort result (lambda (x y) (string< (car x) (car y)))))))))
1668 1670
1669(defun tramp-do-directory-files-and-attributes-with-perl 1671(defun tramp-do-directory-files-and-attributes-with-perl
1670 (vec localname &optional id-format) 1672 (vec localname &optional id-format)
@@ -1692,16 +1694,22 @@ be non-negative integers."
1692 ;; We must care about file names with spaces, or starting with 1694 ;; We must care about file names with spaces, or starting with
1693 ;; "-"; this would confuse xargs. "ls -aQ" might be a solution, 1695 ;; "-"; this would confuse xargs. "ls -aQ" might be a solution,
1694 ;; but it does not work on all remote systems. Therefore, we 1696 ;; but it does not work on all remote systems. Therefore, we
1695 ;; quote the file names via sed. 1697 ;; use \000 as file separator.
1696 "cd %s; echo \"(\"; (%s -a | sed -e s/\\$/\\\"/g -e s/^/\\\"/g | " 1698 ;; Apostrophs in the stat output are masked as \037 character, in
1699 ;; order to make a proper shell escape of them in file names.
1700 "cd %s && echo \"(\"; (%s %s -a | "
1697 "xargs %s -c " 1701 "xargs %s -c "
1698 "'(\"%%n\" (\"%%N\") %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \"%%A\" t %%ie0 -1)'" 1702 "'(\037%%n\037 (\037%%N\037) %%h %s %s %%Xe0 %%Ye0 %%Ze0 %%se0 \037%%A\037 t %%ie0 -1)'"
1699 " 2>/dev/null); echo \")\"") 1703 " -- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/\037/\"/g'); echo \")\"")
1700 (tramp-shell-quote-argument localname) 1704 (tramp-shell-quote-argument localname)
1701 (tramp-get-ls-command vec) 1705 (tramp-get-ls-command vec)
1706 ;; On systems which have no quotings style, file names with
1707 ;; special characters could fail.
1708 (if (tramp-get-ls-command-with-quoting-style vec)
1709 "--quoting-style=shell" "")
1702 (tramp-get-remote-stat vec) 1710 (tramp-get-remote-stat vec)
1703 (if (eq id-format 'integer) "%ue0" "\"%U\"") 1711 (if (eq id-format 'integer) "%ue0" "\037%U\037")
1704 (if (eq id-format 'integer) "%ge0" "\"%G\"")))) 1712 (if (eq id-format 'integer) "%ge0" "\037%G\037"))))
1705 1713
1706;; This function should return "foo/" for directories and "bar" for 1714;; This function should return "foo/" for directories and "bar" for
1707;; files. 1715;; files.
@@ -1772,7 +1780,7 @@ be non-negative integers."
1772 1 0))) 1780 1 0)))
1773 1781
1774 (format (concat 1782 (format (concat
1775 "(\\cd %s 2>&1 && (%s %s -a 2>/dev/null" 1783 "(cd %s 2>&1 && (%s -a %s 2>/dev/null"
1776 ;; `ls' with wildcard might fail with `Argument 1784 ;; `ls' with wildcard might fail with `Argument
1777 ;; list too long' error in some corner cases; if 1785 ;; list too long' error in some corner cases; if
1778 ;; `ls' fails after `cd' succeeded, chances are 1786 ;; `ls' fails after `cd' succeeded, chances are
@@ -1796,7 +1804,7 @@ be non-negative integers."
1796 ;; sub-directories. 1804 ;; sub-directories.
1797 (if (zerop (length filename)) 1805 (if (zerop (length filename))
1798 "." 1806 "."
1799 (concat (tramp-shell-quote-argument filename) "* -d")) 1807 (format "-d %s*" (tramp-shell-quote-argument filename)))
1800 (tramp-get-ls-command v) 1808 (tramp-get-ls-command v)
1801 (tramp-get-test-command v)))) 1809 (tramp-get-test-command v))))
1802 1810
@@ -2078,23 +2086,20 @@ file names."
2078First arg OP is either `copy' or `rename' and indicates the operation. 2086First arg OP is either `copy' or `rename' and indicates the operation.
2079FILENAME is the source file, NEWNAME the target file. 2087FILENAME is the source file, NEWNAME the target file.
2080KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME." 2088KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME."
2081 (with-temp-buffer 2089 ;; We must disable multibyte, because binary data shall not be
2082 ;; We must disable multibyte, because binary data shall not be 2090 ;; converted. We don't want the target file to be compressed, so we
2083 ;; converted. We remove `tramp-file-name-handler' from 2091 ;; let-bind `jka-compr-inhibit' to t.
2084 ;; `inhibit-file-name-handlers'; otherwise the file name handler 2092 ;; We remove `tramp-file-name-handler' from
2085 ;; for `insert-file-contents' might be deactivated in some corner 2093 ;; `inhibit-file-name-handlers'; otherwise the file name handler for
2086 ;; cases. 2094 ;; `insert-file-contents' might be deactivated in some corner cases.
2087 (set-buffer-multibyte nil) 2095 (let ((coding-system-for-read 'binary)
2088 (let ((coding-system-for-read 'binary) 2096 (coding-system-for-write 'binary)
2089 (jka-compr-inhibit t) 2097 (jka-compr-inhibit t)
2090 (inhibit-file-name-handlers 2098 (inhibit-file-name-handlers
2091 (remq 'tramp-file-name-handler inhibit-file-name-handlers))) 2099 (remq 'tramp-file-name-handler inhibit-file-name-handlers)))
2092 (insert-file-contents-literally filename)) 2100 (with-temp-file newname
2093 ;; We don't want the target file to be compressed, so we let-bind 2101 (set-buffer-multibyte nil)
2094 ;; `jka-compr-inhibit' to t. 2102 (insert-file-contents-literally filename)))
2095 (let ((coding-system-for-write 'binary)
2096 (jka-compr-inhibit t))
2097 (write-region (point-min) (point-max) newname nil 'no-message)))
2098 ;; KEEP-DATE handling. 2103 ;; KEEP-DATE handling.
2099 (when keep-date (set-file-times newname (nth 5 (file-attributes filename)))) 2104 (when keep-date (set-file-times newname (nth 5 (file-attributes filename))))
2100 ;; Set the mode. 2105 ;; Set the mode.
@@ -2541,7 +2546,7 @@ The method used must be an out-of-band method."
2541 (tramp-flush-file-property v (file-name-directory localname)) 2546 (tramp-flush-file-property v (file-name-directory localname))
2542 (tramp-flush-directory-property v localname) 2547 (tramp-flush-directory-property v localname)
2543 (tramp-barf-unless-okay 2548 (tramp-barf-unless-okay
2544 v (format "%s %s" 2549 v (format "cd / && %s %s"
2545 (if recursive "rm -rf" "rmdir") 2550 (if recursive "rm -rf" "rmdir")
2546 (tramp-shell-quote-argument localname)) 2551 (tramp-shell-quote-argument localname))
2547 "Couldn't delete %s" directory))) 2552 "Couldn't delete %s" directory)))
@@ -2799,7 +2804,7 @@ the result will be a local, non-Tramp, file name."
2799 (setq uname 2804 (setq uname
2800 (with-tramp-connection-property v uname 2805 (with-tramp-connection-property v uname
2801 (tramp-send-command 2806 (tramp-send-command
2802 v (format "cd %s; pwd" (tramp-shell-quote-argument uname))) 2807 v (format "cd %s && pwd" (tramp-shell-quote-argument uname)))
2803 (with-current-buffer (tramp-get-buffer v) 2808 (with-current-buffer (tramp-get-buffer v)
2804 (goto-char (point-min)) 2809 (goto-char (point-min))
2805 (buffer-substring (point) (point-at-eol))))) 2810 (buffer-substring (point) (point-at-eol)))))
@@ -3037,7 +3042,7 @@ the result will be a local, non-Tramp, file name."
3037 (unwind-protect 3042 (unwind-protect
3038 (setq ret 3043 (setq ret
3039 (if (tramp-send-command-and-check 3044 (if (tramp-send-command-and-check
3040 v (format "\\cd %s; %s" 3045 v (format "cd %s && %s"
3041 (tramp-shell-quote-argument localname) 3046 (tramp-shell-quote-argument localname)
3042 command) 3047 command)
3043 t t) 3048 t t)
@@ -3116,17 +3121,14 @@ the result will be a local, non-Tramp, file name."
3116 ;; If local decoding is a function, we call it. 3121 ;; If local decoding is a function, we call it.
3117 ;; We must disable multibyte, because 3122 ;; We must disable multibyte, because
3118 ;; `uudecode-decode-region' doesn't handle it 3123 ;; `uudecode-decode-region' doesn't handle it
3119 ;; correctly. 3124 ;; correctly. Unset `file-name-handler-alist'.
3120 (with-temp-buffer 3125 ;; Otherwise, epa-file gets confused.
3121 (set-buffer-multibyte nil) 3126 (let (file-name-handler-alist
3122 (insert-buffer-substring (tramp-get-buffer v)) 3127 (coding-system-for-write 'binary))
3123 (funcall loc-dec (point-min) (point-max)) 3128 (with-temp-file tmpfile
3124 ;; Unset `file-name-handler-alist'. Otherwise, 3129 (set-buffer-multibyte nil)
3125 ;; epa-file gets confused. 3130 (insert-buffer-substring (tramp-get-buffer v))
3126 (let (file-name-handler-alist 3131 (funcall loc-dec (point-min) (point-max))))
3127 (coding-system-for-write 'binary))
3128 (write-region
3129 (point-min) (point-max) tmpfile nil 'no-message)))
3130 3132
3131 ;; If tramp-decoding-function is not defined for this 3133 ;; If tramp-decoding-function is not defined for this
3132 ;; method, we invoke tramp-decoding-command instead. 3134 ;; method, we invoke tramp-decoding-command instead.
@@ -3708,8 +3710,8 @@ Only send the definition if it has not already been done."
3708 (tramp-error vec 'file-error "No Perl available on remote host")) 3710 (tramp-error vec 'file-error "No Perl available on remote host"))
3709 (tramp-barf-unless-okay 3711 (tramp-barf-unless-okay
3710 vec 3712 vec
3711 (format "%s () {\n%s\n}" name 3713 (format "%s () {\n%s\n}"
3712 (format script (tramp-get-remote-perl vec))) 3714 name (format script (tramp-get-remote-perl vec)))
3713 "Script %s sending failed" name) 3715 "Script %s sending failed" name)
3714 (tramp-set-connection-property 3716 (tramp-set-connection-property
3715 (tramp-get-connection-process vec) "scripts" (cons name scripts)))))) 3717 (tramp-get-connection-process vec) "scripts" (cons name scripts))))))
@@ -5157,7 +5159,8 @@ Return ATTR."
5157 (with-current-buffer (tramp-get-connection-buffer vec) 5159 (with-current-buffer (tramp-get-connection-buffer vec)
5158 (while candidates 5160 (while candidates
5159 (goto-char (point-min)) 5161 (goto-char (point-min))
5160 (if (string-match (concat "^" (car candidates) "$") (buffer-string)) 5162 (if (string-match (format "^%s\r?$" (regexp-quote (car candidates)))
5163 (buffer-string))
5161 (setq locale (car candidates) 5164 (setq locale (car candidates)
5162 candidates nil) 5165 candidates nil)
5163 (setq candidates (cdr candidates))))) 5166 (setq candidates (cdr candidates)))))
@@ -5199,6 +5202,17 @@ Return ATTR."
5199 (tramp-send-command-and-check 5202 (tramp-send-command-and-check
5200 vec (format "%s --dired -al /dev/null" (tramp-get-ls-command vec)))))) 5203 vec (format "%s --dired -al /dev/null" (tramp-get-ls-command vec))))))
5201 5204
5205(defun tramp-get-ls-command-with-quoting-style (vec)
5206 (save-match-data
5207 (with-tramp-connection-property vec "ls-quoting-style"
5208 (tramp-message vec 5 "Checking, whether `ls --quoting-style=shell' works")
5209 ;; Some "ls" versions are sensible wrt the order of arguments,
5210 ;; they fail when "-al" is after the "--dired" argument (for
5211 ;; example on FreeBSD).
5212 (tramp-send-command-and-check
5213 vec (format "%s --quoting-style=shell -al /dev/null"
5214 (tramp-get-ls-command vec))))))
5215
5202(defun tramp-get-test-command (vec) 5216(defun tramp-get-test-command (vec)
5203 (with-tramp-connection-property vec "test" 5217 (with-tramp-connection-property vec "test"
5204 (tramp-message vec 5 "Finding a suitable `test' command") 5218 (tramp-message vec 5 "Finding a suitable `test' command")
@@ -5486,14 +5500,18 @@ function cell is returned to be applied on a buffer."
5486 `(lambda (beg end) 5500 `(lambda (beg end)
5487 (,coding beg end) 5501 (,coding beg end)
5488 (let ((coding-system-for-write 'binary) 5502 (let ((coding-system-for-write 'binary)
5489 (coding-system-for-read 'binary)) 5503 (coding-system-for-read 'binary)
5504 (default-directory
5505 (tramp-compat-temporary-file-directory)))
5490 (apply 5506 (apply
5491 'call-process-region (point-min) (point-max) 5507 'call-process-region (point-min) (point-max)
5492 (car (split-string ,compress)) t t nil 5508 (car (split-string ,compress)) t t nil
5493 (cdr (split-string ,compress))))) 5509 (cdr (split-string ,compress)))))
5494 `(lambda (beg end) 5510 `(lambda (beg end)
5495 (let ((coding-system-for-write 'binary) 5511 (let ((coding-system-for-write 'binary)
5496 (coding-system-for-read 'binary)) 5512 (coding-system-for-read 'binary)
5513 (default-directory
5514 (tramp-compat-temporary-file-directory)))
5497 (apply 5515 (apply
5498 'call-process-region beg end 5516 'call-process-region beg end
5499 (car (split-string ,compress)) t t nil 5517 (car (split-string ,compress)) t t nil
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index a03affa5eeb..953525f37e4 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -73,6 +73,7 @@
73 "Edit remote files with a combination of ssh, scp, etc." 73 "Edit remote files with a combination of ssh, scp, etc."
74 :group 'files 74 :group 'files
75 :group 'comm 75 :group 'comm
76 :link '(custom-manual "(tramp)Top")
76 :version "22.1") 77 :version "22.1")
77 78
78;; Maybe we need once a real Tramp mode, with key bindings etc. 79;; Maybe we need once a real Tramp mode, with key bindings etc.
@@ -557,7 +558,7 @@ if you need to change this."
557 :type 'string) 558 :type 'string)
558 559
559(defcustom tramp-login-prompt-regexp 560(defcustom tramp-login-prompt-regexp
560 ".*ogin\\( .*\\)?: *" 561 ".*\\(user\\|login\\)\\( .*\\)?: *"
561 "Regexp matching login-like prompts. 562 "Regexp matching login-like prompts.
562The regexp should match at end of buffer. 563The regexp should match at end of buffer.
563 564
@@ -2263,7 +2264,7 @@ Falls back to normal file name handler if no Tramp file name handler exists."
2263 "Load Tramp file name handler, and perform OPERATION." 2264 "Load Tramp file name handler, and perform OPERATION."
2264 ;; Avoid recursive loading of tramp.el. `temporary-file-directory' 2265 ;; Avoid recursive loading of tramp.el. `temporary-file-directory'
2265 ;; does not exist in XEmacs, so we must use something else. 2266 ;; does not exist in XEmacs, so we must use something else.
2266 (let ((default-directory (or (symbol-value 'temporary-file-directory) "/"))) 2267 (let ((default-directory "/"))
2267 (load "tramp" nil t)) 2268 (load "tramp" nil t))
2268 (apply operation args))) 2269 (apply operation args)))
2269 2270
@@ -3352,10 +3353,11 @@ User is always nil."
3352 3353
3353(defun tramp-handle-unhandled-file-name-directory (_filename) 3354(defun tramp-handle-unhandled-file-name-directory (_filename)
3354 "Like `unhandled-file-name-directory' for Tramp files." 3355 "Like `unhandled-file-name-directory' for Tramp files."
3355 ;; With Emacs 23, we could simply return `nil'. But we must keep it 3356 ;; Starting with Emacs 23, we must simply return `nil'. But we must
3356 ;; for backward compatibility. "~/" cannot be returned, because 3357 ;; keep backward compatibility, also with XEmacs. "~/" cannot be
3357 ;; there might be machines without a HOME directory (like hydra). 3358 ;; returned, because there might be machines without a HOME
3358 "/") 3359 ;; directory (like hydra).
3360 (and (< emacs-major-version 23) "/"))
3359 3361
3360(defun tramp-handle-set-visited-file-modtime (&optional time-list) 3362(defun tramp-handle-set-visited-file-modtime (&optional time-list)
3361 "Like `set-visited-file-modtime' for Tramp files." 3363 "Like `set-visited-file-modtime' for Tramp files."
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 70092d21207..226ec9f194a 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -31,7 +31,7 @@
31;; should be changed only there. 31;; should be changed only there.
32 32
33;;;###tramp-autoload 33;;;###tramp-autoload
34(defconst tramp-version "2.2.11-24.5" 34(defconst tramp-version "2.2.12-pre"
35 "This version of Tramp.") 35 "This version of Tramp.")
36 36
37;;;###tramp-autoload 37;;;###tramp-autoload
@@ -44,7 +44,7 @@
44 (= emacs-major-version 21) 44 (= emacs-major-version 21)
45 (>= emacs-minor-version 4))) 45 (>= emacs-minor-version 4)))
46 "ok" 46 "ok"
47 (format "Tramp 2.2.11-24.5 is not fit for %s" 47 (format "Tramp 2.2.12-pre is not fit for %s"
48 (when (string-match "^.*$" (emacs-version)) 48 (when (string-match "^.*$" (emacs-version))
49 (match-string 0 (emacs-version))))))) 49 (match-string 0 (emacs-version)))))))
50 (unless (string-match "\\`ok\\'" x) (error "%s" x))) 50 (unless (string-match "\\`ok\\'" x) (error "%s" x)))