From e8e78809ba701eb8031120697bb9b3383473b86c Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 22 Aug 2021 14:50:19 +0200 Subject: [PATCH] Some adaptions for Tramp's security key detection. * lisp/net/tramp.el (tramp-security-key-timeout-regexp): New defcustom. (tramp-action-show-and-confirm-message): Don't use timeout, check for the timeout message of the ssh command. --- lisp/net/tramp.el | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 83df05c24b7..b687eb76536 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -714,6 +714,13 @@ The regexp should match at end of buffer." :version "28.1" :type 'regexp) +(defcustom tramp-security-key-timeout-regexp + "^\r*sign_and_send_pubkey: signing failed for .*[\r\n]*" + "Regular expression matching security key timeout message. +The regexp should match at end of buffer." + :version "28.1" + :type 'regexp) + (defcustom tramp-operation-not-permitted-regexp (concat "\\(" "preserving times.*" "\\|" "set mode" "\\)" ":\\s-*" (regexp-opt '("Operation not permitted") t)) @@ -4692,16 +4699,21 @@ The terminal type can be configured with `tramp-terminal-type'." "Show the user a message for confirmation. Wait, until the connection buffer changes." (with-current-buffer (process-buffer proc) - (let ((stimers (with-timeout-suspend))) + (let ((stimers (with-timeout-suspend)) + (cursor-in-echo-area t) + set-message-function clear-message-function) (tramp-message vec 6 "\n%s" (buffer-string)) - (goto-char (point-min)) (tramp-check-for-regexp proc tramp-process-action-regexp) (with-temp-message (replace-regexp-in-string "[\r\n]" "" (match-string 0)) - (redisplay 'force) ;; Hide message in buffer. (narrow-to-region (point-max) (point-max)) ;; Wait for new output. - (tramp-wait-for-regexp proc 30 tramp-security-key-confirmed-regexp)) + (while (not (ignore-error 'file-error + (tramp-wait-for-regexp + proc 0.1 tramp-security-key-confirmed-regexp))) + (when (tramp-check-for-regexp proc tramp-security-key-timeout-regexp) + (throw 'tramp-action 'timeout)) + (redisplay 'force))) ;; Reenable the timers. (with-timeout-unsuspend stimers))) t) -- 2.39.5