]> git.eshelyaron.com Git - emacs.git/commitdiff
Tramp code cleanup
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 20 May 2024 14:22:17 +0000 (16:22 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 23 May 2024 08:28:15 +0000 (10:28 +0200)
* 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)

lisp/net/tramp-sh.el
lisp/net/tramp-smb.el
lisp/net/tramp.el
test/lisp/net/tramp-tests.el

index 7b7eca1931661f7478c6aabbdf5617fbd7935f81..0767da0b6d2a8f59e11879f7dda4c069d7f58b64 100644 (file)
@@ -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 "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 "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'.
index a51b2b904ecf4a63b2a67ee9c36c069c591c1b5b..c6c3caabdcf5c6980e88cbd9860899c7c482b11d 100644 (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))))
index 8f8d3038c3fbc95c4c29685b022850b4403ac89c..3e80bb4b8ebc6b65f87c712f49d4f2badb5c1d0a 100644 (file)
@@ -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)
index 4334137681b2ea10df0853277d45b171260203a8..63c1428863dcda6960e9232f48032409852dd881 100644 (file)
@@ -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