Sync with Tramp 2.8.0.5

* doc/misc/tramp.texi (Remote processes): Improve description
where direct asyn processes won't work.

* lisp/net/tramp-cache.el (with-tramp-saved-connection-properties):
Adapt `tramp-verbose' less aggressive.

* lisp/net/tramp-container.el (tramp-kubernetes--context-namespace):
Use `string-join'.

* lisp/net/tramp-message.el (tramp-get-debug-file-name):
Modify debug file name.
(tramp-debug-message): Simplify.

* lisp/net/tramp-sh.el (tramp-actions-before-shell)
(tramp-actions-copy-out-of-band):
Add `tramp-keyboard-interactive-authentication-prompt-regexp'.

* lisp/net/tramp.el (tramp-encoding-shell): Fix docstring.
(tramp-keyboard-interactive-authentication-prompt-regexp): New defcustom.
(tramp-action-ignore-message): New defun.

* test/lisp/net/tramp-tests.el (tramp-test10-write-region)
(tramp-test10-write-region-file-precious-flag)
(tramp-test10-write-region-other-file-name-handler)
(tramp-test27-load, tramp-test32-shell-command)
(tramp-test32-shell-command-dont-erase-buffer)
(tramp-test34-connection-local-variables)
(tramp-test36-vc-registered, tramp-test39-make-lock-file-name)
(tramp-test39-detect-external-change)
(tramp-test45-asynchronous-requests): Adapt tests.
This commit is contained in:
Michael Albinus 2025-11-28 17:38:36 +01:00
parent 2c19f6087e
commit 6346f5b053
7 changed files with 63 additions and 31 deletions

View file

@ -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

View file

@ -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.

View file

@ -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))

View file

@ -194,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)
@ -227,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
@ -249,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.

View file

@ -649,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)
@ -676,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)

View file

@ -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)

View file

@ -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