branch: externals/tramp
commit ffb5b3473a4054e8d5499370cae50032227e8644
Author: Michael Albinus <[email protected]>
Commit: Michael Albinus <[email protected]>

    Tramp ELPA version 2.8.0.5 released
---
 README              |   6 +-
 test/tramp-tests.el |  24 ++---
 texi/tramp.texi     |  14 ++-
 texi/trampver.texi  |   2 +-
 tramp-cache.el      |   4 +-
 tramp-container.el  |  16 +++-
 tramp-message.el    |  20 ++--
 tramp-sh.el         | 267 ++++++++++++++++++++++++++++------------------------
 tramp.el            |  34 +++++--
 trampver.el         |   6 +-
 10 files changed, 228 insertions(+), 165 deletions(-)

diff --git a/README b/README
index ee0e398298..d791d2ec7e 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.8.0.4/tramp*.elc
+          $ rm -f ~/.emacs.d/elpa/tramp-2.8.0.5/tramp*.elc
 
    • Start Emacs with Tramp's source files
 
-          $ emacs -L ~/.emacs.d/elpa/tramp-2.8.0.4 -l tramp
+          $ emacs -L ~/.emacs.d/elpa/tramp-2.8.0.5 -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.8.0.4 from GNU ELPA:
+installation or upgrading Tramp 2.8.0.5 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 7099a614a4..76e9a47e41 100644
--- a/test/tramp-tests.el
+++ b/test/tramp-tests.el
@@ -2675,7 +2675,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
 
   (dolist (quoted (if (tramp--test-expensive-test-p) '(nil t) '(nil)))
     (let ((tmp-name (tramp--test-make-temp-name nil quoted))
-          (inhibit-message t))
+          (inhibit-message (not (ignore-errors (edebug-mode)))))
       (unwind-protect
          (progn
             ;; Write buffer.  Use absolute and relative file name.
@@ -2801,7 +2801,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   (skip-unless (tramp--test-sh-p))
 
   (let* ((tmp-name (tramp--test-make-temp-name))
-         (inhibit-message t)
+         (inhibit-message (not (ignore-errors (edebug-mode))))
          written-files
          (advice (lambda (_start _end filename &rest _r)
                    (push filename written-files))))
@@ -2838,7 +2838,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
         (archive (ert-resource-file "foo.tar.gz"))
         (tmp-file (expand-file-name (file-name-nondirectory archive)))
         (require-final-newline t)
-        (inhibit-message t)
+        (inhibit-message (not (ignore-errors (edebug-mode))))
          (backup-inhibited t)
         create-lockfiles buffer1 buffer2)
     (unwind-protect
@@ -5296,7 +5296,9 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (unless (tramp--test-ange-ftp-p)
              (load tmp-name 'noerror 'nomessage))
            (should-not (featurep 'tramp-test-load))
-           (write-region "(provide 'tramp-test-load)" nil tmp-name)
+           (write-region
+            ";;; -*- lexical-binding: t; -*-\n(provide 'tramp-test-load)"
+            nil tmp-name)
            ;; `load' in lread.c passes `must-suffix' since Emacs 29.
            ;; In Ange-FTP, `must-suffix' is ignored.
            (when (and (tramp--test-emacs29-p)
@@ -6119,7 +6121,7 @@ INPUT, if non-nil, is a string sent to the process."
     (let ((tmp-name (tramp--test-make-temp-name nil quoted))
          (default-directory ert-remote-temporary-file-directory)
          ;; Suppress nasty messages.
-         (inhibit-message t)
+         (inhibit-message (not (ignore-errors (edebug-mode))))
          kill-buffer-query-functions)
 
       (dolist (this-shell-command
@@ -6237,7 +6239,7 @@ INPUT, if non-nil, is a string sent to the process."
   ;; -----------------------------------------------
 
   (let (;; Suppress nasty messages.
-       (inhibit-message t)
+       (inhibit-message (not (ignore-errors (edebug-mode))))
        buffer kill-buffer-query-functions)
     ;; We check both the local and remote case, in order to guarantee
     ;; that they behave similar.
@@ -6468,7 +6470,7 @@ INPUT, if non-nil, is a string sent to the process."
         (tmp-name2 (expand-file-name "foo" tmp-name1))
         (enable-local-variables :all)
         (enable-remote-dir-locals t)
-         (inhibit-message t)
+         (inhibit-message (not (ignore-errors (edebug-mode))))
         kill-buffer-query-functions
         (clpa connection-local-profile-alist)
         (clca connection-local-criteria-alist))
@@ -6735,7 +6737,7 @@ INPUT, if non-nil, is a string sent to the process."
           (tmp-name2 (expand-file-name "foo" tmp-name1))
           (tramp-remote-process-environment tramp-remote-process-environment)
           ;; Suppress nasty messages.
-           (inhibit-message t)
+           (inhibit-message (not (ignore-errors (edebug-mode))))
           (vc-handled-backends
            (cond
             ((tramp-find-executable
@@ -7069,7 +7071,7 @@ INPUT, if non-nil, is a string sent to the process."
          (remote-file-name-inhibit-locks nil)
          (create-lockfiles t)
          tramp-allow-unsafe-temporary-files
-          (inhibit-message t)
+          (inhibit-message (not (ignore-errors (edebug-mode))))
          ;; tramp-rclone.el and tramp-sshfs.el cache the mounted files.
          (tramp-fuse-unmount-on-cleanup t)
           auto-save-default
@@ -7229,7 +7231,7 @@ INPUT, if non-nil, is a string sent to the process."
            (remote-file-name-inhibit-cache t)
            (remote-file-name-inhibit-locks nil)
            tramp-allow-unsafe-temporary-files
-            (inhibit-message t)
+            (inhibit-message (not (ignore-errors (edebug-mode))))
            ;; tramp-rclone.el and tramp-sshfs.el cache the mounted files.
            (tramp-fuse-unmount-on-cleanup t)
             auto-save-default
@@ -8005,7 +8007,7 @@ process sentinels.  They shall not disturb each other."
            (remote-file-name-inhibit-cache t)
            (process-file-side-effects t)
            ;; Suppress nasty messages.
-           (inhibit-message t)
+           (inhibit-message (not (ignore-errors (edebug-mode))))
           ;; Do not run delayed timers.
           (timer-max-repeats 0)
           ;; Number of asynchronous processes for test.  Tests on
diff --git a/texi/tramp.texi b/texi/tramp.texi
index e46f7b9155..4334e89e65 100644
--- a/texi/tramp.texi
+++ b/texi/tramp.texi
@@ -4737,7 +4737,9 @@ It works only for some connection methods defined in
 It does not support interactive user authentication.  With
 @option{ssh}-based methods, this can be avoided by using a password
 agent like @command{ssh-agent}, using public key authentication, or
-using @option{ControlMaster} options.
+using @option{ControlMaster} options.@*
+Other interactive authentication requests, like one-time passwords or
+security key confirmation messages, do not work either.
 
 @item
 It cannot be applied for @option{ssh}-based methods, which use the
@@ -5366,7 +5368,7 @@ The package works successfully on @w{Emacs 28}, @w{Emacs 
29}, @w{Emacs
 
 While Unix and Unix-like systems are the primary remote targets,
 @value{tramp} has equal success connecting to other platforms, such as
-MS Windows 7/8/10.
+MS Windows 10/11.
 
 
 @item
@@ -5381,7 +5383,8 @@ responsiveness slows down.  Some suggestions within the 
scope of
 @itemize @minus
 @item
 Use an external method, such as @option{scp}, which are faster than
-internal methods for large files.
+internal methods for large files.  Set
+@code{tramp-use-scp-direct-remote-copying} to non-@code{nil}.
 
 @item
 Keep the file @code{tramp-persistency-file-name}, which is where
@@ -6847,6 +6850,11 @@ they are kept.  Example:
 @end lisp
 @end defun
 
+@findex tramp-expand-script
+Shell scripts intended for the @code{tramp-sh} backend are used as a
+format string.  They must observe the restrictions for format
+specifiers, as documented in @code{tramp-expand-script}.
+
 
 @node Traces and Profiles
 @chapter How to Customize Traces
diff --git a/texi/trampver.texi b/texi/trampver.texi
index 2fbc047817..da53b5c62d 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.8.0.4
+@set trampver 2.8.0.5
 @set trampurl https://www.gnu.org/software/tramp/
 @set tramp-bug-report-address tramp-devel@@gnu.org
 @set emacsver 28.1
diff --git a/tramp-cache.el b/tramp-cache.el
index 941c502fa8..36fc8c3953 100644
--- a/tramp-cache.el
+++ b/tramp-cache.el
@@ -512,7 +512,9 @@ PROPERTIES is a list of file properties (strings)."
              (cons property (gethash property hash tramp-cache-undefined)))
            ,properties))
          ;; Avoid superfluous debug buffers during host name completion.
-         (tramp-verbose (if minibuffer-completing-file-name 0 tramp-verbose)))
+         (tramp-verbose
+          (if minibuffer-completing-file-name
+              (min 6 tramp-verbose) tramp-verbose)))
      (tramp-message key 7 "Saved %s" values)
      (unwind-protect (progn ,@body)
        ;; Reset PROPERTIES.  Recompute hash, it could have been flushed.
diff --git a/tramp-container.el b/tramp-container.el
index 6e82bc67be..897a4dcc72 100644
--- a/tramp-container.el
+++ b/tramp-container.el
@@ -427,8 +427,7 @@ Obey `tramp-kubernetes-context'"
 ;;;###tramp-autoload
 (defun tramp-kubernetes--context-namespace (vec)
   "The kubectl options for context and namespace as string."
-  (mapconcat
-   #'identity
+  (string-join
    (delq nil
         `(,(when-let* ((context (tramp-kubernetes--current-context vec)))
              (format "--context=%s" context))
@@ -701,8 +700,8 @@ see its function help for a description of the format."
                 (tramp-login-program ,tramp-distrobox-program)
                 (tramp-login-args (("enter")
                                    ("-n" "%h")
-                                   ("--" "%l")))
-                ;(tramp-direct-async (,tramp-default-remote-shell "-c"))
+                                   ("--") ("%l")))
+                (tramp-direct-async (,tramp-default-remote-shell "-c"))
                 (tramp-remote-shell ,tramp-default-remote-shell)
                 (tramp-remote-shell-login ("-l"))
                 (tramp-remote-shell-args ("-c"))
@@ -761,7 +760,14 @@ see its function help for a description of the format."
                                    ("--env"
                                     ,(format "TERM=%s" tramp-terminal-type))
                                    ("instance://%h")
-                                   ("%h"))) ; Needed for multi-hop check.
+                                   ;; Needed for multi-hop check,
+                                   ;; ignored by the "shell" command.
+                                   ("%h")))
+                ;; `tramp-direct-async' must be used *instead* of 
`tramp-login-args'.
+                ;; (tramp-direct-async (("exec")
+                ;;                   ("--env"
+                ;;                    ,(format "TERM=%s" tramp-terminal-type))
+                ;;                   ("instance://%h"))
                 (tramp-remote-shell ,tramp-default-remote-shell)
                 (tramp-remote-shell-login ("-l"))
                 (tramp-remote-shell-args ("-c"))
diff --git a/tramp-message.el b/tramp-message.el
index d349179d0e..eecddc978c 100644
--- a/tramp-message.el
+++ b/tramp-message.el
@@ -172,6 +172,7 @@ They are completed by `M-x TAB' only in Tramp debug 
buffers."
   (use-local-map special-mode-map)
   (set-buffer-modified-p nil)
   ;; For debugging purposes.
+  ;(add-hook 'kill-buffer-hook #'debug nil 'local)
   (local-set-key "\M-n" 'clone-buffer)
   (add-hook 'clone-buffer-hook #'tramp-setup-debug-buffer nil 'local))
 
@@ -193,11 +194,13 @@ They are completed by `M-x TAB' only in Tramp debug 
buffers."
       (tramp-setup-debug-buffer))
     (current-buffer)))
 
+;; On some systems, file names starting with "*" do not work.
 (defun tramp-get-debug-file-name (vec)
   "Get the debug file name for VEC."
   (declare (tramp-suppress-trace t))
   (expand-file-name
-   (string-replace "/" " " (tramp-debug-buffer-name vec))
+   (string-replace
+    "/" " " (substring (tramp-debug-buffer-name vec) 1 -1))
    tramp-compat-temporary-file-directory))
 
 (defun tramp-trace-buffer-name (vec)
@@ -226,13 +229,12 @@ ARGUMENTS to actually emit the message (if applicable)."
            ";; Emacs: %s Tramp: %s -*- mode: outline; coding: utf-8; -*-"
            emacs-version tramp-version))
          (when (>= tramp-verbose 10)
-           (let ((tramp-verbose 0))
-             (insert
-              (format
-               "\n;; Location: %s Git: %s/%s"
-               (locate-library "tramp")
-               (or tramp-repository-branch "")
-               (or tramp-repository-version "")))))
+           (insert
+            (format
+             "\n;; Location: %s Git: %s/%s"
+             (locate-library "tramp")
+             (or tramp-repository-branch "")
+             (or tramp-repository-version ""))))
          ;; Traces.
          (when (>= tramp-verbose 11)
            (dolist
@@ -248,7 +250,7 @@ ARGUMENTS to actually emit the message (if applicable)."
            (ignore-errors (delete-file (tramp-get-debug-file-name vec)))
            (let ((message-log-max t))
              (message
-              "Tramp debug file is %s" (tramp-get-debug-file-name vec)))))
+              "Tramp debug file is \"%s\"" (tramp-get-debug-file-name vec)))))
        (unless (bolp)
          (insert "\n"))
        ;; Timestamp.
diff --git a/tramp-sh.el b/tramp-sh.el
index 61f64e4c02..5ed3e91da2 100644
--- a/tramp-sh.el
+++ b/tramp-sh.el
@@ -303,6 +303,7 @@ The string is used in `tramp-methods'.")
               `("sg"
                 (tramp-login-program        "sg")
                 (tramp-login-args           (("-") ("%u")))
+               (tramp-direct-async         ("-c"))
                 (tramp-remote-shell         ,tramp-default-remote-shell)
                 (tramp-remote-shell-args    ("-c"))
                 (tramp-connection-timeout   10)))
@@ -648,7 +649,9 @@ shell from reading its init file."
 
 ;;;###tramp-autoload
 (defconst tramp-actions-before-shell
-  '((tramp-login-prompt-regexp tramp-action-login)
+  '((tramp-keyboard-interactive-authentication-prompt-regexp
+     tramp-action-ignore-message)
+    (tramp-login-prompt-regexp tramp-action-login)
     (tramp-password-prompt-regexp tramp-action-password)
     (tramp-otp-password-prompt-regexp tramp-action-otp-password)
     (tramp-fingerprint-prompt-regexp tramp-action-fingerprint)
@@ -675,7 +678,9 @@ The ACTION should also be a symbol, but a function.  When 
the
 corresponding PATTERN matches, the ACTION function is called.")
 
 (defconst tramp-actions-copy-out-of-band
-  '((tramp-password-prompt-regexp tramp-action-password)
+  '((tramp-keyboard-interactive-authentication-prompt-regexp
+     tramp-action-ignore-message)
+    (tramp-password-prompt-regexp tramp-action-password)
     (tramp-otp-password-prompt-regexp tramp-action-otp-password)
     (tramp-wrong-passwd-regexp tramp-action-permission-denied)
     (tramp-copy-failed-regexp tramp-action-permission-denied)
@@ -687,8 +692,8 @@ This list is used for copying/renaming with out-of-band 
methods.
 
 See `tramp-actions-before-shell' for more info.")
 
-(defconst tramp-uudecode
-  "(echo begin 600 %t; tail -n +2) | uudecode
+(defconst tramp-uudecode "\
+(echo begin 600 %t; tail -n +2) | uudecode
 cat %t
 rm -f %t"
   "Shell function to implement `uudecode' to standard output.
@@ -698,16 +703,16 @@ we have this shell function.
 Format specifiers are replaced by `tramp-expand-script', percent
 characters need to be doubled.")
 
-(defconst tramp-readlink-file-truename
-  "if %m -h \"$1\"; then echo t; else echo nil; fi
+(defconst tramp-readlink-file-truename "\
+if %m -h \"$1\"; then echo t; else echo nil; fi
 %r \"$1\""
   "Shell script to produce output suitable for use with `file-truename'
 on the remote file system.
 Format specifiers are replaced by `tramp-expand-script', percent
 characters need to be doubled.")
 
-(defconst tramp-perl-file-truename
-  "%p -e '
+(defconst tramp-perl-file-truename "\
+%p -e '
 use File::Spec;
 use Cwd \"realpath\";
 
@@ -755,8 +760,8 @@ on the remote file system.
 Format specifiers are replaced by `tramp-expand-script', percent
 characters need to be doubled.")
 
-(defconst tramp-perl-file-name-all-completions
-  "%p -e '
+(defconst tramp-perl-file-name-all-completions "\
+%p -e '
 $dir = $ARGV[0];
 if ($dir ne \"/\") {
   $dir =~ s#/+$##;
@@ -778,20 +783,28 @@ print \")\\n\";
 ' \"$1\" %n"
   "Perl script to produce output suitable for use with
 `file-name-all-completions' on the remote file system.  It returns the
-same format as `tramp-bundle-read-file-names'.  Format specifiers are
-replaced by `tramp-expand-script', percent characters need to be
-doubled.")
-
-(defconst tramp-shell-file-name-all-completions
-  "cd \"$1\" 2>&1; %l -a %n | while IFS= read file; do
-    quoted=`echo \"$1/$file\" | sed -e \"s#//#/#g\"`
-    printf \"%%s\\n\" \"$quoted\"
-  done | tramp_bundle_read_file_names"
+same format as `tramp-bundle-read-file-names'.
+Format specifiers are replaced by `tramp-expand-script', percent
+characters need to be doubled.")
+
+(defconst tramp-shell-print-quoted-string "\
+quoted=`echo \"$1\" | sed -e \"s/\\\"/\\\\\\\\\\\\\\\\\\\"/g\"`
+printf \"\\\"%%s\\\"\" \"$quoted\""
+  "Shell script to print a lispy string.
+Format specifiers are replaced by `tramp-expand-script', percent
+characters need to be doubled.")
+
+(defconst tramp-shell-file-name-all-completions "\
+cd \"$1\" 2>&1; %l -a %n | while IFS= read file; do
+  quoted=`echo \"$1/$file\" | sed -e \"s#//#/#g\"`
+  printf \"%%s\\n\" \"$quoted\"
+done | %b"
    "Shell script to produce output suitable for use with
 `file-name-all-completions' on the remote file system.  It returns the
-same format as `tramp-bundle-read-file-names'.  Format specifiers are
-replaced by `tramp-expand-script', percent characters need to be
-doubled.")
+same format as `tramp-bundle-read-file-names', which must be declared on
+the remote host as well.
+Format specifiers are replaced by `tramp-expand-script', percent
+characters need to be doubled.")
 
 ;; Perl script to implement `file-attributes' in a Lisp `read'able
 ;; output.  If you are hacking on this, note that you get *no* output
@@ -799,8 +812,8 @@ doubled.")
 ;; end.
 ;; The device number is returned as "-1", because there will be a virtual
 ;; device number set in `tramp-sh-handle-file-attributes'.
-(defconst tramp-perl-file-attributes
-  "%p -e '
+(defconst tramp-perl-file-attributes "\
+%p -e '
 @stat = lstat($ARGV[0]);
 if (!@stat) {
     print \"nil\\n\";
@@ -882,12 +895,11 @@ characters need to be doubled.")
 (defconst tramp-ls-file-attributes
   "%s -ild %s \"$1\" || return\n%s -lnd%s %s \"$1\""
   "Shell function to produce output suitable for use with `file-attributes'
-on the remote file system.
-Format specifiers are replaced by `tramp-expand-script', percent
-characters need to be doubled.")
+on the remote file system.  The \"%s\" format specifiers are replaced
+when called in `tramp-do-file-attributes-with-ls'.")
 
-(defconst tramp-perl-directory-files-and-attributes
-  "%p -e '
+(defconst tramp-perl-directory-files-and-attributes "\
+%p -e '
 chdir($ARGV[0]) or printf(\"\\\"Cannot change to $ARGV[0]: $''!''\\\"\\n\"), 
exit();
 opendir(DIR,\".\") or printf(\"\\\"Cannot open directory $ARGV[0]: 
$''!''\\\"\\n\"), exit();
 @list = readdir(DIR);
@@ -991,8 +1003,8 @@ characters need to be doubled.")
 Format specifiers are replaced by `tramp-expand-script', percent
 characters need to be doubled.")
 
-(defconst tramp-perl-id
-  "%p -e '
+(defconst tramp-perl-id "\
+%p -e '
 use strict;
 use warnings;
 use POSIX qw(getgroups);
@@ -1007,8 +1019,8 @@ printf \"uid=%%d(%%s) gid=%%d(%%s) groups=%%s\\n\",
 Format specifiers are replaced by `tramp-expand-script', percent
 characters need to be doubled.")
 
-(defconst tramp-python-id
-  "%y -c '
+(defconst tramp-python-id "\
+%y -c '
 import os, pwd, grp;
 
 def idform(id):
@@ -1043,9 +1055,9 @@ on the remote host.
 Format specifiers are replaced by `tramp-expand-script', percent
 characters need to be doubled.")
 
-(defconst tramp-perl-encode
-  "%p -e '
-# This script contributed by Juanma Barranquero <[email protected]>.
+;; This script contributed by Juanma Barranquero <[email protected]>.
+(defconst tramp-perl-encode "\
+%p -e '
 use strict;
 
 my %%trans = do {
@@ -1081,9 +1093,9 @@ while (read STDIN, $data, 54) {
 Format specifiers are replaced by `tramp-expand-script', percent
 characters need to be doubled.")
 
-(defconst tramp-perl-decode
-  "%p -e '
-# This script contributed by Juanma Barranquero <[email protected]>.
+;; This script contributed by Juanma Barranquero <[email protected]>.
+(defconst tramp-perl-decode "\
+%p -e '
 use strict;
 
 my %%trans = do {
@@ -1141,8 +1153,8 @@ characters need to be doubled.")
 Format specifiers are replaced by `tramp-expand-script', percent
 characters need to be doubled.")
 
-(defconst tramp-awk-encode
-  "%a '\\
+(defconst tramp-awk-encode "\
+%a '\\
 BEGIN {
   b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"
   b16 = \"0123456789abcdef\"
@@ -1192,8 +1204,8 @@ characters need to be doubled.")
 Format specifiers are replaced by `tramp-expand-script', percent
 characters need to be doubled.")
 
-(defconst tramp-awk-decode
-  "%a '\\
+(defconst tramp-awk-decode "\
+%a '\\
 BEGIN {
   b64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\"
 }
@@ -1219,24 +1231,23 @@ BEGIN {
 Format specifiers are replaced by `tramp-expand-script', percent
 characters need to be doubled.")
 
-(defconst tramp-bundle-read-file-names
-  "echo \"(\"
+(defconst tramp-bundle-read-file-names "\
+printf \"(\\n\"
 while IFS= read file; do
-  quoted=`echo \"$file\" | sed -e \"s/\\\"/\\\\\\\\\\\\\\\\\\\"/g\"`
-  printf \"(%%s\" \"\\\"$quoted\\\"\"
+  printf \"(\"; %k \"$file\"
   if %q \"$file\"; then printf \" %%s\" t; else printf \" %%s\" nil; fi
   if %m -r \"$file\"; then printf \" %%s\" t; else printf \" %%s\" nil; fi
   if %m -d \"$file\"; then printf \" %%s\" t; else printf \" %%s\" nil; fi
   if %m -x \"$file\"; then printf \" %%s)\\n\" t; else printf \" %%s)\\n\" 
nil; fi
 done
-echo \")\""
+printf \")\\n\""
   "Shell script to check file attributes of a bundle of files.
 For every file, it returns a list with the absolute file name, and the
 tests for file existence, file readability, file directory, and file
 executable.  Input shall be read via here-document, otherwise the
-command could exceed maximum length of command line.  Format specifiers
-\"%s\" are replaced before the script is used, percent characters need
-to be doubled.")
+command could exceed maximum length of command line.
+Format specifiers are replaced by `tramp-expand-script', percent
+characters need to be doubled.")
 
 ;; New handlers should be added here.
 ;;;###tramp-autoload
@@ -2001,9 +2012,6 @@ ID-FORMAT valid values are `string' and `integer'."
                   (tramp-maybe-send-script
                    v tramp-perl-file-name-all-completions
                    "tramp_perl_file_name_all_completions")
-                ;; Used in `tramp-shell-file-name-all-completions'.
-                (tramp-maybe-send-script
-                 v tramp-bundle-read-file-names "tramp_bundle_read_file_names")
                 (tramp-maybe-send-script
                  v tramp-shell-file-name-all-completions
                  "tramp_shell_file_name_all_completions"))
@@ -4052,81 +4060,94 @@ Fall back to normal file name handler if no Tramp 
handler exists."
 \"%a\", \"%h\", \"%l\", \"%m\", \"%o\", \"%p\", \"%q\", \"%r\", \"%s\"
 and \"%y\" format specifiers are replaced by the respective `awk',
 `hexdump', `ls', `test', od', `perl', `test -e', `readlink', `stat' and
-`python' commands.  \"%n\" is replaced by \"2>/dev/null\", and \"%t\" is
-replaced by a temporary file name.  If VEC is nil, the respective local
-commands are used.  If there is a format specifier which cannot be
-expanded, this function returns nil."
-  (if (not (string-match-p
-           (rx (| bol (not "%")) "%" (any "ahlmnopqrsty")) script))
-      script
-    (catch 'wont-work
-      (let ((awk (when (string-match-p (rx (| bol (not "%")) "%a") script)
-                  (or
-                   (if vec (tramp-get-remote-awk vec) (executable-find "awk"))
-                   (throw 'wont-work nil))))
-           (hdmp (when (string-match-p (rx (| bol (not "%")) "%h") script)
-                   (or
-                    (if vec (tramp-get-remote-hexdump vec)
-                      (executable-find "hexdump"))
-                    (throw 'wont-work nil))))
-           (dev (when (string-match-p (rx (| bol (not "%")) "%n") script)
-                  (or
-                   (if vec (concat "2>" (tramp-get-remote-null-device vec))
-                     (if (eq system-type 'windows-nt) ""
-                       (concat "2>" null-device)))
-                   (throw 'wont-work nil))))
-           (ls (when (string-match-p (rx (| bol (not "%")) "%l") script)
-                 (format "%s %s"
-                         (or (tramp-get-ls-command vec)
-                             (throw 'wont-work nil))
-                         (tramp-sh--quoting-style-options vec))))
-           (test (when (string-match-p (rx (| bol (not "%")) "%m") script)
-                   (or (tramp-get-test-command vec)
-                       (throw 'wont-work nil))))
-           (test-e (when (string-match-p (rx (| bol (not "%")) "%q") script)
-                     (or (tramp-get-file-exists-command vec)
-                         (throw 'wont-work nil))))
-           (od (when (string-match-p (rx (| bol (not "%")) "%o") script)
-                 (or (if vec (tramp-get-remote-od vec) (executable-find "od"))
+`python' commands.
+\"%b\" is replaced by a call of \"tramp_bundle_read_file-names\", \"%k\"
+is replaced by a call of \"tramp_shell_print_quoted_string\", \"%n\" is
+replaced by \"2>/dev/null\", and \"%t\" is replaced by a temporary file
+name.
+\"%%\" is replaced by \"%\".  If one of the format specifiers cannot be
+expanded, this function returns nil.  If there are only other format
+specifiers, SCRIPT is returned unchanged.
+
+If VEC is nil, the respective local commands are used."
+  (catch 'wont-work
+    (let ((awk (when (string-match-p (rx (| bol (not "%")) "%a") script)
+                (or
+                 (if vec (tramp-get-remote-awk vec) (executable-find "awk"))
+                 (throw 'wont-work nil))))
+         (bundle (when (string-match-p (rx (| bol (not "%")) "%b") script)
+                   (tramp-maybe-send-script
+                    vec tramp-bundle-read-file-names
+                    "tramp_bundle_read_file_names")
+                   "tramp_bundle_read_file_names"))
+         (hdmp (when (string-match-p (rx (| bol (not "%")) "%h") script)
+                 (or
+                  (if vec (tramp-get-remote-hexdump vec)
+                    (executable-find "hexdump"))
+                  (throw 'wont-work nil))))
+         (dev (when (string-match-p (rx (| bol (not "%")) "%n") script)
+                (or
+                 (if vec (concat "2>" (tramp-get-remote-null-device vec))
+                   (if (eq system-type 'windows-nt) ""
+                     (concat "2>" null-device)))
+                 (throw 'wont-work nil))))
+         (lispy (when (string-match-p (rx (| bol (not "%")) "%k") script)
+                  (tramp-maybe-send-script
+                   vec tramp-shell-print-quoted-string
+                   "tramp_shell_print_quoted_string")
+                  "tramp_shell_print_quoted_string"))
+         (ls (when (string-match-p (rx (| bol (not "%")) "%l") script)
+               (format "%s %s"
+                       (or (tramp-get-ls-command vec)
+                           (throw 'wont-work nil))
+                       (tramp-sh--quoting-style-options vec))))
+         (test (when (string-match-p (rx (| bol (not "%")) "%m") script)
+                 (or (tramp-get-test-command vec)
                      (throw 'wont-work nil))))
-           (perl (when (string-match-p (rx (| bol (not "%")) "%p") script)
-                   (or
-                    (if vec
-                        (tramp-get-remote-perl vec) (executable-find "perl"))
-                    (throw 'wont-work nil))))
-           (python (when (string-match-p (rx (| bol (not "%")) "%y") script)
-                     (or
-                      (if vec
-                          (tramp-get-remote-python vec)
-                        (executable-find "python"))
-                      (throw 'wont-work nil))))
-           (readlink (when (string-match-p (rx (| bol (not "%")) "%r") script)
-                       (format "%s %s"
-                               (or
-                                (if vec
-                                    (tramp-get-remote-readlink vec)
-                                  (executable-find "readlink"))
-                                (throw 'wont-work nil))
-                               "--canonicalize-missing")))
-           (stat (when (string-match-p (rx (| bol (not "%")) "%s") script)
+         (test-e (when (string-match-p (rx (| bol (not "%")) "%q") script)
+                   (or (tramp-get-file-exists-command vec)
+                       (throw 'wont-work nil))))
+         (od (when (string-match-p (rx (| bol (not "%")) "%o") script)
+               (or (if vec (tramp-get-remote-od vec) (executable-find "od"))
+                   (throw 'wont-work nil))))
+         (perl (when (string-match-p (rx (| bol (not "%")) "%p") script)
+                 (or
+                  (if vec
+                      (tramp-get-remote-perl vec) (executable-find "perl"))
+                  (throw 'wont-work nil))))
+         (python (when (string-match-p (rx (| bol (not "%")) "%y") script)
                    (or
                     (if vec
-                        (tramp-get-remote-stat vec) (executable-find "stat"))
+                        (tramp-get-remote-python vec)
+                      (executable-find "python"))
                     (throw 'wont-work nil))))
-           (tmp (when (string-match-p (rx (| bol (not "%")) "%t") script)
-                  (or
-                   (if vec
-                       (tramp-file-local-name (tramp-make-tramp-temp-name vec))
-                     (tramp-compat-make-temp-name))
-                   (throw 'wont-work nil)))))
-       (format-spec
-        script
-        (format-spec-make
-         ?a awk ?h hdmp ?l ls ?m test ?n dev ?o od ?p perl
-         ?q test-e ?r readlink ?s stat ?t tmp ?y python))))))
+         (readlink (when (string-match-p (rx (| bol (not "%")) "%r") script)
+                     (format "%s %s"
+                             (or
+                              (if vec
+                                  (tramp-get-remote-readlink vec)
+                                (executable-find "readlink"))
+                              (throw 'wont-work nil))
+                             "--canonicalize-missing")))
+         (stat (when (string-match-p (rx (| bol (not "%")) "%s") script)
+                 (or
+                  (if vec
+                      (tramp-get-remote-stat vec) (executable-find "stat"))
+                  (throw 'wont-work nil))))
+         (tmp (when (string-match-p (rx (| bol (not "%")) "%t") script)
+                (or
+                 (if vec
+                     (tramp-file-local-name (tramp-make-tramp-temp-name vec))
+                   (tramp-compat-make-temp-name))
+                 (throw 'wont-work nil)))))
+      (format-spec
+       script
+       (format-spec-make
+       ?a awk ?b bundle ?h hdmp ?k lispy ?l ls ?m test ?n dev ?o od
+       ?p perl ?q test-e ?r readlink ?s stat ?t tmp ?y python)))))
 
 (defun tramp-maybe-send-script (vec script name)
-  "Define in remote shell function NAME implemented as SCRIPT.
+  "Define a remote shell function NAME implemented as SCRIPT.
 Only send the definition if it has not already been done."
   ;; We cannot let-bind (tramp-get-connection-process vec) because it
   ;; might be nil.
diff --git a/tramp.el b/tramp.el
index 18991666f4..82a0953ecb 100644
--- a/tramp.el
+++ b/tramp.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Michael Albinus <[email protected]>
 ;; Keywords: comm, processes
 ;; Package: tramp
-;; Version: 2.8.0.4
+;; Version: 2.8.0.5
 ;; Package-Requires: ((emacs "28.1"))
 ;; Package-Type: multi
 ;; URL: https://www.gnu.org/software/tramp/
@@ -36,8 +36,8 @@
 
 ;; This package provides remote file editing, similar to ange-ftp.
 ;; The difference is that ange-ftp uses FTP to transfer files between
-;; the local and the remote host, whereas tramp.el uses a combination
-;; of rsh and rcp or other work-alike programs, such as ssh/scp.
+;; the local and the remote host, whereas Tramp uses a combination of
+;; rsh and rcp or other work-alike programs, such as ssh/scp.
 ;;
 ;; For more detailed instructions, please see the info file.
 ;;
@@ -190,8 +190,8 @@ If the shell must be forced to be interactive, see
 `tramp-encoding-command-interactive'.
 
 Note that this variable is not used for remote commands.  There are
-mechanisms in tramp.el which automatically determine the right shell to
-use for the remote host."
+mechanisms in Tramp which automatically determine the right shell to use
+for the remote host."
   :type '(file :must-match t)
   :link '(info-link :tag "Tramp manual" "(tramp) Remote shell setup"))
 
@@ -661,6 +661,17 @@ I don't think this ever needs to be changed, so please 
tell me about it
 if you need to change this."
   :type 'string)
 
+(defcustom tramp-keyboard-interactive-authentication-prompt-regexp
+  ;; This shouldn't be needed.  But sometimes, this message happens
+  ;; after the first request, although it shall be prior any
+  ;; authentication request.
+  (rx "-- Keyboard-interactive authentication prompts "
+      "from server: ------------------" (* blank) (* (any "\r\n")))
+    "Regexp matching keyboard-interactive authentication requests.
+The regexp should match at end of buffer."
+  :version "31.1"
+  :type 'regexp)
+
 (defcustom tramp-login-prompt-regexp
   (rx (* nonl) (| "user" "login") (? blank (* nonl)) ":" (* blank))
   "Regexp matching login-like prompts.
@@ -714,7 +725,7 @@ The `sudo' program appears to insert a `^@' character into 
the prompt."
   (rx-to-string
    `(: bol (* nonl)
        (group (|
-        ;; JumpCloud.
+        ;; JumpCloud.  Google Authenticator.
         "Verification code"
         ;; TACC HPC.  <https://docs.tacc.utexas.edu/basics/mfa/>
         "TACC Token Code"))
@@ -5940,6 +5951,17 @@ of."
 (defvar tramp-process-action-regexp nil
   "The regexp used to invoke an action in `tramp-process-one-action'.")
 
+(defun tramp-action-ignore-message (proc vec)
+  "Ignore the message.
+Keep the rest for next check."
+  (with-current-buffer (process-buffer proc)
+    (tramp-message vec 6 "\n%s" (buffer-string))
+    (goto-char (point-min))
+    (tramp-check-for-regexp proc tramp-process-action-regexp)
+    (replace-match "")
+    (tramp-message vec 10 "\n%s" (buffer-string)))
+  nil)
+
 (defun tramp-action-login (_proc vec)
   "Send the login name."
   (let ((user (or (tramp-file-name-user vec)
diff --git a/trampver.el b/trampver.el
index 3af36b32b5..71bb71f0ae 100644
--- a/trampver.el
+++ b/trampver.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Michael Albinus <[email protected]>
 ;; Keywords: comm, processes
 ;; Package: tramp
-;; Version: 2.8.0.4
+;; Version: 2.8.0.5
 ;; Package-Requires: ((emacs "28.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.8.0.4"
+(defconst tramp-version "2.8.0.5"
   "This version of Tramp.")
 
 ;;;###tramp-autoload
@@ -76,7 +76,7 @@
 ;; Check for Emacs version.
 (let ((x   (if (not (string-version-lessp emacs-version "28.1"))
       "ok"
-    (format "Tramp 2.8.0.4 is not fit for %s"
+    (format "Tramp 2.8.0.5 is not fit for %s"
             (replace-regexp-in-string "\n" "" (emacs-version))))))
   (unless (string-equal "ok" x) (error "%s" x)))
 

Reply via email to