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.
This commit is contained in:
Michael Albinus 2024-05-20 16:22:17 +02:00
parent 9db24de481
commit 3c238f7c50
4 changed files with 24 additions and 14 deletions

View file

@ -4468,8 +4468,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'")
@ -5003,8 +5003,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."
@ -5714,8 +5714,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'.

View file

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

View file

@ -4862,10 +4862,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)

View file

@ -7076,7 +7076,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 ()
@ -7222,6 +7222,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))
@ -7437,7 +7443,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))
@ -7706,8 +7714,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