From: Michael Albinus Date: Mon, 20 May 2024 14:22:17 +0000 (+0200) Subject: Tramp code cleanup X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f754ed3179ea662734b0521d430eb06f79f16a93;p=emacs.git Tramp code cleanup * lisp/net/tramp-sh.el (tramp-find-shell, tramp-find-inline-compress) (tramp-get-remote-path): * lisp/net/tramp-smb.el (tramp-smb-handle-process-file): Use `tramp-warning'. * test/lisp/net/tramp-tests.el (tramp--test-container-p): Add "kubernetes", "run0" and "nspawn". (tramp--test-toolbox-p): New defun. (tramp-test45-asynchronous-requests): Use it. (tramp--test-check-files): Adapt regexp. (cherry picked from commit 3c238f7c50427942a200d38738bd92dad98a3928) --- diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 7b7eca19316..0767da0b6d2 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -4477,8 +4477,8 @@ file exists and nonzero exit status otherwise." ;; Maybe it works at least for some other commands. (prog1 default-shell - (tramp-message - vec 2 + (tramp-warning + vec (concat "Couldn't find a remote shell which groks tilde " "expansion, using `%s'") @@ -5012,8 +5012,8 @@ Goes through the list `tramp-inline-compress-commands'." (tramp-set-connection-property p "inline-compress" nil) (tramp-set-connection-property p "inline-decompress" nil) - (tramp-message - vec 2 "Couldn't find an inline transfer compress command"))))) + (tramp-warning + vec "Couldn't find an inline transfer compress command"))))) (defun tramp-ssh-option-exists-p (vec option) "Check, whether local ssh OPTION is applicable." @@ -5723,8 +5723,8 @@ Nonexistent directories are removed from spec." (tramp-shell-quote-argument tramp-end-of-heredoc)) 'noerror (rx (literal tramp-end-of-heredoc))) (progn - (tramp-message - vec 2 "Could not retrieve `tramp-own-remote-path'") + (tramp-warning + vec "Could not retrieve `tramp-own-remote-path'") nil))))) ;; Replace place holder `tramp-default-remote-path'. diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index a51b2b904ec..c6c3caabdcf 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -1231,7 +1231,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are completely ignored." ((car destination) (setq outbuf (current-buffer)))) ;; stderr. - (tramp-message v 2 "%s" "STDERR not supported")) + (tramp-warning v "%s" "STDERR not supported")) ;; 't (destination (setq outbuf (current-buffer)))) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 8f8d3038c3f..3e80bb4b8eb 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -4852,10 +4852,11 @@ should be set conmnection-local.") (when (and (not (tramp-compat-connection-local-p tramp-direct-async-process)) (tramp-connection-property-p v "direct-async-process")) - (let ((msg (concat "Connection property \"direct-async-process\" is deprecated, " - "use connection-local variable `tramp-direct-async-process'\n" - "See (info \"(tramp) Improving performance of " - "asynchronous remote processes\")"))) + (let ((msg (concat + "Connection property \"direct-async-process\" is deprecated, " + "use connection-local variable `tramp-direct-async-process'\n" + "See (info \"(tramp) Improving performance of " + "asynchronous remote processes\")"))) (if (tramp-get-connection-property tramp-null-hop "direct-async-process-warned") (tramp-message v 2 msg) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 4334137681b..63c1428863d 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -6767,7 +6767,7 @@ This is used in tests which we don't want to tag "Check, whether a container method is used. This does not support some special file names." (string-match-p - (rx bol (| "docker" "podman" "apptainer")) + (rx bol (| "docker" "podman" "kubernetes" "apptainer" "run0" "nspawn")) (file-remote-p ert-remote-temporary-file-directory 'method))) (defun tramp--test-container-oob-p () @@ -6913,6 +6913,12 @@ This does not support special file names." (string-equal "telnet" (file-remote-p ert-remote-temporary-file-directory 'method))) +(defun tramp--test-toolbox-p () + "Check, whether the toolbox method is used. +This does not support `tramp-test45-asynchronous-requests'." + (string-equal + "toolbox" (file-remote-p ert-remote-temporary-file-directory 'method))) + (defun tramp--test-windows-nt-p () "Check, whether the locale host runs MS Windows." (eq system-type 'windows-nt)) @@ -7128,7 +7134,9 @@ This requires restrictions of file name syntax." '(tramp--test-async-shell-command)))) (with-temp-buffer (funcall this-shell-command "cat -- *" (current-buffer)) - (should (string-equal elt (buffer-string))))))) + (should + (string-match-p + (rx (literal elt) eol) (buffer-string))))))) (delete-file file2) (should-not (file-exists-p file2)) @@ -7397,8 +7405,9 @@ process sentinels. They shall not disturb each other." (skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-supports-processes-p)) (skip-unless (not (tramp--test-container-p))) - (skip-unless (not (tramp--test-telnet-p))) (skip-unless (not (tramp--test-sshfs-p))) + (skip-unless (not (tramp--test-telnet-p))) + (skip-unless (not (tramp--test-toolbox-p))) (skip-unless (not (tramp--test-windows-nt-p))) (with-timeout