diff options
| author | Michael Albinus | 2015-07-21 14:59:18 +0200 |
|---|---|---|
| committer | Michael Albinus | 2015-07-21 14:59:18 +0200 |
| commit | b0dbf4c038d53ccce6ecf592c6d5b1ffcc084ad0 (patch) | |
| tree | 91b0521e809dee52fbc509feb1a4b59dd5679a84 | |
| parent | b6ac30ab435596f1be6023ad22471bf570a11c4a (diff) | |
| download | emacs-b0dbf4c038d53ccce6ecf592c6d5b1ffcc084ad0.tar.gz emacs-b0dbf4c038d53ccce6ecf592c6d5b1ffcc084ad0.zip | |
Sync with Tramp repository
* doc/misc/tramp.texi (Configuration): Note, that Tramp must be
required prior changing its configuration.
(Connection caching, Predefined connection information)
(Remote shell setup): Fix typos.
(Predefined connection information): Describe, how to overwrite
parameters of `tramp-methods'.
(Remote programs, Remote processes, Traces and Profiles):
Simplify example.
(Remote programs): Remove superfluous comment.
* doc/misc/trampver.texi: Update release number.
* lisp/net/tramp-cache.el (tramp-connection-properties): Adapt docstring.
* lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file): New defun.
(tramp-gvfs-handle-copy-file, tramp-gvfs-handle-rename-file): Use it.
(tramp-gvfs-handle-make-directory): Reimplement PARENTS handling,
"gvfs-mkdir -p ..." does not work robust.
(tramp-gvfs-maybe-open-connection): Adapt `tramp-get-method-parameter' call.
* lisp/net/tramp-sh.el (tramp-methods):
Add `tramp-remote-shell-login' parameter where it fits.
(tramp-get-remote-path): Use it.
(tramp-make-copy-program-file-name): Fix quoting for "psftp" method.
(all): Adapt `tramp-get-method-parameter' calls.
* lisp/net/tramp.el (tramp-methods): Adapt docstring.
(tramp-get-method-parameter): Replace argument METHOD by VEC.
Check also for hits in `tramp-connection-properties'. Adapt docstring.
(tramp-get-remote-tmpdir): Cache only the local name of tmpdir.
(all): Adapt `tramp-get-method-parameter' calls.
* lisp/net/trampver.el Update release number.
* test/automated/tramp-tests.el (tramp--instrument-test-case):
Add "^make-symbolic-link not supported$" to `debug-ignored-errors'.
(tramp-test13-make-directory, tramp--test-adb-p)
(tramp--test-smb-or-windows-nt-p): Simplify.
(tramp--test-ftp-p, tramp--test-gvfs-p): New defuns.
(tramp--test-special-characters): Fix docstring. Add gvfs and ftp tests.
(tramp--test-utf8): Fix docstring.
| -rw-r--r-- | doc/misc/tramp.texi | 74 | ||||
| -rw-r--r-- | doc/misc/trampver.texi | 2 | ||||
| -rw-r--r-- | lisp/net/tramp-cache.el | 3 | ||||
| -rw-r--r-- | lisp/net/tramp-gvfs.el | 244 | ||||
| -rw-r--r-- | lisp/net/tramp-sh.el | 116 | ||||
| -rw-r--r-- | lisp/net/tramp.el | 64 | ||||
| -rw-r--r-- | lisp/net/trampver.el | 4 | ||||
| -rw-r--r-- | test/automated/tramp-tests.el | 90 |
8 files changed, 347 insertions, 250 deletions
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi index ece851ded93..c9af6ddea47 100644 --- a/doc/misc/tramp.texi +++ b/doc/misc/tramp.texi | |||
| @@ -217,7 +217,7 @@ Configuring @value{tramp} for use | |||
| 217 | * Connection caching:: Reusing connection related information. | 217 | * Connection caching:: Reusing connection related information. |
| 218 | * Predefined connection information:: | 218 | * Predefined connection information:: |
| 219 | Setting own connection related information. | 219 | Setting own connection related information. |
| 220 | * Remote Programs:: How @value{tramp} finds and uses programs on the remote host. | 220 | * Remote programs:: How @value{tramp} finds and uses programs on the remote host. |
| 221 | * Remote shell setup:: Remote shell setup hints. | 221 | * Remote shell setup:: Remote shell setup hints. |
| 222 | * Android shell setup:: Android shell setup hints. | 222 | * Android shell setup:: Android shell setup hints. |
| 223 | * Auto-save and Backup:: Auto-save and Backup. | 223 | * Auto-save and Backup:: Auto-save and Backup. |
| @@ -524,6 +524,15 @@ can use to connect to remote hosts and transfer files | |||
| 524 | If you don't know which method is right for you, see @xref{Default | 524 | If you don't know which method is right for you, see @xref{Default |
| 525 | Method}. | 525 | Method}. |
| 526 | 526 | ||
| 527 | @strong{Note:} In the following description, setting of user options | ||
| 528 | or variables is explained. Not all of them are autoloaded by | ||
| 529 | @value{emacsname}. All examples expect, that you have loaded | ||
| 530 | @value{tramp} first: | ||
| 531 | |||
| 532 | @lisp | ||
| 533 | (require 'tramp) | ||
| 534 | @end lisp | ||
| 535 | |||
| 527 | 536 | ||
| 528 | @menu | 537 | @menu |
| 529 | * Connection types:: Types of connections made to remote hosts. | 538 | * Connection types:: Types of connections made to remote hosts. |
| @@ -548,7 +557,7 @@ Method}. | |||
| 548 | * Connection caching:: Reusing connection related information. | 557 | * Connection caching:: Reusing connection related information. |
| 549 | * Predefined connection information:: | 558 | * Predefined connection information:: |
| 550 | Setting own connection related information. | 559 | Setting own connection related information. |
| 551 | * Remote Programs:: How @value{tramp} finds and uses programs on the remote host. | 560 | * Remote programs:: How @value{tramp} finds and uses programs on the remote host. |
| 552 | * Remote shell setup:: Remote shell setup hints. | 561 | * Remote shell setup:: Remote shell setup hints. |
| 553 | * Android shell setup:: Android shell setup hints. | 562 | * Android shell setup:: Android shell setup hints. |
| 554 | * Auto-save and Backup:: Auto-save and Backup. | 563 | * Auto-save and Backup:: Auto-save and Backup. |
| @@ -622,7 +631,7 @@ it may require access to external commands to perform that task. | |||
| 622 | @command{mimencode} (part of the @command{metamail} package) or | 631 | @command{mimencode} (part of the @command{metamail} package) or |
| 623 | @command{uuencode} on the remote host. The first reliable command | 632 | @command{uuencode} on the remote host. The first reliable command |
| 624 | will be used. The search path can be customized, see @ref{Remote | 633 | will be used. The search path can be customized, see @ref{Remote |
| 625 | Programs}. | 634 | programs}. |
| 626 | 635 | ||
| 627 | If both commands aren't available on the remote host, @value{tramp} | 636 | If both commands aren't available on the remote host, @value{tramp} |
| 628 | transfers a small piece of Perl code to the remote host, and tries to | 637 | transfers a small piece of Perl code to the remote host, and tries to |
| @@ -1726,10 +1735,10 @@ Using such persistent information can be disabled by setting | |||
| 1726 | @code{tramp-persistency-file-name} to @code{nil}. | 1735 | @code{tramp-persistency-file-name} to @code{nil}. |
| 1727 | 1736 | ||
| 1728 | Once consequence of reusing connection related information is that | 1737 | Once consequence of reusing connection related information is that |
| 1729 | @var{tramp} needs to distinguish hosts. If you, for example, run a | 1738 | @value{tramp} needs to distinguish hosts. If you, for example, run a |
| 1730 | local @code{sshd} on port 3001, which tunnels @command{ssh} to another | 1739 | local @code{sshd} on port 3001, which tunnels @command{ssh} to another |
| 1731 | host, you could access both @file{@trampfn{ssh, , localhost,}} and | 1740 | host, you could access both @file{@trampfn{ssh, , localhost,}} and |
| 1732 | @file{@trampfn{ssh, , localhost#3001,}}. @var{tramp} would use the | 1741 | @file{@trampfn{ssh, , localhost#3001,}}. @value{tramp} would use the |
| 1733 | same host related information (like paths, Perl variants, etc) for | 1742 | same host related information (like paths, Perl variants, etc) for |
| 1734 | both connections, although the information is valid only for one of | 1743 | both connections, although the information is valid only for one of |
| 1735 | them. | 1744 | them. |
| @@ -1748,10 +1757,11 @@ connection again. | |||
| 1748 | @node Predefined connection information | 1757 | @node Predefined connection information |
| 1749 | @section Setting own connection related information | 1758 | @section Setting own connection related information |
| 1750 | 1759 | ||
| 1751 | Sometimes, @var{tramp} is not able to detect correct connection | 1760 | Sometimes, method specific arguments in @code{tramp-methods} do not |
| 1752 | related information. In such cases, you could tell @var{tramp} which | 1761 | fit your needs. Sometimes, @value{tramp} is not able to detect |
| 1753 | value it has to take. Since this could result in errors, it has to be | 1762 | correct connection related information. In such cases, you could tell |
| 1754 | used with care. | 1763 | @value{tramp} which value it has to take. Since this could result in |
| 1764 | errors, it has to be used with care. | ||
| 1755 | 1765 | ||
| 1756 | @vindex tramp-connection-properties | 1766 | @vindex tramp-connection-properties |
| 1757 | Such settings can be performed via the list | 1767 | Such settings can be performed via the list |
| @@ -1759,13 +1769,35 @@ Such settings can be performed via the list | |||
| 1759 | form @code{(@var{regexp} @var{property} @var{value})}. @var{regexp} | 1769 | form @code{(@var{regexp} @var{property} @var{value})}. @var{regexp} |
| 1760 | matches remote file names for which a property shall be predefined. | 1770 | matches remote file names for which a property shall be predefined. |
| 1761 | It can be @code{nil}. @var{property} is a string, and @var{value} the | 1771 | It can be @code{nil}. @var{property} is a string, and @var{value} the |
| 1762 | corresponding value. @var{property} could be any property found in | 1772 | corresponding value. |
| 1763 | the file @code{tramp-persistency-file-name}. | ||
| 1764 | 1773 | ||
| 1765 | A special property is @code{"busybox"}. This must be set, if the | 1774 | @var{property} could be any method specific parameter found in |
| 1766 | remote host runs a very restricted busybox as shell, which closes the | 1775 | @code{tramp-methods}. The parameter key in @code{tramp-methods} is a |
| 1776 | symbol name @code{tramp-<foo>}. In order to overwrite it, | ||
| 1777 | @var{property} must be the string @samp{<foo>}. If you, for example, | ||
| 1778 | want to change the remote shell to be used on a remote machine, you | ||
| 1779 | could apply | ||
| 1780 | |||
| 1781 | @lisp | ||
| 1782 | (add-to-list 'tramp-connection-properties | ||
| 1783 | (list (regexp-quote "@trampfn{ssh, user, randomhost.your.domain,}") | ||
| 1784 | "remote-shell" "/bin/ksh")) | ||
| 1785 | (add-to-list 'tramp-connection-properties | ||
| 1786 | (list (regexp-quote "@trampfn{ssh, user, randomhost.your.domain,}") | ||
| 1787 | "remote-shell-login" '("-"))) | ||
| 1788 | @end lisp | ||
| 1789 | |||
| 1790 | This would overwrite the @code{tramp-remote-shell} and | ||
| 1791 | @code{tramp-remote-shell-login} parameters in @code{tramp-methods}, to | ||
| 1792 | be used on that remote host. | ||
| 1793 | |||
| 1794 | @var{property} could also be any property found in the file | ||
| 1795 | @code{tramp-persistency-file-name}. | ||
| 1796 | |||
| 1797 | A special property is @samp{busybox}. This must be set, if the remote | ||
| 1798 | host runs a very restricted busybox as shell, which closes the | ||
| 1767 | connection at will. Since there is no reliable test for this, | 1799 | connection at will. Since there is no reliable test for this, |
| 1768 | @var{tramp} must be indicated this way. Example: | 1800 | @value{tramp} must be indicated this way. Example: |
| 1769 | 1801 | ||
| 1770 | @lisp | 1802 | @lisp |
| 1771 | (add-to-list 'tramp-connection-properties | 1803 | (add-to-list 'tramp-connection-properties |
| @@ -1774,7 +1806,7 @@ connection at will. Since there is no reliable test for this, | |||
| 1774 | @end lisp | 1806 | @end lisp |
| 1775 | 1807 | ||
| 1776 | 1808 | ||
| 1777 | @node Remote Programs | 1809 | @node Remote programs |
| 1778 | @section How @value{tramp} finds and uses programs on the remote host | 1810 | @section How @value{tramp} finds and uses programs on the remote host |
| 1779 | 1811 | ||
| 1780 | @value{tramp} depends on a number of programs on the remote host in order to | 1812 | @value{tramp} depends on a number of programs on the remote host in order to |
| @@ -1821,9 +1853,6 @@ To add a directory to the remote search path, you could use code such | |||
| 1821 | as: | 1853 | as: |
| 1822 | 1854 | ||
| 1823 | @lisp | 1855 | @lisp |
| 1824 | @i{;; We load @value{tramp} to define the variable.} | ||
| 1825 | (require 'tramp) | ||
| 1826 | @i{;; We have @command{perl} in "/usr/local/perl/bin"} | ||
| 1827 | (add-to-list 'tramp-remote-path "/usr/local/perl/bin") | 1856 | (add-to-list 'tramp-remote-path "/usr/local/perl/bin") |
| 1828 | @end lisp | 1857 | @end lisp |
| 1829 | 1858 | ||
| @@ -1892,7 +1921,7 @@ to be set correctly to recognize the shell prompt on the remote host. | |||
| 1892 | 1921 | ||
| 1893 | Note that @value{tramp} requires the match for @code{shell-prompt-pattern} | 1922 | Note that @value{tramp} requires the match for @code{shell-prompt-pattern} |
| 1894 | to be at the end of the buffer. Many people have something like the | 1923 | to be at the end of the buffer. Many people have something like the |
| 1895 | following as the value for the variable: @code{"^[^>$][>$] *"}. Now | 1924 | following as the value for the variable: @samp{^[^>$][>$] *}. Now |
| 1896 | suppose your shell prompt is @code{a <b> c $ }. In this case, | 1925 | suppose your shell prompt is @code{a <b> c $ }. In this case, |
| 1897 | @value{tramp} recognizes the @code{>} character as the end of the prompt, | 1926 | @value{tramp} recognizes the @code{>} character as the end of the prompt, |
| 1898 | but it is not at the end of the buffer. | 1927 | but it is not at the end of the buffer. |
| @@ -2688,7 +2717,7 @@ this is welcome! | |||
| 2688 | When your program is not found in the default search path | 2717 | When your program is not found in the default search path |
| 2689 | @value{tramp} sets on the remote host, you should either use an | 2718 | @value{tramp} sets on the remote host, you should either use an |
| 2690 | absolute path, or extend @code{tramp-remote-path} (see @ref{Remote | 2719 | absolute path, or extend @code{tramp-remote-path} (see @ref{Remote |
| 2691 | Programs}): | 2720 | programs}): |
| 2692 | 2721 | ||
| 2693 | @lisp | 2722 | @lisp |
| 2694 | (add-to-list 'tramp-remote-path "~/bin") | 2723 | (add-to-list 'tramp-remote-path "~/bin") |
| @@ -2698,8 +2727,8 @@ Programs}): | |||
| 2698 | The environment for your program can be adapted by customizing | 2727 | The environment for your program can be adapted by customizing |
| 2699 | @code{tramp-remote-process-environment}. This variable is a list of | 2728 | @code{tramp-remote-process-environment}. This variable is a list of |
| 2700 | strings. It is structured like @code{process-environment}. Each | 2729 | strings. It is structured like @code{process-environment}. Each |
| 2701 | element is a string of the form @code{"ENVVARNAME=VALUE"}. An entry | 2730 | element is a string of the form @samp{ENVVARNAME=VALUE}. An entry |
| 2702 | @code{"ENVVARNAME="} disables the corresponding environment variable, | 2731 | @samp{ENVVARNAME=} disables the corresponding environment variable, |
| 2703 | which might have been set in your init file like @file{~/.profile}. | 2732 | which might have been set in your init file like @file{~/.profile}. |
| 2704 | 2733 | ||
| 2705 | @noindent | 2734 | @noindent |
| @@ -3930,7 +3959,6 @@ Sometimes, it might be even necessary to step through @value{tramp} | |||
| 3930 | function call traces. Such traces are enabled by the following code: | 3959 | function call traces. Such traces are enabled by the following code: |
| 3931 | 3960 | ||
| 3932 | @lisp | 3961 | @lisp |
| 3933 | (require 'tramp) | ||
| 3934 | (require 'trace) | 3962 | (require 'trace) |
| 3935 | (dolist (elt (all-completions "tramp-" obarray 'functionp)) | 3963 | (dolist (elt (all-completions "tramp-" obarray 'functionp)) |
| 3936 | (trace-function-background (intern elt))) | 3964 | (trace-function-background (intern elt))) |
diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi index fc6f4c58606..dccf3175386 100644 --- a/doc/misc/trampver.texi +++ b/doc/misc/trampver.texi | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | @c In the Tramp GIT, the version number is auto-frobbed from | 8 | @c In the Tramp GIT, the version number is auto-frobbed from |
| 9 | @c configure.ac, so you should edit that file and run | 9 | @c configure.ac, so you should edit that file and run |
| 10 | @c "autoconf && ./configure" to change the version number. | 10 | @c "autoconf && ./configure" to change the version number. |
| 11 | @set trampver 2.2.12 | 11 | @set trampver 2.2.13-pre |
| 12 | 12 | ||
| 13 | @c Other flags from configuration | 13 | @c Other flags from configuration |
| 14 | @set instprefix /usr/local | 14 | @set instprefix /usr/local |
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el index f2ee49ff6be..279d9f45c95 100644 --- a/lisp/net/tramp-cache.el +++ b/lisp/net/tramp-cache.el | |||
| @@ -66,7 +66,8 @@ | |||
| 66 | Every entry has the form (REGEXP PROPERTY VALUE). The regexp | 66 | Every entry has the form (REGEXP PROPERTY VALUE). The regexp |
| 67 | matches remote file names. It can be nil. PROPERTY is a string, | 67 | matches remote file names. It can be nil. PROPERTY is a string, |
| 68 | and VALUE the corresponding value. They are used, if there is no | 68 | and VALUE the corresponding value. They are used, if there is no |
| 69 | matching entry for PROPERTY in `tramp-cache-data'." | 69 | matching entry for PROPERTY in `tramp-cache-data'. For more |
| 70 | details see the info pages." | ||
| 70 | :group 'tramp | 71 | :group 'tramp |
| 71 | :version "24.4" | 72 | :version "24.4" |
| 72 | :type '(repeat (list (choice :tag "File Name regexp" regexp (const nil)) | 73 | :type '(repeat (list (choice :tag "File Name regexp" regexp (const nil)) |
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 215e39d04c3..4dfdcd76e66 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el | |||
| @@ -582,62 +582,127 @@ is no information where to trace the message.") | |||
| 582 | 582 | ||
| 583 | ;; File name primitives. | 583 | ;; File name primitives. |
| 584 | 584 | ||
| 585 | (defun tramp-gvfs-do-copy-or-rename-file | ||
| 586 | (op filename newname &optional ok-if-already-exists keep-date | ||
| 587 | preserve-uid-gid preserve-extended-attributes) | ||
| 588 | "Copy or rename a remote file. | ||
| 589 | OP must be `copy' or `rename' and indicates the operation to perform. | ||
| 590 | FILENAME specifies the file to copy or rename, NEWNAME is the name of | ||
| 591 | the new file (for copy) or the new name of the file (for rename). | ||
| 592 | OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already. | ||
| 593 | KEEP-DATE means to make sure that NEWNAME has the same timestamp | ||
| 594 | as FILENAME. PRESERVE-UID-GID, when non-nil, instructs to keep | ||
| 595 | the uid and gid if both files are on the same host. | ||
| 596 | PRESERVE-EXTENDED-ATTRIBUTES is ignored. | ||
| 597 | |||
| 598 | This function is invoked by `tramp-gvfs-handle-copy-file' and | ||
| 599 | `tramp-gvfs-handle-rename-file'. It is an error if OP is neither | ||
| 600 | of `copy' and `rename'. FILENAME and NEWNAME must be absolute | ||
| 601 | file names." | ||
| 602 | (unless (memq op '(copy rename)) | ||
| 603 | (error "Unknown operation `%s', must be `copy' or `rename'" op)) | ||
| 604 | |||
| 605 | (let ((t1 (tramp-tramp-file-p filename)) | ||
| 606 | (t2 (tramp-tramp-file-p newname)) | ||
| 607 | (equal-remote (tramp-equal-remote filename newname)) | ||
| 608 | (file-operation (intern (format "%s-file" op))) | ||
| 609 | (gvfs-operation (if (eq op 'copy) "gvfs-copy" "gvfs-move")) | ||
| 610 | (msg-operation (if (eq op 'copy) "Copying" "Renaming"))) | ||
| 611 | |||
| 612 | (with-parsed-tramp-file-name (if t1 filename newname) nil | ||
| 613 | (when (and (not ok-if-already-exists) (file-exists-p newname)) | ||
| 614 | (tramp-error | ||
| 615 | v 'file-already-exists "File %s already exists" newname)) | ||
| 616 | |||
| 617 | (if (or (and equal-remote | ||
| 618 | (tramp-get-connection-property v "direct-copy-failed" nil)) | ||
| 619 | (and t1 (not (tramp-gvfs-file-name-p filename))) | ||
| 620 | (and t2 (not (tramp-gvfs-file-name-p newname)))) | ||
| 621 | |||
| 622 | ;; We cannot copy or rename directly. | ||
| 623 | (let ((tmpfile (tramp-compat-make-temp-file filename))) | ||
| 624 | (cond | ||
| 625 | (preserve-extended-attributes | ||
| 626 | (tramp-compat-funcall | ||
| 627 | file-operation | ||
| 628 | filename tmpfile t keep-date preserve-uid-gid | ||
| 629 | preserve-extended-attributes)) | ||
| 630 | (preserve-uid-gid | ||
| 631 | (tramp-compat-funcall | ||
| 632 | file-operation filename tmpfile t keep-date preserve-uid-gid)) | ||
| 633 | (t | ||
| 634 | (tramp-compat-funcall | ||
| 635 | file-operation filename tmpfile t keep-date))) | ||
| 636 | (rename-file tmpfile newname ok-if-already-exists)) | ||
| 637 | |||
| 638 | ;; Direct action. | ||
| 639 | (with-tramp-progress-reporter | ||
| 640 | v 0 (format "%s %s to %s" msg-operation filename newname) | ||
| 641 | (unless | ||
| 642 | (apply | ||
| 643 | 'tramp-gvfs-send-command v gvfs-operation | ||
| 644 | (append | ||
| 645 | (and (eq op 'copy) (or keep-date preserve-uid-gid) | ||
| 646 | (list "--preserve")) | ||
| 647 | (list | ||
| 648 | (tramp-gvfs-url-file-name filename) | ||
| 649 | (tramp-gvfs-url-file-name newname)))) | ||
| 650 | |||
| 651 | (if (or (not equal-remote) | ||
| 652 | (and equal-remote | ||
| 653 | (tramp-get-connection-property | ||
| 654 | v "direct-copy-failed" nil))) | ||
| 655 | ;; Propagate the error. | ||
| 656 | (with-current-buffer (tramp-get-connection-buffer v) | ||
| 657 | (goto-char (point-min)) | ||
| 658 | (tramp-error-with-buffer | ||
| 659 | nil v 'file-error | ||
| 660 | "%s failed, see buffer `%s' for details." | ||
| 661 | msg-operation (buffer-name))) | ||
| 662 | |||
| 663 | ;; Some WebDAV server, like the one from QNAP, do not | ||
| 664 | ;; support direct copy/move. Try a fallback. | ||
| 665 | (tramp-set-connection-property v "direct-copy-failed" t) | ||
| 666 | (tramp-gvfs-do-copy-or-rename-file | ||
| 667 | op filename newname ok-if-already-exists keep-date | ||
| 668 | preserve-uid-gid preserve-extended-attributes)))) | ||
| 669 | |||
| 670 | (when (and t1 (eq op 'rename)) | ||
| 671 | (with-parsed-tramp-file-name filename nil | ||
| 672 | (tramp-flush-file-property v (file-name-directory localname)) | ||
| 673 | (tramp-flush-file-property v localname))) | ||
| 674 | |||
| 675 | (when t2 | ||
| 676 | (with-parsed-tramp-file-name newname nil | ||
| 677 | (tramp-flush-file-property v (file-name-directory localname)) | ||
| 678 | (tramp-flush-file-property v localname))))))) | ||
| 679 | |||
| 585 | (defun tramp-gvfs-handle-copy-file | 680 | (defun tramp-gvfs-handle-copy-file |
| 586 | (filename newname &optional ok-if-already-exists keep-date | 681 | (filename newname &optional ok-if-already-exists keep-date |
| 587 | preserve-uid-gid preserve-extended-attributes) | 682 | preserve-uid-gid preserve-extended-attributes) |
| 588 | "Like `copy-file' for Tramp files." | 683 | "Like `copy-file' for Tramp files." |
| 589 | (with-parsed-tramp-file-name | 684 | (setq filename (expand-file-name filename)) |
| 590 | (if (tramp-tramp-file-p filename) filename newname) nil | 685 | (setq newname (expand-file-name newname)) |
| 591 | 686 | (cond | |
| 592 | (when (and (not ok-if-already-exists) (file-exists-p newname)) | 687 | ;; At least one file a Tramp file? |
| 593 | (tramp-error | 688 | ((or (tramp-tramp-file-p filename) |
| 594 | v 'file-already-exists "File %s already exists" newname)) | 689 | (tramp-tramp-file-p newname)) |
| 595 | 690 | (tramp-gvfs-do-copy-or-rename-file | |
| 596 | (if (or (and (tramp-tramp-file-p filename) | 691 | 'copy filename newname ok-if-already-exists keep-date |
| 597 | (not (tramp-gvfs-file-name-p filename))) | 692 | preserve-uid-gid preserve-extended-attributes)) |
| 598 | (and (tramp-tramp-file-p newname) | 693 | ;; Compat section. |
| 599 | (not (tramp-gvfs-file-name-p newname)))) | 694 | (preserve-extended-attributes |
| 600 | 695 | (tramp-run-real-handler | |
| 601 | ;; We cannot call `copy-file' directly. Use | 696 | 'copy-file |
| 602 | ;; `tramp-compat-funcall' for backward compatibility (number | 697 | (list filename newname ok-if-already-exists keep-date |
| 603 | ;; of arguments). | 698 | preserve-uid-gid preserve-extended-attributes))) |
| 604 | (let ((tmpfile (tramp-compat-make-temp-file filename))) | 699 | (preserve-uid-gid |
| 605 | (cond | 700 | (tramp-run-real-handler |
| 606 | (preserve-extended-attributes | 701 | 'copy-file |
| 607 | (tramp-compat-funcall | 702 | (list filename newname ok-if-already-exists keep-date preserve-uid-gid))) |
| 608 | 'copy-file | 703 | (t |
| 609 | filename tmpfile t keep-date preserve-uid-gid | 704 | (tramp-run-real-handler |
| 610 | preserve-extended-attributes)) | 705 | 'copy-file (list filename newname ok-if-already-exists keep-date))))) |
| 611 | (preserve-uid-gid | ||
| 612 | (tramp-compat-funcall | ||
| 613 | 'copy-file filename tmpfile t keep-date preserve-uid-gid)) | ||
| 614 | (t | ||
| 615 | (copy-file filename tmpfile t keep-date))) | ||
| 616 | (rename-file tmpfile newname ok-if-already-exists)) | ||
| 617 | |||
| 618 | ;; Direct copy. | ||
| 619 | (with-tramp-progress-reporter | ||
| 620 | v 0 (format "Copying %s to %s" filename newname) | ||
| 621 | (unless | ||
| 622 | (let ((args | ||
| 623 | (append (if (or keep-date preserve-uid-gid) | ||
| 624 | (list "--preserve") | ||
| 625 | nil) | ||
| 626 | (list | ||
| 627 | (tramp-gvfs-url-file-name filename) | ||
| 628 | (tramp-gvfs-url-file-name newname))))) | ||
| 629 | (apply 'tramp-gvfs-send-command v "gvfs-copy" args)) | ||
| 630 | ;; Propagate the error. | ||
| 631 | (with-current-buffer (tramp-get-connection-buffer v) | ||
| 632 | (goto-char (point-min)) | ||
| 633 | (tramp-error-with-buffer | ||
| 634 | nil v 'file-error | ||
| 635 | "Copying failed, see buffer `%s' for details." (buffer-name))))) | ||
| 636 | |||
| 637 | (when (tramp-tramp-file-p newname) | ||
| 638 | (with-parsed-tramp-file-name newname nil | ||
| 639 | (tramp-flush-file-property v (file-name-directory localname)) | ||
| 640 | (tramp-flush-file-property v localname)))))) | ||
| 641 | 706 | ||
| 642 | (defun tramp-gvfs-handle-delete-directory (directory &optional recursive trash) | 707 | (defun tramp-gvfs-handle-delete-directory (directory &optional recursive trash) |
| 643 | "Like `delete-directory' for Tramp files." | 708 | "Like `delete-directory' for Tramp files." |
| @@ -1016,60 +1081,35 @@ is no information where to trace the message.") | |||
| 1016 | 1081 | ||
| 1017 | (defun tramp-gvfs-handle-make-directory (dir &optional parents) | 1082 | (defun tramp-gvfs-handle-make-directory (dir &optional parents) |
| 1018 | "Like `make-directory' for Tramp files." | 1083 | "Like `make-directory' for Tramp files." |
| 1084 | (setq dir (directory-file-name (expand-file-name dir))) | ||
| 1019 | (with-parsed-tramp-file-name dir nil | 1085 | (with-parsed-tramp-file-name dir nil |
| 1020 | (unless | 1086 | (tramp-flush-file-property v (file-name-directory localname)) |
| 1021 | (apply | 1087 | (tramp-flush-directory-property v localname) |
| 1022 | 'tramp-gvfs-send-command v "gvfs-mkdir" | 1088 | (save-match-data |
| 1023 | (if parents | 1089 | (let ((ldir (file-name-directory dir))) |
| 1024 | (list "-p" (tramp-gvfs-url-file-name dir)) | 1090 | ;; Make missing directory parts. "gvfs-mkdir -p ..." does not |
| 1025 | (list (tramp-gvfs-url-file-name dir)))) | 1091 | ;; work robust. |
| 1026 | ;; Propagate the error. | 1092 | (when (and parents (not (file-directory-p ldir))) |
| 1027 | (tramp-error v 'file-error "Couldn't make directory %s" dir)))) | 1093 | (make-directory ldir parents)) |
| 1094 | ;; Just do it. | ||
| 1095 | (unless (tramp-gvfs-send-command | ||
| 1096 | v "gvfs-mkdir" (tramp-gvfs-url-file-name dir)) | ||
| 1097 | (tramp-error v 'file-error "Couldn't make directory %s" dir)))))) | ||
| 1028 | 1098 | ||
| 1029 | (defun tramp-gvfs-handle-rename-file | 1099 | (defun tramp-gvfs-handle-rename-file |
| 1030 | (filename newname &optional ok-if-already-exists) | 1100 | (filename newname &optional ok-if-already-exists) |
| 1031 | "Like `rename-file' for Tramp files." | 1101 | "Like `rename-file' for Tramp files." |
| 1032 | (with-parsed-tramp-file-name | 1102 | ;; Check if both files are local -- invoke normal rename-file. |
| 1033 | (if (tramp-tramp-file-p filename) filename newname) nil | 1103 | ;; Otherwise, use Tramp from local system. |
| 1034 | 1104 | (setq filename (expand-file-name filename)) | |
| 1035 | (when (and (not ok-if-already-exists) (file-exists-p newname)) | 1105 | (setq newname (expand-file-name newname)) |
| 1036 | (tramp-error | 1106 | ;; At least one file a Tramp file? |
| 1037 | v 'file-already-exists "File %s already exists" newname)) | 1107 | (if (or (tramp-tramp-file-p filename) |
| 1038 | 1108 | (tramp-tramp-file-p newname)) | |
| 1039 | (if (or (and (tramp-tramp-file-p filename) | 1109 | (tramp-gvfs-do-copy-or-rename-file |
| 1040 | (not (tramp-gvfs-file-name-p filename))) | 1110 | 'rename filename newname ok-if-already-exists t t) |
| 1041 | (and (tramp-tramp-file-p newname) | 1111 | (tramp-run-real-handler |
| 1042 | (not (tramp-gvfs-file-name-p newname)))) | 1112 | 'rename-file (list filename newname ok-if-already-exists)))) |
| 1043 | |||
| 1044 | ;; We cannot move directly. | ||
| 1045 | (let ((tmpfile (tramp-compat-make-temp-file filename))) | ||
| 1046 | (rename-file filename tmpfile t) | ||
| 1047 | (rename-file tmpfile newname ok-if-already-exists)) | ||
| 1048 | |||
| 1049 | ;; Direct move. | ||
| 1050 | (with-tramp-progress-reporter | ||
| 1051 | v 0 (format "Renaming %s to %s" filename newname) | ||
| 1052 | (unless | ||
| 1053 | (tramp-gvfs-send-command | ||
| 1054 | v "gvfs-move" | ||
| 1055 | (tramp-gvfs-url-file-name filename) | ||
| 1056 | (tramp-gvfs-url-file-name newname)) | ||
| 1057 | ;; Propagate the error. | ||
| 1058 | (with-current-buffer (tramp-get-buffer v) | ||
| 1059 | (goto-char (point-min)) | ||
| 1060 | (tramp-error-with-buffer | ||
| 1061 | nil v 'file-error | ||
| 1062 | "Renaming failed, see buffer `%s' for details." (buffer-name))))) | ||
| 1063 | |||
| 1064 | (when (tramp-tramp-file-p filename) | ||
| 1065 | (with-parsed-tramp-file-name filename nil | ||
| 1066 | (tramp-flush-file-property v (file-name-directory localname)) | ||
| 1067 | (tramp-flush-file-property v localname))) | ||
| 1068 | |||
| 1069 | (when (tramp-tramp-file-p newname) | ||
| 1070 | (with-parsed-tramp-file-name newname nil | ||
| 1071 | (tramp-flush-file-property v (file-name-directory localname)) | ||
| 1072 | (tramp-flush-file-property v localname)))))) | ||
| 1073 | 1113 | ||
| 1074 | (defun tramp-gvfs-handle-write-region | 1114 | (defun tramp-gvfs-handle-write-region |
| 1075 | (start end filename &optional append visit lockname confirm) | 1115 | (start end filename &optional append visit lockname confirm) |
| @@ -1530,7 +1570,7 @@ connection if a previous connection has died for some reason." | |||
| 1530 | ;; indicated by the "mounted" signal, i.e. the "fuse-mountpoint" | 1570 | ;; indicated by the "mounted" signal, i.e. the "fuse-mountpoint" |
| 1531 | ;; file property. | 1571 | ;; file property. |
| 1532 | (with-timeout | 1572 | (with-timeout |
| 1533 | ((or (tramp-get-method-parameter method 'tramp-connection-timeout) | 1573 | ((or (tramp-get-method-parameter vec 'tramp-connection-timeout) |
| 1534 | tramp-connection-timeout) | 1574 | tramp-connection-timeout) |
| 1535 | (if (zerop (length (tramp-file-name-user vec))) | 1575 | (if (zerop (length (tramp-file-name-user vec))) |
| 1536 | (tramp-error | 1576 | (tramp-error |
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index fda5945a18a..dbf46794a82 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el | |||
| @@ -135,6 +135,7 @@ The string is used in `tramp-methods'.") | |||
| 135 | (tramp-login-program "rsh") | 135 | (tramp-login-program "rsh") |
| 136 | (tramp-login-args (("%h") ("-l" "%u"))) | 136 | (tramp-login-args (("%h") ("-l" "%u"))) |
| 137 | (tramp-remote-shell "/bin/sh") | 137 | (tramp-remote-shell "/bin/sh") |
| 138 | (tramp-remote-shell-login ("-l")) | ||
| 138 | (tramp-remote-shell-args ("-c")) | 139 | (tramp-remote-shell-args ("-c")) |
| 139 | (tramp-copy-program "rcp") | 140 | (tramp-copy-program "rcp") |
| 140 | (tramp-copy-args (("-p" "%k") ("-r"))) | 141 | (tramp-copy-args (("-p" "%k") ("-r"))) |
| @@ -146,6 +147,7 @@ The string is used in `tramp-methods'.") | |||
| 146 | (tramp-login-program "remsh") | 147 | (tramp-login-program "remsh") |
| 147 | (tramp-login-args (("%h") ("-l" "%u"))) | 148 | (tramp-login-args (("%h") ("-l" "%u"))) |
| 148 | (tramp-remote-shell "/bin/sh") | 149 | (tramp-remote-shell "/bin/sh") |
| 150 | (tramp-remote-shell-login ("-l")) | ||
| 149 | (tramp-remote-shell-args ("-c")) | 151 | (tramp-remote-shell-args ("-c")) |
| 150 | (tramp-copy-program "rcp") | 152 | (tramp-copy-program "rcp") |
| 151 | (tramp-copy-args (("-p" "%k"))) | 153 | (tramp-copy-args (("-p" "%k"))) |
| @@ -158,6 +160,7 @@ The string is used in `tramp-methods'.") | |||
| 158 | ("-e" "none") ("%h"))) | 160 | ("-e" "none") ("%h"))) |
| 159 | (tramp-async-args (("-q"))) | 161 | (tramp-async-args (("-q"))) |
| 160 | (tramp-remote-shell "/bin/sh") | 162 | (tramp-remote-shell "/bin/sh") |
| 163 | (tramp-remote-shell-login ("-l")) | ||
| 161 | (tramp-remote-shell-args ("-c")) | 164 | (tramp-remote-shell-args ("-c")) |
| 162 | (tramp-copy-program "scp") | 165 | (tramp-copy-program "scp") |
| 163 | (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r") ("%c"))) | 166 | (tramp-copy-args (("-P" "%p") ("-p" "%k") ("-q") ("-r") ("%c"))) |
| @@ -175,6 +178,7 @@ The string is used in `tramp-methods'.") | |||
| 175 | ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh"))) | 178 | ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh"))) |
| 176 | (tramp-async-args (("-q"))) | 179 | (tramp-async-args (("-q"))) |
| 177 | (tramp-remote-shell "/bin/sh") | 180 | (tramp-remote-shell "/bin/sh") |
| 181 | (tramp-remote-shell-login ("-l")) | ||
| 178 | (tramp-remote-shell-args ("-c")) | 182 | (tramp-remote-shell-args ("-c")) |
| 179 | (tramp-copy-program "scp") | 183 | (tramp-copy-program "scp") |
| 180 | (tramp-copy-args (("-P" "%p") ("-p" "%k") | 184 | (tramp-copy-args (("-P" "%p") ("-p" "%k") |
| @@ -193,6 +197,7 @@ The string is used in `tramp-methods'.") | |||
| 193 | ("-e" "none") ("%h"))) | 197 | ("-e" "none") ("%h"))) |
| 194 | (tramp-async-args (("-q"))) | 198 | (tramp-async-args (("-q"))) |
| 195 | (tramp-remote-shell "/bin/sh") | 199 | (tramp-remote-shell "/bin/sh") |
| 200 | (tramp-remote-shell-login ("-l")) | ||
| 196 | (tramp-remote-shell-args ("-c")) | 201 | (tramp-remote-shell-args ("-c")) |
| 197 | (tramp-copy-program "rsync") | 202 | (tramp-copy-program "rsync") |
| 198 | (tramp-copy-args (("-t" "%k") ("-r"))) | 203 | (tramp-copy-args (("-t" "%k") ("-r"))) |
| @@ -206,6 +211,7 @@ The string is used in `tramp-methods'.") | |||
| 206 | (tramp-login-program "rsh") | 211 | (tramp-login-program "rsh") |
| 207 | (tramp-login-args (("%h") ("-l" "%u"))) | 212 | (tramp-login-args (("%h") ("-l" "%u"))) |
| 208 | (tramp-remote-shell "/bin/sh") | 213 | (tramp-remote-shell "/bin/sh") |
| 214 | (tramp-remote-shell-login ("-l")) | ||
| 209 | (tramp-remote-shell-args ("-c")))) | 215 | (tramp-remote-shell-args ("-c")))) |
| 210 | ;;;###tramp-autoload | 216 | ;;;###tramp-autoload |
| 211 | (add-to-list 'tramp-methods | 217 | (add-to-list 'tramp-methods |
| @@ -213,6 +219,7 @@ The string is used in `tramp-methods'.") | |||
| 213 | (tramp-login-program "remsh") | 219 | (tramp-login-program "remsh") |
| 214 | (tramp-login-args (("%h") ("-l" "%u"))) | 220 | (tramp-login-args (("%h") ("-l" "%u"))) |
| 215 | (tramp-remote-shell "/bin/sh") | 221 | (tramp-remote-shell "/bin/sh") |
| 222 | (tramp-remote-shell-login ("-l")) | ||
| 216 | (tramp-remote-shell-args ("-c")))) | 223 | (tramp-remote-shell-args ("-c")))) |
| 217 | ;;;###tramp-autoload | 224 | ;;;###tramp-autoload |
| 218 | (add-to-list 'tramp-methods | 225 | (add-to-list 'tramp-methods |
| @@ -222,6 +229,7 @@ The string is used in `tramp-methods'.") | |||
| 222 | ("-e" "none") ("%h"))) | 229 | ("-e" "none") ("%h"))) |
| 223 | (tramp-async-args (("-q"))) | 230 | (tramp-async-args (("-q"))) |
| 224 | (tramp-remote-shell "/bin/sh") | 231 | (tramp-remote-shell "/bin/sh") |
| 232 | (tramp-remote-shell-login ("-l")) | ||
| 225 | (tramp-remote-shell-args ("-c")) | 233 | (tramp-remote-shell-args ("-c")) |
| 226 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") | 234 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") |
| 227 | ("-o" "UserKnownHostsFile=/dev/null") | 235 | ("-o" "UserKnownHostsFile=/dev/null") |
| @@ -235,6 +243,7 @@ The string is used in `tramp-methods'.") | |||
| 235 | ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh"))) | 243 | ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh"))) |
| 236 | (tramp-async-args (("-q"))) | 244 | (tramp-async-args (("-q"))) |
| 237 | (tramp-remote-shell "/bin/sh") | 245 | (tramp-remote-shell "/bin/sh") |
| 246 | (tramp-remote-shell-login ("-l")) | ||
| 238 | (tramp-remote-shell-args ("-c")) | 247 | (tramp-remote-shell-args ("-c")) |
| 239 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") | 248 | (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null") |
| 240 | ("-o" "UserKnownHostsFile=/dev/null") | 249 | ("-o" "UserKnownHostsFile=/dev/null") |
| @@ -246,6 +255,7 @@ The string is used in `tramp-methods'.") | |||
| 246 | (tramp-login-program "telnet") | 255 | (tramp-login-program "telnet") |
| 247 | (tramp-login-args (("%h") ("%p") ("2>/dev/null"))) | 256 | (tramp-login-args (("%h") ("%p") ("2>/dev/null"))) |
| 248 | (tramp-remote-shell "/bin/sh") | 257 | (tramp-remote-shell "/bin/sh") |
| 258 | (tramp-remote-shell-login ("-l")) | ||
| 249 | (tramp-remote-shell-args ("-c")) | 259 | (tramp-remote-shell-args ("-c")) |
| 250 | (tramp-default-port 23))) | 260 | (tramp-default-port 23))) |
| 251 | ;;;###tramp-autoload | 261 | ;;;###tramp-autoload |
| @@ -254,6 +264,7 @@ The string is used in `tramp-methods'.") | |||
| 254 | (tramp-login-program "telnet") | 264 | (tramp-login-program "telnet") |
| 255 | (tramp-login-args (("%h") ("%p") ("2>/dev/null"))) | 265 | (tramp-login-args (("%h") ("%p") ("2>/dev/null"))) |
| 256 | (tramp-remote-shell "/bin/sh") | 266 | (tramp-remote-shell "/bin/sh") |
| 267 | (tramp-remote-shell-login ("-l")) | ||
| 257 | (tramp-remote-shell-args ("-c")) | 268 | (tramp-remote-shell-args ("-c")) |
| 258 | (tramp-copy-program "nc") | 269 | (tramp-copy-program "nc") |
| 259 | ;; We use "-v" for better error tracking. | 270 | ;; We use "-v" for better error tracking. |
| @@ -270,6 +281,7 @@ The string is used in `tramp-methods'.") | |||
| 270 | (tramp-login-program "su") | 281 | (tramp-login-program "su") |
| 271 | (tramp-login-args (("-") ("%u"))) | 282 | (tramp-login-args (("-") ("%u"))) |
| 272 | (tramp-remote-shell "/bin/sh") | 283 | (tramp-remote-shell "/bin/sh") |
| 284 | (tramp-remote-shell-login ("-l")) | ||
| 273 | (tramp-remote-shell-args ("-c")) | 285 | (tramp-remote-shell-args ("-c")) |
| 274 | (tramp-connection-timeout 10))) | 286 | (tramp-connection-timeout 10))) |
| 275 | ;;;###tramp-autoload | 287 | ;;;###tramp-autoload |
| @@ -280,6 +292,7 @@ The string is used in `tramp-methods'.") | |||
| 280 | ;; Local $SHELL could be a nasty one, like zsh or fish. Let's override it. | 292 | ;; Local $SHELL could be a nasty one, like zsh or fish. Let's override it. |
| 281 | (tramp-login-env (("SHELL") ("/bin/sh"))) | 293 | (tramp-login-env (("SHELL") ("/bin/sh"))) |
| 282 | (tramp-remote-shell "/bin/sh") | 294 | (tramp-remote-shell "/bin/sh") |
| 295 | (tramp-remote-shell-login ("-l")) | ||
| 283 | (tramp-remote-shell-args ("-c")) | 296 | (tramp-remote-shell-args ("-c")) |
| 284 | (tramp-connection-timeout 10))) | 297 | (tramp-connection-timeout 10))) |
| 285 | ;;;###tramp-autoload | 298 | ;;;###tramp-autoload |
| @@ -288,6 +301,7 @@ The string is used in `tramp-methods'.") | |||
| 288 | (tramp-login-program "ksu") | 301 | (tramp-login-program "ksu") |
| 289 | (tramp-login-args (("%u") ("-q"))) | 302 | (tramp-login-args (("%u") ("-q"))) |
| 290 | (tramp-remote-shell "/bin/sh") | 303 | (tramp-remote-shell "/bin/sh") |
| 304 | (tramp-remote-shell-login ("-l")) | ||
| 291 | (tramp-remote-shell-args ("-c")) | 305 | (tramp-remote-shell-args ("-c")) |
| 292 | (tramp-connection-timeout 10))) | 306 | (tramp-connection-timeout 10))) |
| 293 | ;;;###tramp-autoload | 307 | ;;;###tramp-autoload |
| @@ -296,6 +310,7 @@ The string is used in `tramp-methods'.") | |||
| 296 | (tramp-login-program "krlogin") | 310 | (tramp-login-program "krlogin") |
| 297 | (tramp-login-args (("%h") ("-l" "%u") ("-x"))) | 311 | (tramp-login-args (("%h") ("-l" "%u") ("-x"))) |
| 298 | (tramp-remote-shell "/bin/sh") | 312 | (tramp-remote-shell "/bin/sh") |
| 313 | (tramp-remote-shell-login ("-l")) | ||
| 299 | (tramp-remote-shell-args ("-c")))) | 314 | (tramp-remote-shell-args ("-c")))) |
| 300 | ;;;###tramp-autoload | 315 | ;;;###tramp-autoload |
| 301 | (add-to-list 'tramp-methods | 316 | (add-to-list 'tramp-methods |
| @@ -310,6 +325,7 @@ The string is used in `tramp-methods'.") | |||
| 310 | tramp-initial-end-of-output)) | 325 | tramp-initial-end-of-output)) |
| 311 | ("/bin/sh") ("\""))) | 326 | ("/bin/sh") ("\""))) |
| 312 | (tramp-remote-shell "/bin/sh") | 327 | (tramp-remote-shell "/bin/sh") |
| 328 | (tramp-remote-shell-login ("-l")) | ||
| 313 | (tramp-remote-shell-args ("-c")) | 329 | (tramp-remote-shell-args ("-c")) |
| 314 | (tramp-default-port 22))) | 330 | (tramp-default-port 22))) |
| 315 | ;;;###tramp-autoload | 331 | ;;;###tramp-autoload |
| @@ -323,6 +339,7 @@ The string is used in `tramp-methods'.") | |||
| 323 | tramp-initial-end-of-output)) | 339 | tramp-initial-end-of-output)) |
| 324 | ("/bin/sh") ("\""))) | 340 | ("/bin/sh") ("\""))) |
| 325 | (tramp-remote-shell "/bin/sh") | 341 | (tramp-remote-shell "/bin/sh") |
| 342 | (tramp-remote-shell-login ("-l")) | ||
| 326 | (tramp-remote-shell-args ("-c")))) | 343 | (tramp-remote-shell-args ("-c")))) |
| 327 | ;;;###tramp-autoload | 344 | ;;;###tramp-autoload |
| 328 | (add-to-list 'tramp-methods | 345 | (add-to-list 'tramp-methods |
| @@ -336,6 +353,7 @@ The string is used in `tramp-methods'.") | |||
| 336 | tramp-initial-end-of-output)) | 353 | tramp-initial-end-of-output)) |
| 337 | ("/bin/sh") ("\""))) | 354 | ("/bin/sh") ("\""))) |
| 338 | (tramp-remote-shell "/bin/sh") | 355 | (tramp-remote-shell "/bin/sh") |
| 356 | (tramp-remote-shell-login ("-l")) | ||
| 339 | (tramp-remote-shell-args ("-c")) | 357 | (tramp-remote-shell-args ("-c")) |
| 340 | (tramp-copy-program "pscp") | 358 | (tramp-copy-program "pscp") |
| 341 | (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-scp") ("-p" "%k") | 359 | (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-scp") ("-p" "%k") |
| @@ -355,6 +373,7 @@ The string is used in `tramp-methods'.") | |||
| 355 | tramp-initial-end-of-output)) | 373 | tramp-initial-end-of-output)) |
| 356 | ("/bin/sh") ("\""))) | 374 | ("/bin/sh") ("\""))) |
| 357 | (tramp-remote-shell "/bin/sh") | 375 | (tramp-remote-shell "/bin/sh") |
| 376 | (tramp-remote-shell-login ("-l")) | ||
| 358 | (tramp-remote-shell-args ("-c")) | 377 | (tramp-remote-shell-args ("-c")) |
| 359 | (tramp-copy-program "pscp") | 378 | (tramp-copy-program "pscp") |
| 360 | (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k") | 379 | (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k") |
| @@ -367,6 +386,7 @@ The string is used in `tramp-methods'.") | |||
| 367 | (tramp-login-program "fsh") | 386 | (tramp-login-program "fsh") |
| 368 | (tramp-login-args (("%h") ("-l" "%u") ("sh" "-i"))) | 387 | (tramp-login-args (("%h") ("-l" "%u") ("sh" "-i"))) |
| 369 | (tramp-remote-shell "/bin/sh") | 388 | (tramp-remote-shell "/bin/sh") |
| 389 | (tramp-remote-shell-login ("-l")) | ||
| 370 | (tramp-remote-shell-args ("-i") ("-c")) | 390 | (tramp-remote-shell-args ("-i") ("-c")) |
| 371 | (tramp-copy-program "fcp") | 391 | (tramp-copy-program "fcp") |
| 372 | (tramp-copy-args (("-p" "%k"))) | 392 | (tramp-copy-args (("-p" "%k"))) |
| @@ -1957,7 +1977,7 @@ tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'" | |||
| 1957 | (t2 (tramp-tramp-file-p newname))) | 1977 | (t2 (tramp-tramp-file-p newname))) |
| 1958 | (with-parsed-tramp-file-name (if t1 dirname newname) nil | 1978 | (with-parsed-tramp-file-name (if t1 dirname newname) nil |
| 1959 | (if (and (not copy-contents) | 1979 | (if (and (not copy-contents) |
| 1960 | (tramp-get-method-parameter method 'tramp-copy-recursive) | 1980 | (tramp-get-method-parameter v 'tramp-copy-recursive) |
| 1961 | ;; When DIRNAME and NEWNAME are remote, they must have | 1981 | ;; When DIRNAME and NEWNAME are remote, they must have |
| 1962 | ;; the same method. | 1982 | ;; the same method. |
| 1963 | (or (null t1) (null t2) | 1983 | (or (null t1) (null t2) |
| @@ -2379,7 +2399,7 @@ The method used must be an out-of-band method." | |||
| 2379 | (tramp-get-connection-property v "login-as" nil))) | 2399 | (tramp-get-connection-property v "login-as" nil))) |
| 2380 | 2400 | ||
| 2381 | ;; Check for listener port. | 2401 | ;; Check for listener port. |
| 2382 | (when (tramp-get-method-parameter method 'tramp-remote-copy-args) | 2402 | (when (tramp-get-method-parameter v 'tramp-remote-copy-args) |
| 2383 | (setq listener (number-to-string (+ 50000 (random 10000)))) | 2403 | (setq listener (number-to-string (+ 50000 (random 10000)))) |
| 2384 | (while | 2404 | (while |
| 2385 | (zerop (tramp-call-process v "nc" nil nil nil "-z" host listener)) | 2405 | (zerop (tramp-call-process v "nc" nil nil nil "-z" host listener)) |
| @@ -2396,10 +2416,9 @@ The method used must be an out-of-band method." | |||
| 2396 | spec (format-spec-make | 2416 | spec (format-spec-make |
| 2397 | ?h host ?u user ?p port ?r listener ?c options | 2417 | ?h host ?u user ?p port ?r listener ?c options |
| 2398 | ?k (if keep-date " " "")) | 2418 | ?k (if keep-date " " "")) |
| 2399 | copy-program (tramp-get-method-parameter | 2419 | copy-program (tramp-get-method-parameter v 'tramp-copy-program) |
| 2400 | method 'tramp-copy-program) | ||
| 2401 | copy-keep-date (tramp-get-method-parameter | 2420 | copy-keep-date (tramp-get-method-parameter |
| 2402 | method 'tramp-copy-keep-date) | 2421 | v 'tramp-copy-keep-date) |
| 2403 | 2422 | ||
| 2404 | copy-args | 2423 | copy-args |
| 2405 | (delete | 2424 | (delete |
| @@ -2408,9 +2427,7 @@ The method used must be an out-of-band method." | |||
| 2408 | ;; for the whole keep-date sublist. | 2427 | ;; for the whole keep-date sublist. |
| 2409 | " " | 2428 | " " |
| 2410 | (dolist | 2429 | (dolist |
| 2411 | (x | 2430 | (x (tramp-get-method-parameter v 'tramp-copy-args) copy-args) |
| 2412 | (tramp-get-method-parameter method 'tramp-copy-args) | ||
| 2413 | copy-args) | ||
| 2414 | (setq copy-args | 2431 | (setq copy-args |
| 2415 | (append | 2432 | (append |
| 2416 | copy-args | 2433 | copy-args |
| @@ -2424,16 +2441,12 @@ The method used must be an out-of-band method." | |||
| 2424 | (lambda (x) | 2441 | (lambda (x) |
| 2425 | (setq x (mapcar (lambda (y) (format-spec y spec)) x)) | 2442 | (setq x (mapcar (lambda (y) (format-spec y spec)) x)) |
| 2426 | (unless (member "" x) (mapconcat 'identity x " "))) | 2443 | (unless (member "" x) (mapconcat 'identity x " "))) |
| 2427 | (tramp-get-method-parameter method 'tramp-copy-env))) | 2444 | (tramp-get-method-parameter v 'tramp-copy-env))) |
| 2428 | 2445 | ||
| 2429 | remote-copy-program | 2446 | remote-copy-program |
| 2430 | (tramp-get-method-parameter method 'tramp-remote-copy-program)) | 2447 | (tramp-get-method-parameter v 'tramp-remote-copy-program)) |
| 2431 | 2448 | ||
| 2432 | (dolist | 2449 | (dolist (x (tramp-get-method-parameter v 'tramp-remote-copy-args)) |
| 2433 | (x | ||
| 2434 | (or | ||
| 2435 | (tramp-get-connection-property v "remote-copy-args" nil) | ||
| 2436 | (tramp-get-method-parameter method 'tramp-remote-copy-args))) | ||
| 2437 | (setq remote-copy-args | 2450 | (setq remote-copy-args |
| 2438 | (append | 2451 | (append |
| 2439 | remote-copy-args | 2452 | remote-copy-args |
| @@ -3333,8 +3346,7 @@ the result will be a local, non-Tramp, file name." | |||
| 3333 | (if (and (not (stringp start)) | 3346 | (if (and (not (stringp start)) |
| 3334 | (= (or end (point-max)) (point-max)) | 3347 | (= (or end (point-max)) (point-max)) |
| 3335 | (= (or start (point-min)) (point-min)) | 3348 | (= (or start (point-min)) (point-min)) |
| 3336 | (tramp-get-method-parameter | 3349 | (tramp-get-method-parameter v 'tramp-copy-keep-tmpfile)) |
| 3337 | method 'tramp-copy-keep-tmpfile)) | ||
| 3338 | (progn | 3350 | (progn |
| 3339 | (setq tramp-temp-buffer-file-name tmpfile) | 3351 | (setq tramp-temp-buffer-file-name tmpfile) |
| 3340 | (condition-case err | 3352 | (condition-case err |
| @@ -3952,12 +3964,7 @@ file exists and nonzero exit status otherwise." | |||
| 3952 | (defun tramp-find-shell (vec) | 3964 | (defun tramp-find-shell (vec) |
| 3953 | "Opens a shell on the remote host which groks tilde expansion." | 3965 | "Opens a shell on the remote host which groks tilde expansion." |
| 3954 | (with-current-buffer (tramp-get-buffer vec) | 3966 | (with-current-buffer (tramp-get-buffer vec) |
| 3955 | (let ((default-shell | 3967 | (let ((default-shell (tramp-get-method-parameter vec 'tramp-remote-shell)) |
| 3956 | (or | ||
| 3957 | (tramp-get-connection-property | ||
| 3958 | (tramp-get-connection-process vec) "remote-shell" nil) | ||
| 3959 | (tramp-get-method-parameter | ||
| 3960 | (tramp-file-name-method vec) 'tramp-remote-shell))) | ||
| 3961 | shell) | 3968 | shell) |
| 3962 | (setq shell | 3969 | (setq shell |
| 3963 | (with-tramp-connection-property vec "remote-shell" | 3970 | (with-tramp-connection-property vec "remote-shell" |
| @@ -4016,11 +4023,7 @@ seconds. If not, it produces an error message with the given ERROR-ARGS." | |||
| 4016 | Mainly sets the prompt and the echo correctly. PROC is the shell | 4023 | Mainly sets the prompt and the echo correctly. PROC is the shell |
| 4017 | process to set up. VEC specifies the connection." | 4024 | process to set up. VEC specifies the connection." |
| 4018 | (let ((tramp-end-of-output tramp-initial-end-of-output)) | 4025 | (let ((tramp-end-of-output tramp-initial-end-of-output)) |
| 4019 | (tramp-open-shell | 4026 | (tramp-open-shell vec (tramp-get-method-parameter vec 'tramp-remote-shell)) |
| 4020 | vec | ||
| 4021 | (or (tramp-get-connection-property vec "remote-shell" nil) | ||
| 4022 | (tramp-get-method-parameter | ||
| 4023 | (tramp-file-name-method vec) 'tramp-remote-shell))) | ||
| 4024 | 4027 | ||
| 4025 | ;; Disable echo. | 4028 | ;; Disable echo. |
| 4026 | (tramp-message vec 5 "Setting up remote shell environment") | 4029 | (tramp-message vec 5 "Setting up remote shell environment") |
| @@ -4557,15 +4560,9 @@ Gateway hops are already opened." | |||
| 4557 | ;; Foreign and out-of-band methods are not supported for multi-hops. | 4560 | ;; Foreign and out-of-band methods are not supported for multi-hops. |
| 4558 | (when (cdr target-alist) | 4561 | (when (cdr target-alist) |
| 4559 | (setq choices target-alist) | 4562 | (setq choices target-alist) |
| 4560 | (while choices | 4563 | (while (setq item (pop choices)) |
| 4561 | (setq item (pop choices)) | 4564 | (when (or (not (tramp-get-method-parameter item 'tramp-login-program)) |
| 4562 | (when | 4565 | (tramp-get-method-parameter item 'tramp-copy-program)) |
| 4563 | (or | ||
| 4564 | (not | ||
| 4565 | (tramp-get-method-parameter | ||
| 4566 | (tramp-file-name-method item) 'tramp-login-program)) | ||
| 4567 | (tramp-get-method-parameter | ||
| 4568 | (tramp-file-name-method item) 'tramp-copy-program)) | ||
| 4569 | (tramp-error | 4566 | (tramp-error |
| 4570 | vec 'file-error | 4567 | vec 'file-error |
| 4571 | "Method `%s' is not supported for multi-hops." | 4568 | "Method `%s' is not supported for multi-hops." |
| @@ -4582,8 +4579,7 @@ Gateway hops are already opened." | |||
| 4582 | ;; There are multi-hops. | 4579 | ;; There are multi-hops. |
| 4583 | (cdr target-alist) | 4580 | (cdr target-alist) |
| 4584 | ;; The host name is used for the remote shell command. | 4581 | ;; The host name is used for the remote shell command. |
| 4585 | (member | 4582 | (member '("%h") (tramp-get-method-parameter v 'tramp-login-args)) |
| 4586 | '("%h") (tramp-get-method-parameter method 'tramp-login-args)) | ||
| 4587 | ;; The host is local. We cannot use `tramp-local-host-p' | 4583 | ;; The host is local. We cannot use `tramp-local-host-p' |
| 4588 | ;; here, because it opens a connection as well. | 4584 | ;; here, because it opens a connection as well. |
| 4589 | (string-match tramp-local-host-regexp host)) | 4585 | (string-match tramp-local-host-regexp host)) |
| @@ -4600,8 +4596,7 @@ Gateway hops are already opened." | |||
| 4600 | (cond | 4596 | (cond |
| 4601 | ;; No options to be computed. | 4597 | ;; No options to be computed. |
| 4602 | ((or (null tramp-use-ssh-controlmaster-options) | 4598 | ((or (null tramp-use-ssh-controlmaster-options) |
| 4603 | (null (assoc "%c" (tramp-get-method-parameter | 4599 | (null (assoc "%c" (tramp-get-method-parameter vec 'tramp-login-args)))) |
| 4604 | (tramp-file-name-method vec) 'tramp-login-args)))) | ||
| 4605 | "") | 4600 | "") |
| 4606 | 4601 | ||
| 4607 | ;; There is already a value to be used. | 4602 | ;; There is already a value to be used. |
| @@ -4764,22 +4759,18 @@ connection if a previous connection has died for some reason." | |||
| 4764 | (l-host (tramp-file-name-host hop)) | 4759 | (l-host (tramp-file-name-host hop)) |
| 4765 | (l-port nil) | 4760 | (l-port nil) |
| 4766 | (login-program | 4761 | (login-program |
| 4767 | (tramp-get-method-parameter | 4762 | (tramp-get-method-parameter hop 'tramp-login-program)) |
| 4768 | l-method 'tramp-login-program)) | ||
| 4769 | (login-args | 4763 | (login-args |
| 4770 | (tramp-get-method-parameter | 4764 | (tramp-get-method-parameter hop 'tramp-login-args)) |
| 4771 | l-method 'tramp-login-args)) | ||
| 4772 | (login-env | 4765 | (login-env |
| 4773 | (tramp-get-method-parameter | 4766 | (tramp-get-method-parameter hop 'tramp-login-env)) |
| 4774 | l-method 'tramp-login-env)) | ||
| 4775 | (async-args | 4767 | (async-args |
| 4776 | (tramp-get-method-parameter | 4768 | (tramp-get-method-parameter hop 'tramp-async-args)) |
| 4777 | l-method 'tramp-async-args)) | ||
| 4778 | (connection-timeout | 4769 | (connection-timeout |
| 4779 | (tramp-get-method-parameter | 4770 | (tramp-get-method-parameter |
| 4780 | l-method 'tramp-connection-timeout)) | 4771 | hop 'tramp-connection-timeout)) |
| 4781 | (gw-args | 4772 | (gw-args |
| 4782 | (tramp-get-method-parameter l-method 'tramp-gw-args)) | 4773 | (tramp-get-method-parameter hop 'tramp-gw-args)) |
| 4783 | (gw (let ((tramp-verbose 0)) | 4774 | (gw (let ((tramp-verbose 0)) |
| 4784 | (tramp-get-file-property hop "" "gateway" nil))) | 4775 | (tramp-get-file-property hop "" "gateway" nil))) |
| 4785 | (g-method (and gw (tramp-file-name-method gw))) | 4776 | (g-method (and gw (tramp-file-name-method gw))) |
| @@ -5121,12 +5112,13 @@ Return ATTR." | |||
| 5121 | (let ((method (tramp-file-name-method vec)) | 5112 | (let ((method (tramp-file-name-method vec)) |
| 5122 | (user (tramp-file-name-user vec)) | 5113 | (user (tramp-file-name-user vec)) |
| 5123 | (host (tramp-file-name-real-host vec)) | 5114 | (host (tramp-file-name-real-host vec)) |
| 5124 | (localname (tramp-shell-quote-argument | 5115 | (localname (tramp-file-name-localname vec))) |
| 5125 | (tramp-file-name-localname vec)))) | ||
| 5126 | (when (string-match tramp-ipv6-regexp host) | 5116 | (when (string-match tramp-ipv6-regexp host) |
| 5127 | (setq host (format "[%s]" host))) | 5117 | (setq host (format "[%s]" host))) |
| 5118 | (unless (string-match "ftp$" method) | ||
| 5119 | (setq localname (tramp-shell-quote-argument localname))) | ||
| 5128 | (cond | 5120 | (cond |
| 5129 | ((tramp-get-method-parameter method 'tramp-remote-copy-program) | 5121 | ((tramp-get-method-parameter vec 'tramp-remote-copy-program) |
| 5130 | localname) | 5122 | localname) |
| 5131 | ((not (zerop (length user))) | 5123 | ((not (zerop (length user))) |
| 5132 | (shell-quote-argument (format "%s@%s:%s" user host localname))) | 5124 | (shell-quote-argument (format "%s@%s:%s" user host localname))) |
| @@ -5136,7 +5128,7 @@ Return ATTR." | |||
| 5136 | "Return t if this is an out-of-band method, nil otherwise." | 5128 | "Return t if this is an out-of-band method, nil otherwise." |
| 5137 | (and | 5129 | (and |
| 5138 | ;; It shall be an out-of-band method. | 5130 | ;; It shall be an out-of-band method. |
| 5139 | (tramp-get-method-parameter (tramp-file-name-method vec) 'tramp-copy-program) | 5131 | (tramp-get-method-parameter vec 'tramp-copy-program) |
| 5140 | ;; There must be a size, otherwise the file doesn't exist. | 5132 | ;; There must be a size, otherwise the file doesn't exist. |
| 5141 | (numberp size) | 5133 | (numberp size) |
| 5142 | ;; Either the file size is large enough, or (in rare cases) there | 5134 | ;; Either the file size is large enough, or (in rare cases) there |
| @@ -5178,13 +5170,15 @@ Return ATTR." | |||
| 5178 | (tramp-send-command-and-read | 5170 | (tramp-send-command-and-read |
| 5179 | vec | 5171 | vec |
| 5180 | (format | 5172 | (format |
| 5181 | "%s -l %s 'echo %s \\\"$PATH\\\"'" | 5173 | "%s %s %s 'echo %s \\\"$PATH\\\"'" |
| 5182 | (tramp-get-method-parameter | 5174 | (tramp-get-method-parameter vec 'tramp-remote-shell) |
| 5183 | (tramp-file-name-method vec) 'tramp-remote-shell) | 5175 | (mapconcat |
| 5176 | 'identity | ||
| 5177 | (tramp-get-method-parameter vec 'tramp-remote-shell-login) | ||
| 5178 | " ") | ||
| 5184 | (mapconcat | 5179 | (mapconcat |
| 5185 | 'identity | 5180 | 'identity |
| 5186 | (tramp-get-method-parameter | 5181 | (tramp-get-method-parameter vec 'tramp-remote-shell-args) |
| 5187 | (tramp-file-name-method vec) 'tramp-remote-shell-args) | ||
| 5188 | " ") | 5182 | " ") |
| 5189 | (tramp-shell-quote-argument tramp-end-of-heredoc)) | 5183 | (tramp-shell-quote-argument tramp-end-of-heredoc)) |
| 5190 | nil (regexp-quote tramp-end-of-heredoc))))) | 5184 | nil (regexp-quote tramp-end-of-heredoc))))) |
| @@ -5636,8 +5630,6 @@ function cell is returned to be applied on a buffer." | |||
| 5636 | ;; * Don't use globbing for directories with many files, as this is | 5630 | ;; * Don't use globbing for directories with many files, as this is |
| 5637 | ;; likely to produce long command lines, and some shells choke on | 5631 | ;; likely to produce long command lines, and some shells choke on |
| 5638 | ;; long command lines. | 5632 | ;; long command lines. |
| 5639 | ;; * Make it work for different encodings, and for different file name | ||
| 5640 | ;; encodings, too. (Daniel Pittman) | ||
| 5641 | ;; * Don't search for perl5 and perl. Instead, only search for perl and | 5633 | ;; * Don't search for perl5 and perl. Instead, only search for perl and |
| 5642 | ;; then look if it's the right version (with `perl -v'). | 5634 | ;; then look if it's the right version (with `perl -v'). |
| 5643 | ;; * When editing a remote CVS controlled file as a different user, VC | 5635 | ;; * When editing a remote CVS controlled file as a different user, VC |
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index fc23a0bfeb5..beb87f61aaa 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -210,6 +210,12 @@ pair of the form (KEY VALUE). The following KEYs are defined: | |||
| 210 | for it. Also note that \"/bin/sh\" exists on all Unixen, | 210 | for it. Also note that \"/bin/sh\" exists on all Unixen, |
| 211 | this might not be true for the value that you decide to use. | 211 | this might not be true for the value that you decide to use. |
| 212 | You Have Been Warned. | 212 | You Have Been Warned. |
| 213 | * `tramp-remote-shell-login' | ||
| 214 | This specifies the arguments to let `tramp-remote-shell' run | ||
| 215 | as a login shell. It defaults to (\"-l\"), but some shells, | ||
| 216 | like ksh, require another argument. See | ||
| 217 | `tramp-connection-properties' for a way to overwrite the | ||
| 218 | default value. | ||
| 213 | * `tramp-remote-shell-args' | 219 | * `tramp-remote-shell-args' |
| 214 | For implementation of `shell-command', this specifies the | 220 | For implementation of `shell-command', this specifies the |
| 215 | arguments to let `tramp-remote-shell' run a single command. | 221 | arguments to let `tramp-remote-shell' run a single command. |
| @@ -1099,11 +1105,20 @@ calling HANDLER.") | |||
| 1099 | ;; internal data structure. Convenience functions for internal | 1105 | ;; internal data structure. Convenience functions for internal |
| 1100 | ;; data structure. | 1106 | ;; data structure. |
| 1101 | 1107 | ||
| 1102 | (defun tramp-get-method-parameter (method param) | 1108 | (defun tramp-get-method-parameter (vec param) |
| 1103 | "Return the method parameter PARAM. | 1109 | "Return the method parameter PARAM. |
| 1104 | If the `tramp-methods' entry does not exist, return nil." | 1110 | If VEC is a vector, check first in connection properties. |
| 1105 | (let ((entry (assoc param (assoc method tramp-methods)))) | 1111 | Afterwards, check in `tramp-methods'. If the `tramp-methods' |
| 1106 | (when entry (cadr entry)))) | 1112 | entry does not exist, return nil." |
| 1113 | (let ((hash-entry | ||
| 1114 | (replace-regexp-in-string "^tramp-" "" (symbol-name param)))) | ||
| 1115 | (if (tramp-connection-property-p vec hash-entry) | ||
| 1116 | ;; We use the cached property. | ||
| 1117 | (tramp-get-connection-property vec hash-entry nil) | ||
| 1118 | ;; Use the static value from `tramp-methods'. | ||
| 1119 | (let ((methods-entry | ||
| 1120 | (assoc param (assoc (tramp-file-name-method vec) tramp-methods)))) | ||
| 1121 | (when methods-entry (cadr methods-entry)))))) | ||
| 1107 | 1122 | ||
| 1108 | (defun tramp-file-name-p (vec) | 1123 | (defun tramp-file-name-p (vec) |
| 1109 | "Check, whether VEC is a Tramp object." | 1124 | "Check, whether VEC is a Tramp object." |
| @@ -1167,7 +1182,7 @@ If the `tramp-methods' entry does not exist, return nil." | |||
| 1167 | (or (and (stringp host) | 1182 | (or (and (stringp host) |
| 1168 | (string-match tramp-host-with-port-regexp host) | 1183 | (string-match tramp-host-with-port-regexp host) |
| 1169 | (string-to-number (match-string 2 host))) | 1184 | (string-to-number (match-string 2 host))) |
| 1170 | (tramp-get-method-parameter method 'tramp-default-port))))) | 1185 | (tramp-get-method-parameter vec 'tramp-default-port))))) |
| 1171 | 1186 | ||
| 1172 | ;;;###tramp-autoload | 1187 | ;;;###tramp-autoload |
| 1173 | (defun tramp-tramp-file-p (name) | 1188 | (defun tramp-tramp-file-p (name) |
| @@ -3092,8 +3107,7 @@ User is always nil." | |||
| 3092 | ;; name handlers. | 3107 | ;; name handlers. |
| 3093 | (when (and (or beg end) | 3108 | (when (and (or beg end) |
| 3094 | (tramp-get-method-parameter | 3109 | (tramp-get-method-parameter |
| 3095 | (tramp-file-name-method v) | 3110 | v 'tramp-login-program)) |
| 3096 | 'tramp-login-program)) | ||
| 3097 | (setq remote-copy (tramp-make-tramp-temp-file v)) | 3111 | (setq remote-copy (tramp-make-tramp-temp-file v)) |
| 3098 | ;; This is defined in tramp-sh.el. Let's assume | 3112 | ;; This is defined in tramp-sh.el. Let's assume |
| 3099 | ;; this is loaded already. | 3113 | ;; this is loaded already. |
| @@ -3144,7 +3158,7 @@ User is always nil." | |||
| 3144 | 3158 | ||
| 3145 | (when (and (null remote-copy) | 3159 | (when (and (null remote-copy) |
| 3146 | (tramp-get-method-parameter | 3160 | (tramp-get-method-parameter |
| 3147 | method 'tramp-copy-keep-tmpfile)) | 3161 | v 'tramp-copy-keep-tmpfile)) |
| 3148 | ;; We keep the local file for performance reasons, | 3162 | ;; We keep the local file for performance reasons, |
| 3149 | ;; useful for "rsync". | 3163 | ;; useful for "rsync". |
| 3150 | (setq tramp-temp-buffer-file-name local-copy)) | 3164 | (setq tramp-temp-buffer-file-name local-copy)) |
| @@ -3228,12 +3242,10 @@ User is always nil." | |||
| 3228 | (args (append | 3242 | (args (append |
| 3229 | (cons | 3243 | (cons |
| 3230 | (tramp-get-method-parameter | 3244 | (tramp-get-method-parameter |
| 3231 | (tramp-file-name-method | 3245 | (tramp-dissect-file-name default-directory) |
| 3232 | (tramp-dissect-file-name default-directory)) | ||
| 3233 | 'tramp-remote-shell) | 3246 | 'tramp-remote-shell) |
| 3234 | (tramp-get-method-parameter | 3247 | (tramp-get-method-parameter |
| 3235 | (tramp-file-name-method | 3248 | (tramp-dissect-file-name default-directory) |
| 3236 | (tramp-dissect-file-name default-directory)) | ||
| 3237 | 'tramp-remote-shell-args)) | 3249 | 'tramp-remote-shell-args)) |
| 3238 | (list (substring command 0 asynchronous)))) | 3250 | (list (substring command 0 asynchronous)))) |
| 3239 | current-buffer-p | 3251 | current-buffer-p |
| @@ -3952,8 +3964,7 @@ be granted." | |||
| 3952 | ;; The method shall be applied to one of the shell file name | 3964 | ;; The method shall be applied to one of the shell file name |
| 3953 | ;; handlers. `tramp-local-host-p' is also called for "smb" and | 3965 | ;; handlers. `tramp-local-host-p' is also called for "smb" and |
| 3954 | ;; alike, where it must fail. | 3966 | ;; alike, where it must fail. |
| 3955 | (tramp-get-method-parameter | 3967 | (tramp-get-method-parameter vec 'tramp-login-program) |
| 3956 | (tramp-file-name-method vec) 'tramp-login-program) | ||
| 3957 | ;; The local temp directory must be writable for the other user. | 3968 | ;; The local temp directory must be writable for the other user. |
| 3958 | (file-writable-p | 3969 | (file-writable-p |
| 3959 | (tramp-make-tramp-file-name | 3970 | (tramp-make-tramp-file-name |
| @@ -3969,18 +3980,19 @@ be granted." | |||
| 3969 | 3980 | ||
| 3970 | (defun tramp-get-remote-tmpdir (vec) | 3981 | (defun tramp-get-remote-tmpdir (vec) |
| 3971 | "Return directory for temporary files on the remote host identified by VEC." | 3982 | "Return directory for temporary files on the remote host identified by VEC." |
| 3972 | (with-tramp-connection-property vec "tmpdir" | 3983 | (when (file-remote-p (tramp-get-connection-property vec "tmpdir" "")) |
| 3973 | (let ((dir (tramp-make-tramp-file-name | 3984 | ;; Compatibility code: Cached value shall be the local path only. |
| 3974 | (tramp-file-name-method vec) | 3985 | (tramp-set-connection-property vec "tmpdir" 'undef)) |
| 3975 | (tramp-file-name-user vec) | 3986 | (let ((dir (tramp-make-tramp-file-name |
| 3976 | (tramp-file-name-host vec) | 3987 | (tramp-file-name-method vec) |
| 3977 | (or | 3988 | (tramp-file-name-user vec) |
| 3978 | (tramp-get-method-parameter | 3989 | (tramp-file-name-host vec) |
| 3979 | (tramp-file-name-method vec) 'tramp-tmpdir) | 3990 | (or (tramp-get-method-parameter vec 'tramp-tmpdir) "/tmp")))) |
| 3980 | "/tmp")))) | 3991 | (with-tramp-connection-property vec "tmpdir" |
| 3981 | (if (and (file-directory-p dir) (file-writable-p dir)) | 3992 | (or (and (file-directory-p dir) (file-writable-p dir) |
| 3982 | dir | 3993 | (file-remote-p dir 'localname)) |
| 3983 | (tramp-error vec 'file-error "Directory %s not accessible" dir))))) | 3994 | (tramp-error vec 'file-error "Directory %s not accessible" dir))) |
| 3995 | dir)) | ||
| 3984 | 3996 | ||
| 3985 | ;;;###tramp-autoload | 3997 | ;;;###tramp-autoload |
| 3986 | (defun tramp-make-tramp-temp-file (vec) | 3998 | (defun tramp-make-tramp-temp-file (vec) |
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el index beb040955e7..2f575f93037 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.12" | 34 | (defconst tramp-version "2.2.13-pre" |
| 35 | "This version of Tramp.") | 35 | "This version of Tramp.") |
| 36 | 36 | ||
| 37 | ;;;###tramp-autoload | 37 | ;;;###tramp-autoload |
| @@ -58,7 +58,7 @@ | |||
| 58 | (= emacs-major-version 21) | 58 | (= emacs-major-version 21) |
| 59 | (>= emacs-minor-version 4))) | 59 | (>= emacs-minor-version 4))) |
| 60 | "ok" | 60 | "ok" |
| 61 | (format "Tramp 2.2.12 is not fit for %s" | 61 | (format "Tramp 2.2.13-pre is not fit for %s" |
| 62 | (when (string-match "^.*$" (emacs-version)) | 62 | (when (string-match "^.*$" (emacs-version)) |
| 63 | (match-string 0 (emacs-version))))))) | 63 | (match-string 0 (emacs-version))))))) |
| 64 | (unless (string-match "\\`ok\\'" x) (error "%s" x))) | 64 | (unless (string-match "\\`ok\\'" x) (error "%s" x))) |
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index e1039392ea7..24cfa247c93 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el | |||
| @@ -117,7 +117,9 @@ shall not contain a timeout." | |||
| 117 | (declare (indent 1) (debug (natnump body))) | 117 | (declare (indent 1) (debug (natnump body))) |
| 118 | `(let ((tramp-verbose ,verbose) | 118 | `(let ((tramp-verbose ,verbose) |
| 119 | (tramp-message-show-message t) | 119 | (tramp-message-show-message t) |
| 120 | (tramp-debug-on-error t)) | 120 | (tramp-debug-on-error t) |
| 121 | (debug-ignored-errors | ||
| 122 | (cons "^make-symbolic-link not supported$" debug-ignored-errors))) | ||
| 121 | (unwind-protect | 123 | (unwind-protect |
| 122 | (progn ,@body) | 124 | (progn ,@body) |
| 123 | (when (> tramp-verbose 3) | 125 | (when (> tramp-verbose 3) |
| @@ -859,22 +861,20 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 859 | This tests also `file-directory-p' and `file-accessible-directory-p'." | 861 | This tests also `file-directory-p' and `file-accessible-directory-p'." |
| 860 | (skip-unless (tramp--test-enabled)) | 862 | (skip-unless (tramp--test-enabled)) |
| 861 | 863 | ||
| 862 | (let ((tmp-name (tramp--test-make-temp-name))) | 864 | (let* ((tmp-name1 (tramp--test-make-temp-name)) |
| 865 | (tmp-name2 (expand-file-name "foo/bar" tmp-name1))) | ||
| 863 | (unwind-protect | 866 | (unwind-protect |
| 864 | (progn | 867 | (progn |
| 865 | (make-directory tmp-name) | 868 | (make-directory tmp-name1) |
| 866 | (should (file-directory-p tmp-name)) | 869 | (should (file-directory-p tmp-name1)) |
| 867 | (should (file-accessible-directory-p tmp-name)) | 870 | (should (file-accessible-directory-p tmp-name1)) |
| 868 | (should-error | 871 | (should-error (make-directory tmp-name2) :type 'file-error) |
| 869 | (make-directory (expand-file-name "foo/bar" tmp-name)) | 872 | (make-directory tmp-name2 'parents) |
| 870 | :type 'file-error) | 873 | (should (file-directory-p tmp-name2)) |
| 871 | (make-directory (expand-file-name "foo/bar" tmp-name) 'parents) | 874 | (should (file-accessible-directory-p tmp-name2))) |
| 872 | (should (file-directory-p (expand-file-name "foo/bar" tmp-name))) | ||
| 873 | (should | ||
| 874 | (file-accessible-directory-p (expand-file-name "foo/bar" tmp-name)))) | ||
| 875 | 875 | ||
| 876 | ;; Cleanup. | 876 | ;; Cleanup. |
| 877 | (ignore-errors (delete-directory tmp-name 'recursive))))) | 877 | (ignore-errors (delete-directory tmp-name1 'recursive))))) |
| 878 | 878 | ||
| 879 | (ert-deftest tramp-test14-delete-directory () | 879 | (ert-deftest tramp-test14-delete-directory () |
| 880 | "Check `delete-directory'." | 880 | "Check `delete-directory'." |
| @@ -1667,17 +1667,28 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1667 | (defun tramp--test-adb-p () | 1667 | (defun tramp--test-adb-p () |
| 1668 | "Check, whether the remote host runs Android. | 1668 | "Check, whether the remote host runs Android. |
| 1669 | This requires restrictions of file name syntax." | 1669 | This requires restrictions of file name syntax." |
| 1670 | (eq (tramp-find-foreign-file-name-handler | 1670 | (tramp-adb-file-name-p tramp-test-temporary-file-directory)) |
| 1671 | tramp-test-temporary-file-directory) | 1671 | |
| 1672 | 'tramp-adb-file-name-handler)) | 1672 | (defun tramp--test-ftp-p () |
| 1673 | "Check, whether an FTP-like method is used. | ||
| 1674 | This does not support globbing characters in file names (yet)." | ||
| 1675 | ;; Globbing characters are ??, ?* and ?\[. | ||
| 1676 | (and (eq (tramp-find-foreign-file-name-handler | ||
| 1677 | tramp-test-temporary-file-directory) | ||
| 1678 | 'tramp-sh-file-name-handler) | ||
| 1679 | (string-match | ||
| 1680 | "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method)))) | ||
| 1681 | |||
| 1682 | (defun tramp--test-gvfs-p () | ||
| 1683 | "Check, whether the remote host runs a GVFS based method. | ||
| 1684 | This requires restrictions of file name syntax." | ||
| 1685 | (tramp-gvfs-file-name-p tramp-test-temporary-file-directory)) | ||
| 1673 | 1686 | ||
| 1674 | (defun tramp--test-smb-or-windows-nt-p () | 1687 | (defun tramp--test-smb-or-windows-nt-p () |
| 1675 | "Check, whether the locale or remote host runs MS Windows. | 1688 | "Check, whether the locale or remote host runs MS Windows. |
| 1676 | This requires restrictions of file name syntax." | 1689 | This requires restrictions of file name syntax." |
| 1677 | (or (eq system-type 'windows-nt) | 1690 | (or (eq system-type 'windows-nt) |
| 1678 | (eq (tramp-find-foreign-file-name-handler | 1691 | (tramp-smb-file-name-p tramp-test-temporary-file-directory))) |
| 1679 | tramp-test-temporary-file-directory) | ||
| 1680 | 'tramp-smb-file-name-handler))) | ||
| 1681 | 1692 | ||
| 1682 | (defun tramp--test-check-files (&rest files) | 1693 | (defun tramp--test-check-files (&rest files) |
| 1683 | "Run a simple but comprehensive test over every file in FILES." | 1694 | "Run a simple but comprehensive test over every file in FILES." |
| @@ -1815,14 +1826,14 @@ This requires restrictions of file name syntax." | |||
| 1815 | (ignore-errors (delete-directory tmp-name2 'recursive))))) | 1826 | (ignore-errors (delete-directory tmp-name2 'recursive))))) |
| 1816 | 1827 | ||
| 1817 | (defun tramp--test-special-characters () | 1828 | (defun tramp--test-special-characters () |
| 1818 | "Perform the test in `tramp-test30-special-characters*'." | 1829 | "Perform the test in `tramp-test31-special-characters*'." |
| 1819 | ;; Newlines, slashes and backslashes in file names are not | 1830 | ;; Newlines, slashes and backslashes in file names are not |
| 1820 | ;; supported. So we don't test. And we don't test the tab | 1831 | ;; supported. So we don't test. And we don't test the tab |
| 1821 | ;; character on Windows or Cygwin, because the backslash is | 1832 | ;; character on Windows or Cygwin, because the backslash is |
| 1822 | ;; interpreted as a path separator, preventing "\t" from being | 1833 | ;; interpreted as a path separator, preventing "\t" from being |
| 1823 | ;; expanded to <TAB>. | 1834 | ;; expanded to <TAB>. |
| 1824 | (tramp--test-check-files | 1835 | (tramp--test-check-files |
| 1825 | (if (tramp--test-smb-or-windows-nt-p) | 1836 | (if (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p)) |
| 1826 | "foo bar baz" | 1837 | "foo bar baz" |
| 1827 | (if (or (tramp--test-adb-p) (eq system-type 'cygwin)) | 1838 | (if (or (tramp--test-adb-p) (eq system-type 'cygwin)) |
| 1828 | " foo bar baz " | 1839 | " foo bar baz " |
| @@ -1831,15 +1842,28 @@ This requires restrictions of file name syntax." | |||
| 1831 | "-foo-bar-baz-" | 1842 | "-foo-bar-baz-" |
| 1832 | "%foo%bar%baz%" | 1843 | "%foo%bar%baz%" |
| 1833 | "&foo&bar&baz&" | 1844 | "&foo&bar&baz&" |
| 1834 | (unless (tramp--test-smb-or-windows-nt-p) "?foo?bar?baz?") | 1845 | (unless (or (tramp--test-ftp-p) |
| 1835 | (unless (tramp--test-smb-or-windows-nt-p) "*foo*bar*baz*") | 1846 | (tramp--test-gvfs-p) |
| 1836 | (if (tramp--test-smb-or-windows-nt-p) "'foo'bar'baz'" "'foo\"bar'baz\"") | 1847 | (tramp--test-smb-or-windows-nt-p)) |
| 1848 | "?foo?bar?baz?") | ||
| 1849 | (unless (or (tramp--test-ftp-p) | ||
| 1850 | (tramp--test-gvfs-p) | ||
| 1851 | (tramp--test-smb-or-windows-nt-p)) | ||
| 1852 | "*foo*bar*baz*") | ||
| 1853 | (if (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p)) | ||
| 1854 | "'foo'bar'baz'" | ||
| 1855 | "'foo\"bar'baz\"") | ||
| 1837 | "#foo~bar#baz~" | 1856 | "#foo~bar#baz~" |
| 1838 | (if (tramp--test-smb-or-windows-nt-p) "!foo!bar!baz!" "!foo|bar!baz|") | 1857 | (if (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p)) |
| 1839 | (if (tramp--test-smb-or-windows-nt-p) ";foo;bar;baz;" ":foo;bar:baz;") | 1858 | "!foo!bar!baz!" |
| 1840 | (unless (tramp--test-smb-or-windows-nt-p) "<foo>bar<baz>") | 1859 | "!foo|bar!baz|") |
| 1860 | (if (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p)) | ||
| 1861 | ";foo;bar;baz;" | ||
| 1862 | ":foo;bar:baz;") | ||
| 1863 | (unless (or (tramp--test-gvfs-p) (tramp--test-smb-or-windows-nt-p)) | ||
| 1864 | "<foo>bar<baz>") | ||
| 1841 | "(foo)bar(baz)" | 1865 | "(foo)bar(baz)" |
| 1842 | "[foo]bar[baz]" | 1866 | (unless (or (tramp--test-ftp-p) (tramp--test-gvfs-p)) "[foo]bar[baz]") |
| 1843 | "{foo}bar{baz}")) | 1867 | "{foo}bar{baz}")) |
| 1844 | 1868 | ||
| 1845 | ;; These tests are inspired by Bug#17238. | 1869 | ;; These tests are inspired by Bug#17238. |
| @@ -1910,7 +1934,7 @@ Use the `ls' command." | |||
| 1910 | (tramp-set-connection-property v "perl" 'undef)))) | 1934 | (tramp-set-connection-property v "perl" 'undef)))) |
| 1911 | 1935 | ||
| 1912 | (defun tramp--test-utf8 () | 1936 | (defun tramp--test-utf8 () |
| 1913 | "Perform the test in `tramp-test31-utf8*'." | 1937 | "Perform the test in `tramp-test32-utf8*'." |
| 1914 | (let ((coding-system-for-read 'utf-8) | 1938 | (let ((coding-system-for-read 'utf-8) |
| 1915 | (coding-system-for-write 'utf-8) | 1939 | (coding-system-for-write 'utf-8) |
| 1916 | (file-name-coding-system 'utf-8)) | 1940 | (file-name-coding-system 'utf-8)) |
| @@ -2147,11 +2171,11 @@ Since it unloads Tramp, it shall be the last test to run." | |||
| 2147 | ;; doesn't work well when an interactive password must be provided. | 2171 | ;; doesn't work well when an interactive password must be provided. |
| 2148 | ;; * Fix `tramp-test27-start-file-process' for `nc' and on MS | 2172 | ;; * Fix `tramp-test27-start-file-process' for `nc' and on MS |
| 2149 | ;; Windows (`process-send-eof'?). | 2173 | ;; Windows (`process-send-eof'?). |
| 2150 | ;; * Fix `tramp-test30-special-characters' for `nc'. | 2174 | ;; * Fix `tramp-test31-special-characters' for `nc'. |
| 2151 | ;; * Fix `tramp-test31-utf8' for `nc'/`telnet' (when target is a dumb | 2175 | ;; * Fix `tramp-test32-utf8' for `nc'/`telnet' (when target is a dumb |
| 2152 | ;; busybox). Seems to be in `directory-files'. | 2176 | ;; busybox). Seems to be in `directory-files'. |
| 2153 | ;; * Fix Bug#16928. Set expected error of `tramp-test32-asynchronous-requests'. | 2177 | ;; * Fix Bug#16928. Set expected error of `tramp-test33-asynchronous-requests'. |
| 2154 | ;; * Fix `tramp-test34-unload' (Not all symbols are unbound). Set | 2178 | ;; * Fix `tramp-test35-unload' (Not all symbols are unbound). Set |
| 2155 | ;; expected error. | 2179 | ;; expected error. |
| 2156 | 2180 | ||
| 2157 | (defun tramp-test-all (&optional interactive) | 2181 | (defun tramp-test-all (&optional interactive) |