branch: externals/tramp
commit 03ee1a30d526613dbfd970ddbc2ca6c657e8d865
Author: Michael Albinus <michael.albi...@gmx.de>
Commit: Michael Albinus <michael.albi...@gmx.de>

    Tramp ELPA version 2.7.2.2 released
---
 README              |  6 ++---
 test/tramp-tests.el |  3 ++-
 texi/tramp.texi     | 75 +++++++++++++++++++++++++++++++++++----------------
 texi/trampver.texi  |  2 +-
 tramp-cache.el      | 15 ++++++++---
 tramp-sh.el         | 78 ++++++++++++++++++++++++++++++++++-------------------
 tramp.el            |  4 +--
 trampver.el         |  6 ++---
 8 files changed, 125 insertions(+), 64 deletions(-)

diff --git a/README b/README
index 01f5412e84..8ce4391156 100644
--- a/README
+++ b/README
@@ -32,11 +32,11 @@ Emacs 28 or older
 
    • Remove all byte-compiled Tramp files
 
-          $ rm -f ~/.emacs.d/elpa/tramp-2.7.2.1/tramp*.elc
+          $ rm -f ~/.emacs.d/elpa/tramp-2.7.2.2/tramp*.elc
 
    • Start Emacs with Tramp's source files
 
-          $ emacs -L ~/.emacs.d/elpa/tramp-2.7.2.1 -l tramp
+          $ emacs -L ~/.emacs.d/elpa/tramp-2.7.2.2 -l tramp
 
      This should not give you the error.
 
@@ -50,7 +50,7 @@ Mitigation of a bug in Emacs 29.1
 ---------------------------------
 
 Due to a bug in Emacs 29.1, you must apply the following change prior
-installation or upgrading Tramp 2.7.2.1 from GNU ELPA:
+installation or upgrading Tramp 2.7.2.2 from GNU ELPA:
 
      (when (string-equal emacs-version "29.1")
        (with-current-buffer
diff --git a/test/tramp-tests.el b/test/tramp-tests.el
index 25ac02d619..c1ef88937f 100644
--- a/test/tramp-tests.el
+++ b/test/tramp-tests.el
@@ -189,7 +189,8 @@ A resource file is in the resource directory as per
       tramp-copy-size-limit nil
       tramp-error-show-message-timeout nil
       tramp-persistency-file-name nil
-      tramp-verbose 0)
+      tramp-verbose 0
+      vc-handled-backends nil)
 
 (defvar tramp--test-enabled-checked nil
   "Cached result of `tramp--test-enabled'.
diff --git a/texi/tramp.texi b/texi/tramp.texi
index 7a6a1568ef..4f6b1743ea 100644
--- a/texi/tramp.texi
+++ b/texi/tramp.texi
@@ -1113,7 +1113,8 @@ command to transfer is similar to the @option{scp} method.
 
 @command{rsync} performs much better than @command{scp} when
 transferring files that exist on both hosts.  However, this advantage
-is lost if the file exists only on one side of the connection.
+is lost if the file exists only on one side of the connection, during
+the first file transfer.
 
 This method supports the @samp{-p} argument.
 
@@ -3327,8 +3328,8 @@ Another option is to create better backup file naming 
with user and
 host names prefixed to the file name.  For example, transforming
 @file{/etc/secretfile} to
 @file{~/.emacs.d/backups/!su:root@@localhost:!etc!secretfile}, set the
-@value{tramp} user option @code{tramp-backup-directory-alist} from
-the existing user option @code{backup-directory-alist}.
+@value{tramp} user option @code{tramp-backup-directory-alist} from the
+existing user option @code{backup-directory-alist}.
 
 Then @value{tramp} backs up to a file name that is transformed with a
 prefix consisting of the DIRECTORY name.  This file name prefixing
@@ -3350,10 +3351,12 @@ Example:
 The backup file name of
 @file{@trampfn{su,root@@localhost,/etc/secretfile}} would be
 @ifset unified
-@file{@trampfn{su,root@@localhost,~/.emacs.d/backups/!su:root@@localhost:!etc!secretfile~}}.
+@file{@trampfn{su,root@@localhost,~/.emacs.d/backups/@c
+!su:root@@localhost:!etc!secretfile~}}.
 @end ifset
 @ifset separate
-@file{@trampfn{su,root@@localhost,~/.emacs.d/backups/![su!root@@localhost]!etc!secretfile~}}.
+@file{@trampfn{su,root@@localhost,~/.emacs.d/backups/@c
+![su!root@@localhost]!etc!secretfile~}}.
 @end ifset
 
 @vindex auto-save-file-name-transforms
@@ -3798,15 +3801,21 @@ 
ssh@value{postfixhop}you@@remotehost@value{postfix}/path @key{RET}}
 
 Each involved method must be an inline method (@pxref{Inline methods}).
 
-@value{tramp} adds the ad-hoc definitions on the fly to
-@code{tramp-default-proxies-alist} and is available for reuse during
-that Emacs session.  Subsequent @value{tramp} connections to the same
-remote host can then use the shortcut form:
-@samp{@trampfn{ssh,you@@remotehost,/path}}.
+@value{tramp} adds the ad-hoc definitions as an ephemeral record to
+@code{tramp-default-proxies-alist}, which are available for reuse
+during that Emacs session.  Subsequent @value{tramp} connections to
+the same remote host can then use the abbreviated form
+@file{@trampfn{ssh,you@@remotehost,/path}}.
 
+@anchor{tramp-show-ad-hoc-proxies}
 @defopt tramp-show-ad-hoc-proxies
 If this user option is non-@code{nil}, ad-hoc definitions are kept in
-remote file names instead of showing the shortcuts.
+remote file names instead of showing the abbreviations.  This is
+useful if the ad-hoc proxy definition shall be used in further Emacs
+sessions, kept in configuration files of recentf and other packages.
+
+A non-@code{nil} setting of this option has effect only if set before
+the connection is established.
 
 @lisp
 (customize-set-variable 'tramp-show-ad-hoc-proxies t)
@@ -3817,10 +3826,18 @@ Ad-hoc definitions are removed from 
@code{tramp-default-proxies-alist}
 via the command @kbd{M-x tramp-cleanup-all-connections @key{RET}}
 (@pxref{Cleanup remote connections}).
 
+@anchor{tramp-save-ad-hoc-proxies}
 @defopt tramp-save-ad-hoc-proxies
 For ad-hoc definitions to be saved automatically in
 @code{tramp-default-proxies-alist} for future Emacs sessions, set
-@code{tramp-save-ad-hoc-proxies} to non-@code{nil}.
+@code{tramp-save-ad-hoc-proxies} to non-@code{nil}.  The resulting
+user option @code{tramp-default-proxies-alist} is saved in your
+@file{.emacs} file.
+
+If you use saved configuration files with abbreviated ad-hoc proxy
+definitions on another host, for example by distribution of the
+@code{recentf-save-file}, you must distribute your @file{.emacs} file
+as well.
 
 @lisp
 (customize-set-variable 'tramp-save-ad-hoc-proxies t)
@@ -5950,18 +5967,30 @@ Thanks to @value{tramp} users for contributing to these 
recipes.
 
 
 @item
-Why saved multi-hop file names do not work in a new Emacs session?
+Why don't saved ad-hoc multi-hop file names work in a new Emacs session?
+
+By default, ad-hoc multi-hop file names are abbreviated after
+completing the initial connection.  These abbreviated forms retain
+only the final hop, and so only the Emacs session that generated the
+abbreviated form can understand it.  @xref{Ad-hoc multi-hops}.
+
+For example, after connecting to @file{@trampfn{ssh,bird@@bastion|@c
+ssh@value{postfixhop}news@@news.my.domain,/opt/news/etc}}, the file
+name becomes @file{@trampfn{ssh,news@@news.my.domain,/opt/news/etc}}.
+If the abbreviated form is saved in a bookmark, the recent files list,
+bbdb, or similar, a new Emacs session has no way to know that the
+connection must go through @samp{bird@@bastion} first.
 
-When saving ad-hoc multi-hop @value{tramp} file names (@pxref{Ad-hoc
-multi-hops}) via bookmarks, recent files, filecache, bbdb, or another
-package, use the full ad-hoc file name including all hops, like
-@file{@trampfn{ssh,bird@@bastion|ssh@value{postfixhop}@c
-news.my.domain,/opt/news/etc}}.
+There are two mechanisms to deal with this.  The first is to customize
+@code{tramp-show-ad-hoc-proxies} to a non-@code{nil} value, which
+disables abbreviation.  Then the fully-qualified ad-hoc multi-hop file
+name is the one that will be both displayed and saved.
+@xref{tramp-show-ad-hoc-proxies}.
 
-Alternatively, when saving abbreviated multi-hop file names
-@file{@trampfn{ssh,news@@news.my.domain,/opt/news/etc}}, the user
-option @code{tramp-save-ad-hoc-proxies} must be set non-@code{nil}
-value.
+Alternatively, you can customize @code{tramp-save-ad-hoc-proxies} to a
+non-@code{nil} value which means to save the information how an
+abbreviated multi-hop file name can be expanded.
+@xref{tramp-save-ad-hoc-proxies}.
 
 
 @item
@@ -6137,7 +6166,7 @@ as above in your @file{~/.emacs}:
 @item
 I get an error @samp{unix_listener: path
 "/very/long/path/.cache/emacs/tramp.XXX" too long for Unix domain
-socket} when connectiong via @option{ssh} to a remote host.
+socket} when connecting via @option{ssh} to a remote host.
 
 @vindex small-temporary-file-directory
 By default, @value{tramp} uses the directory @file{~/.cache/emacs/}
diff --git a/texi/trampver.texi b/texi/trampver.texi
index 9d4579fb02..f3d1241a49 100644
--- a/texi/trampver.texi
+++ b/texi/trampver.texi
@@ -7,7 +7,7 @@
 
 @c In the  Tramp GIT, the version number and the bug report address
 @c are auto-frobbed from configure.ac.
-@set trampver 2.7.2.1
+@set trampver 2.7.2.2
 @set trampurl https://www.gnu.org/software/tramp/
 @set tramp-bug-report-address tramp-devel@@gnu.org
 @set emacsver 27.1
diff --git a/tramp-cache.el b/tramp-cache.el
index ef8baf89f8..14ee10416a 100644
--- a/tramp-cache.el
+++ b/tramp-cache.el
@@ -97,8 +97,11 @@
 Every entry has the form (REGEXP PROPERTY VALUE).  The regexp
 matches remote file names.  It can be nil.  PROPERTY is a string,
 and VALUE the corresponding value.  They are used, if there is no
-matching entry for PROPERTY in `tramp-cache-data'.  For more
-details see the info pages."
+matching entry for PROPERTY in `tramp-cache-data'.
+
+PROPERTY can also be a string representing a parameter in
+`tramp-methods'.  For more details see the Info node `(tramp) Predefined
+connection information'."
   :group 'tramp
   :version "24.4"
   :type '(repeat (list (choice :tag "File Name regexp" regexp (const nil))
@@ -470,8 +473,10 @@ used to cache connection properties of the local machine."
          (hash (tramp-get-hash-table key))
          (cached (and (hash-table-p hash)
                       (gethash ,property hash tramp-cache-undefined))))
+     (tramp-message key 7 "Saved %s %s" property cached)
      (unwind-protect (progn ,@body)
        ;; Reset PROPERTY.  Recompute hash, it could have been flushed.
+       (tramp-message key 7 "Restored %s %s" property cached)
        (setq hash (tramp-get-hash-table key))
        (if (not (eq cached tramp-cache-undefined))
           (puthash ,property cached hash)
@@ -488,9 +493,13 @@ PROPERTIES is a list of file properties (strings)."
           (mapcar
            (lambda (property)
              (cons property (gethash property hash tramp-cache-undefined)))
-           ,properties)))
+           ,properties))
+         ;; Avoid superfluous debug buffers during host name completion.
+         (tramp-verbose (if minibuffer-completing-file-name 0 tramp-verbose)))
+     (tramp-message key 7 "Saved %s" values)
      (unwind-protect (progn ,@body)
        ;; Reset PROPERTIES.  Recompute hash, it could have been flushed.
+       (tramp-message key 7 "Restored %s" values)
        (setq hash (tramp-get-hash-table key))
        (dolist (value values)
         (if (not (eq (cdr value) tramp-cache-undefined))
diff --git a/tramp-sh.el b/tramp-sh.el
index 7533de33c0..98a4c7d90f 100644
--- a/tramp-sh.el
+++ b/tramp-sh.el
@@ -354,7 +354,7 @@ The string is used in `tramp-methods'.")
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))
                 (tramp-copy-program         "pscp")
-                (tramp-copy-args            (("-l" "%u") ("-P" "%p") ("-scp")
+                (tramp-copy-args            (("-l" "%u") ("-P" "%p") ("-scp") 
("%c")
                                             ("-p" "%k") ("-q") ("-r")))
                 (tramp-copy-keep-date       t)
                 (tramp-copy-recursive       t)))
@@ -372,7 +372,7 @@ The string is used in `tramp-methods'.")
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))
                 (tramp-copy-program         "pscp")
-                (tramp-copy-args            (("-l" "%u") ("-P" "%p") ("-sftp")
+                (tramp-copy-args            (("-l" "%u") ("-P" "%p") ("-sftp") 
("%c")
                                             ("-p" "%k")))
                 (tramp-copy-keep-date       t)))
 
@@ -2482,7 +2482,7 @@ The method used must be an out-of-band method."
       ;; Compose copy command.
       (setq options
            (format-spec
-            (tramp-ssh-controlmaster-options v)
+            (tramp-ssh-or-plink-options v)
             (format-spec-make
              ?t (tramp-get-connection-property
                  (tramp-get-connection-process v) "temp-file" "")))
@@ -4901,41 +4901,60 @@ Goes through the list `tramp-inline-compress-commands'."
     (zerop
      (tramp-call-process vec "ssh" nil nil nil "-G" "-o" option "0.0.0.1"))))
 
-(defun tramp-ssh-controlmaster-options (vec)
-  "Return the Control* arguments of the local ssh."
+(defun tramp-plink-option-exists-p (vec option)
+  "Check, whether local plink OPTION is applicable."
+  ;; We don't want to cache it persistently.
+  (with-tramp-connection-property nil option
+    ;; "plink" with valid options returns "plink: no valid host name
+    ;; provided".  We xcheck for this error message."
+    (with-temp-buffer
+      (tramp-call-process vec "plink" nil t nil option)
+      (not
+       (string-match-p
+       (rx (| (: "plink: unknown option \"" (literal option) "\"" )
+              (: "plink: option \"" (literal option)
+                 "\" not available in this tool" )))
+       (buffer-string))))))
+
+(defun tramp-ssh-or-plink-options (vec)
+  "Return additional arguments of the local ssh or plink."
   (cond
    ;; No options to be computed.
-   ((or (null tramp-use-connection-share)
-       (null (assoc "%c" (tramp-get-method-parameter vec 'tramp-login-args))))
-    "")
+   ((null (assoc "%c" (tramp-get-method-parameter vec 'tramp-login-args))) "")
 
-   ;; Use plink option.
+   ;; Use plink options.
    ((string-match-p
      (rx "plink" (? ".exe") eol)
      (tramp-get-method-parameter vec 'tramp-login-program))
-    (if (eq tramp-use-connection-share 'suppress)
-       "-noshare" "-share"))
+    (concat
+     (if (eq tramp-use-connection-share 'suppress)
+        "-noshare" "-share")
+     ;; Since PuTTY 0.82.
+     (when (tramp-plink-option-exists-p vec "-legacy-stdio-prompts")
+       " -legacy-stdio-prompts")))
 
    ;; There is already a value to be used.
    ((and (eq tramp-use-connection-share t)
          (stringp tramp-ssh-controlmaster-options))
     tramp-ssh-controlmaster-options)
 
-   ;; We can't auto-compute the options.
-   ((ignore-errors
-      (not (tramp-ssh-option-exists-p vec "ControlMaster=auto")))
-    "")
-
-   ;; Determine the options.
-   (t (ignore-errors
-        ;; ControlMaster and ControlPath options are introduced in OpenSSH 3.9.
-        (concat
-         "-o ControlMaster="
-         (if (eq tramp-use-connection-share 'suppress)
+   ;; Use ssh options.
+   (tramp-use-connection-share
+    ;; We can't auto-compute the options.
+    (if (ignore-errors
+         (not (tramp-ssh-option-exists-p vec "ControlMaster=auto")))
+       ""
+
+      ;; Determine the options.
+      (ignore-errors
+       ;; ControlMaster and ControlPath options are introduced in OpenSSH 3.9.
+       (concat
+        "-o ControlMaster="
+        (if (eq tramp-use-connection-share 'suppress)
              "no" "auto")
 
-         " -o ControlPath="
-         (if (eq tramp-use-connection-share 'suppress)
+        " -o ControlPath="
+        (if (eq tramp-use-connection-share 'suppress)
              "none"
            ;; Hashed tokens are introduced in OpenSSH 6.7.  On macOS
            ;; we cannot use an absolute file name, it is too long.
@@ -4949,10 +4968,13 @@ Goes through the list `tramp-inline-compress-commands'."
              (or small-temporary-file-directory
                  tramp-compat-temporary-file-directory))))
 
-         ;; ControlPersist option is introduced in OpenSSH 5.6.
+        ;; ControlPersist option is introduced in OpenSSH 5.6.
         (when (and (not (eq tramp-use-connection-share 'suppress))
                     (tramp-ssh-option-exists-p vec "ControlPersist=no"))
-          " -o ControlPersist=no"))))))
+          " -o ControlPersist=no")))))
+
+   ;; Return a string, whatsoever.
+   (t "")))
 
 (defun tramp-scp-strict-file-name-checking (vec)
   "Return the strict file name checking argument of the local scp."
@@ -5168,9 +5190,9 @@ connection if a previous connection has died for some 
reason."
              (let* ((current-host tramp-system-name)
                     (target-alist (tramp-compute-multi-hops vec))
                     (previous-hop tramp-null-hop)
-                    ;; We will apply `tramp-ssh-controlmaster-options'
+                    ;; We will apply `tramp-ssh-or-plink-options'
                     ;; only for the first hop.
-                    (options (tramp-ssh-controlmaster-options vec))
+                    (options (tramp-ssh-or-plink-options vec))
                     (process-connection-type tramp-process-connection-type)
                     (process-adaptive-read-buffering nil)
                     ;; There are unfortunate settings for "cmdproxy"
diff --git a/tramp.el b/tramp.el
index 4db1b787a6..0e2ad5c124 100644
--- a/tramp.el
+++ b/tramp.el
@@ -120,9 +120,9 @@
   :version "22.1"
   :link '(custom-manual "(tramp)Top"))
 
-;; Maybe we need once a real Tramp mode, with key bindings etc.
+;; On MS-DOS, there is no process support.
 ;;;###autoload
-(defcustom tramp-mode t
+(defcustom tramp-mode (not (eq system-type 'ms-dos))
   "Whether Tramp is enabled.
 If it is set to nil, all remote file names are used literally."
   :type 'boolean)
diff --git a/trampver.el b/trampver.el
index 9b543c20ad..af22093e04 100644
--- a/trampver.el
+++ b/trampver.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Michael Albinus <michael.albi...@gmx.de>
 ;; Keywords: comm, processes
 ;; Package: tramp
-;; Version: 2.7.2.1
+;; Version: 2.7.2.2
 ;; Package-Requires: ((emacs "27.1"))
 ;; Package-Type: multi
 ;; URL: https://www.gnu.org/software/tramp/
@@ -40,7 +40,7 @@
 ;; ./configure" to change them.
 
 ;;;###tramp-autoload
-(defconst tramp-version "2.7.2.1"
+(defconst tramp-version "2.7.2.2"
   "This version of Tramp.")
 
 ;;;###tramp-autoload
@@ -76,7 +76,7 @@
 ;; Check for Emacs version.
 (let ((x   (if (not (string-version-lessp emacs-version "27.1"))
       "ok"
-    (format "Tramp 2.7.2.1 is not fit for %s"
+    (format "Tramp 2.7.2.2 is not fit for %s"
             (replace-regexp-in-string "\n" "" (emacs-version))))))
   (unless (string-equal "ok" x) (error "%s" x)))
 

Reply via email to