[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/tramp e9e0062d8a: Tramp ELPA version 2.6.1.3 released
From: |
ELPA Syncer |
Subject: |
[elpa] externals/tramp e9e0062d8a: Tramp ELPA version 2.6.1.3 released |
Date: |
Fri, 29 Sep 2023 03:59:32 -0400 (EDT) |
branch: externals/tramp
commit e9e0062d8aaa245a24e2c246346cde97e48407d0
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>
Tramp ELPA version 2.6.1.3 released
---
README | 6 ++--
test/tramp-tests.el | 79 ++++++++++++++++++++++++++++++++++++++++++++++-------
texi/tramp.texi | 40 ++++++++++-----------------
texi/trampver.texi | 2 +-
tramp-sh.el | 2 ++
tramp-sshfs.el | 4 +--
tramp.el | 42 ++++++++++++++++++++++++----
trampver.el | 6 ++--
8 files changed, 131 insertions(+), 50 deletions(-)
diff --git a/README b/README
index ae059c78fa..e22daa5819 100644
--- a/README
+++ b/README
@@ -22,11 +22,11 @@ installed with, you must recompile the package:
• Remove all byte-compiled Tramp files
- $ rm -f ~/.emacs.d/elpa/tramp-2.6.1.2/tramp*.elc
+ $ rm -f ~/.emacs.d/elpa/tramp-2.6.1.3/tramp*.elc
• Start Emacs with Tramp’s source files
- $ emacs -L ~/.emacs.d/elpa/tramp-2.6.1.2 -l tramp
+ $ emacs -L ~/.emacs.d/elpa/tramp-2.6.1.3 -l tramp
This should not give you the error.
@@ -40,7 +40,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.6.1.2 from GNU ELPA:
+installation or upgrading Tramp 2.6.1.3 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 6021eda8df..0648fe9e80 100644
--- a/test/tramp-tests.el
+++ b/test/tramp-tests.el
@@ -5313,7 +5313,7 @@ If UNSTABLE is non-nil, the test is tagged as
`:unstable'."
;; `make-process' supports file name handlers since Emacs 27. We
;; cannot use `tramp--test-always' during compilation of the macro.
(when (let ((file-name-handler-alist '(("" . (lambda (&rest _) t)))))
- (ignore-errors (make-process :file-handler t)))
+ (ignore-errors (make-process :name "" :command "" :file-handler t)))
`(ert-deftest ,(intern (concat (symbol-name test) "-direct-async")) ()
;; This is the docstring. However, it must be expanded to a
;; string inside the macro. No idea.
@@ -5354,7 +5354,7 @@ If UNSTABLE is non-nil, the test is tagged as
`:unstable'."
(let ((default-directory ert-remote-temporary-file-directory)
(tmp-name (tramp--test-make-temp-name nil quoted))
kill-buffer-query-functions command proc)
- (with-no-warnings (should-not (make-process)))
+ (should-not (apply #'make-process nil)) ; Use `apply' to avoid warnings.
;; Simple process.
(unwind-protect
@@ -7384,13 +7384,13 @@ This requires restrictions of file name syntax."
;; of process output. So we unset it temporarily.
(setenv "PS1")
(with-temp-buffer
- (should (zerop (process-file "printenv" nil t nil)))
- (goto-char (point-min))
- (should
- (re-search-forward
- (tramp-compat-rx
- bol (literal envvar)
- "=" (literal (getenv envvar)) eol))))))))
+ (when (zerop (process-file "printenv" nil t nil))
+ (goto-char (point-min))
+ (should
+ (re-search-forward
+ (tramp-compat-rx
+ bol (literal envvar)
+ "=" (literal (getenv envvar)) eol)))))))))
;; Cleanup.
(ignore-errors (kill-buffer buffer))
@@ -7843,7 +7843,7 @@ process sentinels. They shall not disturb each other."
(shell-command-to-string "read -s -p Password: pass"))))
(let ((pass "secret")
- (mock-entry (copy-sequence (assoc "mock" tramp-methods)))
+ (mock-entry (copy-tree (assoc "mock" tramp-methods)))
mocked-input tramp-methods)
;; We must mock `read-string', in order to avoid interactive
;; arguments.
@@ -7890,6 +7890,65 @@ process sentinels. They shall not disturb each other."
(let ((auth-sources `(,netrc-file)))
(should (file-exists-p ert-remote-temporary-file-directory)))))))))
+(ert-deftest tramp-test46-read-otp-password ()
+ "Check Tramp one-time password handling."
+ :tags '(:expensive-test)
+ (skip-unless (tramp--test-mock-p))
+ ;; Not all read commands understand argument "-s" or "-p".
+ (skip-unless
+ (string-empty-p
+ (let ((shell-file-name "sh"))
+ (shell-command-to-string "read -s -p Password: pass"))))
+
+ (let ((pass "secret")
+ (mock-entry (copy-tree (assoc "mock" tramp-methods)))
+ mocked-input tramp-methods)
+ ;; We must mock `read-string', in order to avoid interactive
+ ;; arguments.
+ (cl-letf* (((symbol-function #'read-string)
+ (lambda (&rest _args) (pop mocked-input))))
+ (setcdr
+ (assq 'tramp-login-args mock-entry)
+ `((("-c")
+ (,(tramp-shell-quote-argument
+ (concat
+ "read -s -p 'Verification code: ' pass; echo; "
+ "(test \"pass$pass\" != \"pass" pass "\" && "
+ "echo \"Login incorrect\" || sh -i)"))))))
+ (setq tramp-methods `(,mock-entry))
+
+ ;; Reading password from stdin works.
+ (tramp-cleanup-connection tramp-test-vec 'keep-debug)
+ ;; We don't want to invalidate the password.
+ (setq mocked-input `(,(copy-sequence pass)))
+ (should (file-exists-p ert-remote-temporary-file-directory))
+
+ ;; Don't entering a password returns in error.
+ (tramp-cleanup-connection tramp-test-vec 'keep-debug)
+ (setq mocked-input nil)
+ (should-error (file-exists-p ert-remote-temporary-file-directory))
+
+ ;; A wrong password doesn't work either.
+ (tramp-cleanup-connection tramp-test-vec 'keep-debug)
+ (setq mocked-input `(,(concat pass pass)))
+ (should-error (file-exists-p ert-remote-temporary-file-directory))
+
+ ;; The password shouldn't be read from auth-source.
+ ;; Macro `ert-with-temp-file' was introduced in Emacs 29.1.
+ (with-no-warnings (when (symbol-plist 'ert-with-temp-file)
+ (tramp-cleanup-connection tramp-test-vec 'keep-debug)
+ (setq mocked-input nil)
+ (auth-source-forget-all-cached)
+ (ert-with-temp-file netrc-file
+ :prefix "tramp-test" :suffix ""
+ :text (format
+ "machine %s port mock password %s"
+ (file-remote-p ert-remote-temporary-file-directory 'host)
+ pass)
+ (let ((auth-sources `(,netrc-file)))
+ (should-error
+ (file-exists-p ert-remote-temporary-file-directory)))))))))
+
;; This test is inspired by Bug#29163.
(ert-deftest tramp-test47-auto-load ()
"Check that Tramp autoloads properly."
diff --git a/texi/tramp.texi b/texi/tramp.texi
index b523fe21bf..638f0149b3 100644
--- a/texi/tramp.texi
+++ b/texi/tramp.texi
@@ -2417,8 +2417,10 @@ which may not be the same as the local login shell
prompt,
@value{tramp} sets a similar default value for both prompts.
@item @code{tramp-password-prompt-regexp}
+@item @code{tramp-otp-password-prompt-regexp}
@item @code{tramp-wrong-passwd-regexp}
@vindex tramp-password-prompt-regexp
+@vindex tramp-otp-password-prompt-regexp
@vindex tramp-wrong-passwd-regexp
@value{tramp} uses @code{tramp-password-prompt-regexp} to
@@ -2452,6 +2454,10 @@ This user option is, by default, initialized from
is usually more convenient to add new passphrases to that user option
instead of altering this user option.
+The user option @code{tramp-otp-password-prompt-regexp} has a similar
+purpose, but for one-time passwords. Those passwords are not cached
+by @value{tramp} for reuse.
+
Similar localization may be necessary for handling wrong password
prompts, for which @value{tramp} uses @code{tramp-wrong-passwd-regexp}.
@@ -5122,30 +5128,11 @@ How to get notified after @value{tramp} completes file
transfers?
Make Emacs beep after reading from or writing to the remote host with
the following code in @file{~/.emacs}.
+@vindex tramp-handle-write-region-hook
+@vindex tramp-handle-file-local-copy-hook
@lisp
-@group
-(defadvice tramp-handle-write-region
- (after tramp-write-beep-advice activate)
- "Make @value{tramp} beep after writing a file."
- (interactive)
- (beep))
-@end group
-
-@group
-(defadvice tramp-handle-do-copy-or-rename-file
- (after tramp-copy-beep-advice activate)
- "Make @value{tramp} beep after copying a file."
- (interactive)
- (beep))
-@end group
-
-@group
-(defadvice tramp-handle-insert-file-contents
- (after tramp-insert-beep-advice activate)
- "Make @value{tramp} beep after inserting a file."
- (interactive)
- (beep))
-@end group
+(add-hook 'tramp-handle-write-region-hook 'beep)
+(add-hook 'tramp-handle-file-local-copy-hook 'beep)
@end lisp
@@ -5416,9 +5403,8 @@ minibuffer:
@end group
@group
-(defadvice minibuffer-complete
- (before my-minibuffer-complete activate)
- (expand-abbrev))
+(advice-add 'minibuffer-complete
+ :before 'expand-abbrev)
@end group
@end lisp
@@ -5615,6 +5601,8 @@ If you find the cleanup disturbing, because the file
names in
two forms in your @file{~/.emacs} after loading the @code{tramp} and
@code{recentf} packages:
+@vindex tramp-cleanup-connection-hook
+@vindex tramp-cleanup-all-connections-hook
@lisp
@group
(remove-hook
diff --git a/texi/trampver.texi b/texi/trampver.texi
index 389afe27d0..af7f4ceab6 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.6.1.2
+@set trampver 2.6.1.3
@set trampurl https://www.gnu.org/software/tramp/
@set tramp-bug-report-address tramp-devel@@gnu.org
@set emacsver 26.1
diff --git a/tramp-sh.el b/tramp-sh.el
index 5a1e73aab2..59d5c00515 100644
--- a/tramp-sh.el
+++ b/tramp-sh.el
@@ -535,6 +535,7 @@ shell from reading its init file."
(defconst tramp-actions-before-shell
'((tramp-login-prompt-regexp tramp-action-login)
(tramp-password-prompt-regexp tramp-action-password)
+ (tramp-otp-password-prompt-regexp tramp-action-otp-password)
(tramp-wrong-passwd-regexp tramp-action-permission-denied)
(shell-prompt-pattern tramp-action-succeed)
(tramp-shell-prompt-pattern tramp-action-succeed)
@@ -558,6 +559,7 @@ corresponding PATTERN matches, the ACTION function is
called.")
(defconst tramp-actions-copy-out-of-band
'((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)
(tramp-security-key-confirm-regexp tramp-action-show-and-confirm-message)
diff --git a/tramp-sshfs.el b/tramp-sshfs.el
index c638d32ec3..ace9b3bda4 100644
--- a/tramp-sshfs.el
+++ b/tramp-sshfs.el
@@ -60,7 +60,7 @@
;; These are for remote processes.
(tramp-login-program "ssh")
(tramp-login-args (("-q") ("-l" "%u") ("-p" "%p")
- ("-e" "none") ("-t" "-t")
+ ("-e" "none") ("%a" "%a")
("%h") ("%l")))
(tramp-direct-async t)
(tramp-remote-shell ,tramp-default-remote-shell)
@@ -323,7 +323,7 @@ arguments to pass to the OPERATION."
?h (or (tramp-file-name-host v) "")
?u (or (tramp-file-name-user v) "")
?p (or (tramp-file-name-port v) "")
- ?l command))
+ ?a "-t" ?l command))
;; Synchronize stderr.
(when tmpstderr
diff --git a/tramp.el b/tramp.el
index d10f93b34b..6b64e26b10 100644
--- a/tramp.el
+++ b/tramp.el
@@ -252,9 +252,9 @@ pair of the form (KEY VALUE). The following KEYs are
defined:
\"%\" followed by a letter are expanded in the arguments as
follows:
- - \"%h\" is replaced by the host name
- - \"%u\" is replaced by the user name
- - \"%p\" is replaced by the port number
+ - \"%h\" is replaced by the host name.
+ - \"%u\" is replaced by the user name.
+ - \"%p\" is replaced by the port number.
- \"%%\" can be used to obtain a literal percent character.
If a sub-list containing \"%h\", \"%u\" or \"%p\" is
@@ -283,6 +283,8 @@ pair of the form (KEY VALUE). The following KEYs are
defined:
- \"%z\" is replaced by the `tramp-scp-direct-remote-copying'
argument if it is supported.
- \"%d\" is replaced by the device detected by `tramp-adb-get-device'.
+ - \"%a\" adds the pseudo-terminal allocation argument \"-t\" in
+ asynchronous processes, if the connection type is not `pipe'.
The existence of `tramp-login-args', combined with the
absence of `tramp-copy-args', is an indication that the
@@ -679,6 +681,16 @@ The `sudo' program appears to insert a `^@' character into
the prompt."
:version "29.1"
:type 'regexp)
+(defcustom tramp-otp-password-prompt-regexp
+ (rx bol (* nonl)
+ ;; JumpCloud.
+ (group (| "Verification code"))
+ (* nonl) (any "::៖") (* blank))
+ "Regexp matching one-time password prompts.
+The regexp should match at end of buffer."
+ :version "29.2"
+ :type 'regexp)
+
(defcustom tramp-wrong-passwd-regexp
(rx bol (* nonl)
(| "Permission denied"
@@ -3724,7 +3736,7 @@ BODY is the backend specific code."
(let ((inhibit-file-name-handlers
`(tramp-file-name-handler
tramp-crypt-file-name-handler
- . inhibit-file-name-handlers))
+ . ,inhibit-file-name-handlers))
(inhibit-file-name-operation 'write-region))
(find-file-name-handler ,visit 'write-region))))
;; We use this to save the value of
@@ -5023,6 +5035,7 @@ substitution. SPEC-LIST is a list of char/value pairs
used for
(when adb-file-name-handler-p
(tramp-compat-funcall
'tramp-adb-get-device v)))
+ (pta (unless (eq connection-type 'pipe) "-t"))
login-args p)
;; Replace `login-args' place holders. Split
@@ -5039,7 +5052,7 @@ substitution. SPEC-LIST is a list of char/value pairs
used for
v 'tramp-login-args
?h (or host "") ?u (or user "") ?p (or port "")
?c (format-spec (or options "") (format-spec-make ?t tmpfile))
- ?d (or device "") ?l ""))))
+ ?d (or device "") ?a (or pta "") ?l ""))))
p (make-process
:name name :buffer buffer
:command (append `(,login-program) login-args command)
@@ -5538,6 +5551,25 @@ of."
(narrow-to-region (point-max) (point-max))))
t)
+(defun tramp-action-otp-password (proc vec)
+ "Query the user for a one-time password."
+ (with-current-buffer (process-buffer proc)
+ (let ((case-fold-search t)
+ prompt)
+ (goto-char (point-min))
+ (tramp-check-for-regexp proc tramp-process-action-regexp)
+ (setq prompt (concat (match-string 1) " "))
+ (tramp-message vec 3 "Sending %s" (match-string 1))
+ ;; We don't call `tramp-send-string' in order to hide the
+ ;; password from the debug buffer and the traces.
+ (process-send-string
+ proc
+ (concat
+ (tramp-read-passwd-without-cache proc prompt) tramp-local-end-of-line))
+ ;; Hide password prompt.
+ (narrow-to-region (point-max) (point-max))))
+ t)
+
(defun tramp-action-succeed (_proc _vec)
"Signal success in finding shell prompt."
(throw 'tramp-action 'ok))
diff --git a/trampver.el b/trampver.el
index 289dbf8baa..9103c9d198 100644
--- a/trampver.el
+++ b/trampver.el
@@ -7,7 +7,7 @@
;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
;; Keywords: comm, processes
;; Package: tramp
-;; Version: 2.6.1.2
+;; Version: 2.6.1.3
;; Package-Requires: ((emacs "26.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.6.1.2"
+(defconst tramp-version "2.6.1.3"
"This version of Tramp.")
;;;###tramp-autoload
@@ -78,7 +78,7 @@
;; Check for Emacs version.
(let ((x (if (not (string-version-lessp emacs-version "26.1"))
"ok"
- (format "Tramp 2.6.1.2 is not fit for %s"
+ (format "Tramp 2.6.1.3 is not fit for %s"
(replace-regexp-in-string "\n" "" (emacs-version))))))
(unless (string-equal "ok" x) (error "%s" x)))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/tramp e9e0062d8a: Tramp ELPA version 2.6.1.3 released,
ELPA Syncer <=