emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 138486c: Some Tramp adaptions, mainly direct async processes


From: Michael Albinus
Subject: master 138486c: Some Tramp adaptions, mainly direct async processes
Date: Fri, 15 Jan 2021 05:32:21 -0500 (EST)

branch: master
commit 138486cddb9a0a4e3f159a6e9d7711570bdf2a4c
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Some Tramp adaptions, mainly direct async processes
    
    * doc/misc/tramp.texi (Firewalls, Remote processes)
    (Frequently Asked Questions): Add @vindex.
    (Predefined connection information): Precise precondition or direct
    async processes.
    (Remote shell setup): Ban ssh RemoteCommand option.
    (Frequently Asked Questions): Adapt quoting.
    
    * doc/misc/trampver.texi:
    * lisp/net/trampver.el: Change version to "2.5.1-pre".
    
    * lisp/net/tramp-adb.el (tramp-methods) <adb>: Add `tramp-direct-async'
    parameter.
    (tramp-adb-handle-make-process): Adapt docstring.
    
    * lisp/net/tramp-sh.el (tramp-methods) <scp, scpx, rsync, ssh, sshx>:
    Add `tramp-direct-async' parameter.
    (tramp-sh-handle-insert-directory): Simplify merkers.
    (tramp-sh-handle-make-process): Adapt docstring.
    
    * lisp/net/tramp.el (tramp-methods): Adapt docstring.
    (tramp-debug-message): Suppress lockfiles.
    (tramp-test-message): New defun.
    (tramp-direct-async-process-p): Check also for `tramp-direct-async'.
    (tramp-handle-make-process): Do not check for `tramp-direct-async-args'.
    
    * test/lisp/net/tramp-tests.el (all): Replace `string-match' by
    `string-match-p'.
    (dired-copy-dereference): Declare.
    (tramp-test-temporary-file-directory):
    Remove `tramp-direct-async-args` for mock method.
    (tramp-test15-copy-directory, tramp-test40-special-characters)
    (tramp-test40-special-characters-with-stat)
    (tramp-test40-special-characters-with-perl)
    (tramp-test40-special-characters-with-ls, tramp-test41-utf8)
    (tramp-test41-utf8-with-stat, tramp-test41-utf8-with-perl)
    (tramp-test41-utf8-with-ls): Skip for tramp-rclone.el.
    (tramp--test--deftest-direct-async-process): Do not skip for mock
    method.
    (tramp-test32-shell-command): Adapt test for direct async processes.
    (tramp-test36-vc-registered, tramp--test-hpux-p, tramp--test-ksh-p):
    Use `tramp-test-vec'.
---
 doc/misc/tramp.texi          |  26 ++++++--
 doc/misc/trampver.texi       |   2 +-
 lisp/net/tramp-adb.el        |   6 +-
 lisp/net/tramp-sh.el         |  17 +++---
 lisp/net/tramp.el            |  24 +++++---
 lisp/net/trampver.el         |   6 +-
 test/lisp/net/tramp-tests.el | 140 ++++++++++++++++++++++++-------------------
 7 files changed, 132 insertions(+), 89 deletions(-)

diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 4195ef7..2c4b792 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -1622,6 +1622,7 @@ support this command.
 
 @subsection Tunneling with ssh
 
+@vindex ProxyCommand@r{, ssh option}
 With @command{ssh}, you could use the @option{ProxyCommand} entry in
 @file{~/.ssh/config}:
 
@@ -2056,9 +2057,11 @@ default value is @t{"/data/local/tmp"} for the 
@option{adb} method,
 @item @t{"direct-async-process"}
 
 When this property is non-@code{nil}, an alternative, more performant
-implementation of @code{make-process} and
-@code{start-file-process} is applied.  @ref{Improving performance of
-asynchronous remote processes} for a discussion of constraints.
+implementation of @code{make-process} and @code{start-file-process} is
+applied.  The connection method must also be marked with a
+non-@code{nil} @code{tramp-direct-async} parameter in
+@code{tramp-methods}.  @ref{Improving performance of asynchronous
+remote processes} for a discussion of constraints.
 
 @item @t{"posix"}
 
@@ -2214,6 +2217,11 @@ overwrite this, you might apply
 
 This uses also the settings in @code{tramp-sh-extra-args}.
 
+@vindex RemoteCommand@r{, ssh option}
+@strong{Note}: If you use an @option{ssh}-based method for connection,
+do @emph{not} set the @option{RemoteCommand} option in your
+@command{ssh} configuration, for example to @command{screen}.
+
 
 @subsection Other remote shell setup hints
 @cindex remote shell setup
@@ -3304,6 +3312,8 @@ whatever reason, then replace @code{(getenv "DISPLAY")} 
with a
 hard-coded, fixed name.  Note that using @code{:0} for X11 display name
 here will not work as expected.
 
+@vindex ForwardX11@r{, ssh option}
+@vindex ForwardX11Trusted@r{, ssh option}
 An alternate approach is specify @option{ForwardX11 yes} or
 @option{ForwardX11Trusted yes} in @file{~/.ssh/config} on the local
 host.
@@ -3566,6 +3576,7 @@ Furthermore, this approach has the following limitations:
 It works only for connection methods defined in @file{tramp-sh.el} and
 @file{tramp-adb.el}.
 
+@vindex ControlMaster@r{, ssh option}
 @item
 It does not support interactive user authentication.  With
 @option{ssh}-based methods, this can be avoided by using a password
@@ -4269,6 +4280,7 @@ In order to disable those optimizations, set user option
 @item
 @value{tramp} does not recognize if a @command{ssh} session hangs
 
+@vindex ServerAliveInterval@r{, ssh option}
 @command{ssh} sessions on the local host hang when the network is
 down.  @value{tramp} cannot safely detect such hangs.  The network
 configuration for @command{ssh} can be configured to kill such hangs
@@ -4285,6 +4297,8 @@ Host *
 @item
 @value{tramp} does not use default @command{ssh} @option{ControlPath}
 
+@vindex ControlPath@r{, ssh option}
+@vindex ControlPersist@r{, ssh option}
 @value{tramp} overwrites @option{ControlPath} settings when initiating
 @command{ssh} sessions.  @value{tramp} does this to fend off a stall
 if a master session opened outside the Emacs session is no longer
@@ -4306,8 +4320,8 @@ which allows you to set the @option{ControlPath} provided 
the variable
 @end group
 @end lisp
 
-Note how "%r", "%h" and "%p" must be encoded as "%%r", "%%h" and
-"%%p".
+Note how @samp{%r}, @samp{%h} and @samp{%p} must be encoded as
+@samp{%%r}, @samp{%%h} and @samp{%%p}.
 
 @vindex tramp-use-ssh-controlmaster-options
 If the @file{~/.ssh/config} is configured appropriately for the above
@@ -4318,6 +4332,8 @@ this @code{nil} setting:
 (customize-set-variable 'tramp-use-ssh-controlmaster-options nil)
 @end lisp
 
+@vindex ProxyCommand@r{, ssh option}
+@vindex ProxyJump@r{, ssh option}
 This shall also be set to @code{nil} if you use the
 @option{ProxyCommand} or @option{ProxyJump} options in your
 @command{ssh} configuration.
diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi
index 6970c46..827c477 100644
--- a/doc/misc/trampver.texi
+++ b/doc/misc/trampver.texi
@@ -8,7 +8,7 @@
 @c In the Tramp GIT, the version numbers are auto-frobbed from
 @c tramp.el, and the bug report address is auto-frobbed from
 @c configure.ac.
-@set trampver 2.5.0
+@set trampver 2.5.1-pre
 @set trampurl https://www.gnu.org/software/tramp/
 @set tramp-bug-report-address tramp-devel@@gnu.org
 @set emacsver 25.1
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index c0c215d..2c4ef2a 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -98,6 +98,7 @@ It is used for TCP/IP devices."
              `(,tramp-adb-method
                 (tramp-login-program ,tramp-adb-program)
                 (tramp-login-args    (("shell")))
+                (tramp-direct-async  t)
                (tramp-tmpdir        "/data/local/tmp")
                 (tramp-default-port  5555)))
 
@@ -895,8 +896,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
 ;; terminated.
 (defun tramp-adb-handle-make-process (&rest args)
   "Like `make-process' for Tramp files.
-If connection property \"direct-async-process\" is non-nil, an
-alternative implementation will be used."
+If method parameter `tramp-direct-async' and connection property
+\"direct-async-process\" are non-nil, an alternative
+implementation will be used."
   (if (tramp-direct-async-process-p args)
       (apply #'tramp-handle-make-process args)
     (when args
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 7287315..e8ee372 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -168,6 +168,7 @@ The string is used in `tramp-methods'.")
                 (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
                                             ("-e" "none") ("%h")))
                 (tramp-async-args           (("-q")))
+                (tramp-direct-async         t)
                 (tramp-remote-shell         ,tramp-default-remote-shell)
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))
@@ -183,6 +184,7 @@ The string is used in `tramp-methods'.")
                                             ("-e" "none") ("-t" "-t") ("%h")
                                             ("%l")))
                 (tramp-async-args           (("-q")))
+                (tramp-direct-async         t)
                 (tramp-remote-shell         ,tramp-default-remote-shell)
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))
@@ -197,6 +199,7 @@ The string is used in `tramp-methods'.")
                 (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
                                             ("-e" "none") ("%h")))
                 (tramp-async-args           (("-q")))
+                (tramp-direct-async         t)
                 (tramp-remote-shell         ,tramp-default-remote-shell)
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))
@@ -227,6 +230,7 @@ The string is used in `tramp-methods'.")
                 (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
                                             ("-e" "none") ("%h")))
                 (tramp-async-args           (("-q")))
+                (tramp-direct-async         t)
                 (tramp-remote-shell         ,tramp-default-remote-shell)
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))))
@@ -237,6 +241,7 @@ The string is used in `tramp-methods'.")
                                             ("-e" "none") ("-t" "-t") ("%h")
                                             ("%l")))
                 (tramp-async-args           (("-q")))
+                (tramp-direct-async         t)
                 (tramp-remote-shell         ,tramp-default-remote-shell)
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))))
@@ -2668,11 +2673,9 @@ The method used must be an out-of-band method."
                        #'file-name-nondirectory (list localname))))
                    (tramp-get-remote-null-device v))))
 
-      (let ((beg-marker (point-marker))
-           (end-marker (point-marker))
+      (let ((beg-marker (copy-marker (point) nil))
+           (end-marker (copy-marker (point) t))
            (emc enable-multibyte-characters))
-       (set-marker-insertion-type beg-marker nil)
-       (set-marker-insertion-type end-marker t)
        ;; We cannot use `insert-buffer-substring' because the Tramp
        ;; buffer changes its contents before insertion due to calling
        ;; `expand-file-name' and alike.
@@ -2837,9 +2840,9 @@ the result will be a local, non-Tramp, file name."
 ;; terminated.
 (defun tramp-sh-handle-make-process (&rest args)
   "Like `make-process' for Tramp files.
-STDERR can also be a file name.  If connection property
-\"direct-async-process\" is non-nil, an alternative
-implementation will be used."
+STDERR can also be a file name.  If method parameter `tramp-direct-async'
+and connection property \"direct-async-process\" are non-nil, an
+alternative implementation will be used."
   (if (tramp-direct-async-process-p args)
       (apply #'tramp-handle-make-process args)
     (when args
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index cc8dda8..2816c58 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -259,9 +259,9 @@ pair of the form (KEY VALUE).  The following KEYs are 
defined:
     parameters to suppress diagnostic messages, in order not to
     tamper the process output.
 
-  * `tramp-direct-async-args'
-    An additional argument when a direct asynchronous process is
-    started.  Used so far only in the \"mock\" method of tramp-tests.el.
+  * `tramp-direct-async'
+    Whether the method supports direct asynchronous processes.
+    Until now, just \"ssh\"-based and \"adb\"-based methods do.
 
   * `tramp-copy-program'
     This specifies the name of the program to use for remotely copying
@@ -1755,7 +1755,8 @@ The outline level is equal to the verbosity of the Tramp 
message."
 Message is formatted with FMT-STRING as control string and the remaining
 ARGUMENTS to actually emit the message (if applicable)."
   (let ((inhibit-message t)
-       file-name-handler-alist message-log-max signal-hook-function)
+       create-lockfiles file-name-handler-alist message-log-max
+       signal-hook-function)
     (with-current-buffer (tramp-get-debug-buffer vec)
       (goto-char (point-max))
       (let ((point (point)))
@@ -1982,6 +1983,13 @@ the resulting error message."
 
 (put #'tramp-with-demoted-errors 'tramp-suppress-trace t)
 
+(defun tramp-test-message (fmt-string &rest arguments)
+  "Emit a Tramp message according `default-directory'."
+  (if (tramp-tramp-file-p default-directory)
+      (apply #'tramp-message
+            (tramp-dissect-file-name default-directory) 0 fmt-string arguments)
+    (apply #'message fmt-string arguments)))
+
 ;; This function provides traces in case of errors not triggered by
 ;; Tramp functions.
 (defun tramp-signal-hook-function (error-symbol data)
@@ -3741,7 +3749,9 @@ User is always nil."
   (let ((v (tramp-dissect-file-name default-directory))
        (buffer (plist-get args :buffer))
        (stderr (plist-get args :stderr)))
-    (and ;; It has been indicated.
+    (and ;; The method supports it.
+         (tramp-get-method-parameter v 'tramp-direct-async)
+        ;; It has been indicated.
          (tramp-get-connection-property v "direct-async-process" nil)
         ;; There's no multi-hop.
         (or (not (tramp-multi-hop-p v))
@@ -3821,8 +3831,6 @@ It does not support `:stderr'."
                  (tramp-get-method-parameter v 'tramp-login-args))
                 (async-args
                  (tramp-get-method-parameter v 'tramp-async-args))
-                (direct-async-args
-                 (tramp-get-method-parameter v 'tramp-direct-async-args))
                 ;; We don't create the temporary file.  In fact, it
                 ;; is just a prefix for the ControlPath option of
                 ;; ssh; the real temporary file has another name, and
@@ -3850,7 +3858,7 @@ It does not support `:stderr'."
                   ?h (or host "") ?u (or user "") ?p (or port "")
                   ?c options ?l "")
             ;; Add arguments for asynchronous processes.
-            login-args (append async-args direct-async-args login-args)
+            login-args (append async-args login-args)
             ;; Expand format spec.
             login-args
             (tramp-compat-flatten-tree
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 714b3f9..ced3e93 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -7,7 +7,7 @@
 ;; Maintainer: Michael Albinus <michael.albinus@gmx.de>
 ;; Keywords: comm, processes
 ;; Package: tramp
-;; Version: 2.5.0
+;; Version: 2.5.1-pre
 ;; Package-Requires: ((emacs "25.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.5.0"
+(defconst tramp-version "2.5.1-pre"
   "This version of Tramp.")
 
 ;;;###tramp-autoload
@@ -76,7 +76,7 @@
 ;; Check for Emacs version.
 (let ((x   (if (not (string-lessp emacs-version "25.1"))
       "ok"
-    (format "Tramp 2.5.0 is not fit for %s"
+    (format "Tramp 2.5.1-pre is not fit for %s"
             (replace-regexp-in-string "\n" "" (emacs-version))))))
   (unless (string-equal "ok" x) (error "%s" x)))
 
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 3995006..ef0968a 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -78,6 +78,8 @@
 ;; Needed for Emacs 27.
 (defvar process-file-return-signal-string)
 (defvar shell-command-dont-erase-buffer)
+;; Needed for Emacs 28.
+(defvar dired-copy-dereference)
 
 ;; Beautify batch mode.
 (when noninteractive
@@ -98,7 +100,6 @@
        '("mock"
         (tramp-login-program        "sh")
         (tramp-login-args           (("-i")))
-        (tramp-direct-async-args    (("-c")))
         (tramp-remote-shell         "/bin/sh")
         (tramp-remote-shell-args    ("-c"))
         (tramp-connection-timeout   10)))
@@ -2438,7 +2439,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
                      ;; We must check the last line.  There could be
                      ;; other messages from the progress reporter.
                      (should
-                      (string-match
+                      (string-match-p
                        (if (and (null noninteractive)
                                 (or (eq visit t) (null visit) (stringp visit)))
                            (format "^Wrote %s\n\\'" (regexp-quote tmp-name))
@@ -2833,6 +2834,7 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
 (ert-deftest tramp-test15-copy-directory ()
   "Check `copy-directory'."
   (skip-unless (tramp--test-enabled))
+  (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p))))
 
   (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
     (let* ((tmp-name1 (tramp--test-make-temp-name nil quoted))
@@ -3612,8 +3614,8 @@ This tests also `file-executable-p', `file-writable-p' 
and `set-file-modes'."
   `(condition-case err
        (progn ,@body)
      (file-error
-      (unless (string-match "^error with add-name-to-file"
-                           (error-message-string err))
+      (unless (string-match-p "^error with add-name-to-file"
+                             (error-message-string err))
        (signal (car err) (cdr err))))))
 
 (ert-deftest tramp-test21-file-links ()
@@ -4388,7 +4390,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            ;; there's an indication for a signal describing string.
            (let ((process-file-return-signal-string t))
              (should
-              (string-match
+              (string-match-p
                "Interrupt\\|Signal 2"
                (process-file
                 (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh")
@@ -4456,7 +4458,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (with-timeout (10 (tramp--test-timeout-handler))
              (while (< (- (point-max) (point-min)) (length "foo"))
                (while (accept-process-output proc 0 nil t))))
-           (should (string-match "foo" (buffer-string))))
+           (should (string-match-p "foo" (buffer-string))))
 
        ;; Cleanup.
        (ignore-errors (delete-process proc)))
@@ -4475,7 +4477,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (with-timeout (10 (tramp--test-timeout-handler))
              (while (< (- (point-max) (point-min)) (length "foo"))
                (while (accept-process-output proc 0 nil t))))
-           (should (string-match "foo" (buffer-string))))
+           (should (string-match-p "foo" (buffer-string))))
 
        ;; Cleanup.
        (ignore-errors
@@ -4497,7 +4499,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (with-timeout (10 (tramp--test-timeout-handler))
              (while (< (- (point-max) (point-min)) (length "foo"))
                (while (accept-process-output proc 0 nil t))))
-           (should (string-match "foo" (buffer-string))))
+           (should (string-match-p "foo" (buffer-string))))
 
        ;; Cleanup.
        (ignore-errors (delete-process proc)))
@@ -4539,8 +4541,6 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
              (cons '(nil "direct-async-process" t)
                    tramp-connection-properties)))
         (skip-unless (tramp-direct-async-process-p))
-        ;; For whatever reason, it doesn't cooperate with the "mock" method.
-        (skip-unless (not (tramp--test-mock-p)))
         ;; We do expect an established connection already,
         ;; `file-truename' does it by side-effect.  Suppress
         ;; `tramp--test-enabled', in order to keep the connection.
@@ -4586,7 +4586,7 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
            (with-timeout (10 (tramp--test-timeout-handler))
              (while (< (- (point-max) (point-min)) (length "foo"))
                (while (accept-process-output proc 0 nil t))))
-           (should (string-match "foo" (buffer-string))))
+           (should (string-match-p "foo" (buffer-string))))
 
        ;; Cleanup.
        (ignore-errors (delete-process proc)))
@@ -4607,7 +4607,7 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
            (with-timeout (10 (tramp--test-timeout-handler))
              (while (< (- (point-max) (point-min)) (length "foo"))
                (while (accept-process-output proc 0 nil t))))
-           (should (string-match "foo" (buffer-string))))
+           (should (string-match-p "foo" (buffer-string))))
 
        ;; Cleanup.
        (ignore-errors
@@ -4631,9 +4631,9 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
            (process-send-eof proc)
            ;; Read output.
            (with-timeout (10 (tramp--test-timeout-handler))
-             (while (not (string-match "foo" (buffer-string)))
+             (while (not (string-match-p "foo" (buffer-string)))
                (while (accept-process-output proc 0 nil t))))
-           (should (string-match "foo" (buffer-string))))
+           (should (string-match-p "foo" (buffer-string))))
 
        ;; Cleanup.
        (ignore-errors (delete-process proc)))
@@ -4658,7 +4658,7 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
            (with-timeout (10 (tramp--test-timeout-handler))
              (while (accept-process-output proc 0 nil t)))
            ;; On some MS Windows systems, it returns "unknown signal".
-           (should (string-match "unknown signal\\|killed" (buffer-string))))
+           (should (string-match-p "unknown signal\\|killed" (buffer-string))))
 
        ;; Cleanup.
        (ignore-errors (delete-process proc)))
@@ -4682,7 +4682,7 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
                (delete-process proc)
                (with-current-buffer stderr
                  (should
-                  (string-match
+                  (string-match-p
                    "cat:.* No such file or directory" (buffer-string)))))
 
            ;; Cleanup.
@@ -4709,7 +4709,7 @@ If UNSTABLE is non-nil, the test is tagged as 
`:unstable'."
                (with-temp-buffer
                  (insert-file-contents tmpfile)
                  (should
-                  (string-match
+                  (string-match-p
                    "cat:.* No such file or directory" (buffer-string)))))
 
            ;; Cleanup.
@@ -4852,7 +4852,7 @@ INPUT, if non-nil, is a string sent to the process."
            (should
             (string-equal
              ;; tramp-adb.el echoes, so we must add the string.
-             (if (tramp--test-adb-p)
+             (if (and (tramp--test-adb-p) (not (tramp-direct-async-process-p)))
                  (format
                   "%s\n%s\n"
                   (file-name-nondirectory tmp-name)
@@ -5043,7 +5043,7 @@ INPUT, if non-nil, is a string sent to the process."
             (cons (concat envvar "=foo") process-environment)))
        ;; Default value.
        (should
-        (string-match
+        (string-match-p
          "foo"
          (funcall
           this-shell-command-to-string
@@ -5054,13 +5054,13 @@ INPUT, if non-nil, is a string sent to the process."
             (cons (concat envvar "=") process-environment)))
        ;; Value is null.
        (should
-        (string-match
+        (string-match-p
          "bla"
          (funcall
           this-shell-command-to-string (format "echo \"${%s:-bla}\"" envvar))))
        ;; Variable is set.
        (should
-        (string-match
+        (string-match-p
          (regexp-quote envvar)
          (funcall this-shell-command-to-string "set"))))
 
@@ -5072,7 +5072,7 @@ INPUT, if non-nil, is a string sent to the process."
               (cons (concat envvar "=foo") tramp-remote-process-environment)))
          ;; Set the initial value, we want to unset below.
          (should
-          (string-match
+          (string-match-p
            "foo"
            (funcall
             this-shell-command-to-string
@@ -5080,14 +5080,14 @@ INPUT, if non-nil, is a string sent to the process."
          (let ((process-environment (cons envvar process-environment)))
            ;; Variable is unset.
            (should
-            (string-match
+            (string-match-p
              "bla"
              (funcall
               this-shell-command-to-string
               (format "echo \"${%s:-bla}\"" envvar))))
            ;; Variable is unset.
            (should-not
-            (string-match
+            (string-match-p
              (regexp-quote envvar)
              ;; We must remove PS1, the output is truncated otherwise.
              (funcall
@@ -5125,7 +5125,7 @@ Use direct async.")
                 (format "%s=%d" envvar port)
                 tramp-remote-process-environment)))
          (should
-          (string-match
+          (string-match-p
            (number-to-string port)
            (shell-command-to-string (format "echo $%s" envvar))))))
 
@@ -5253,7 +5253,7 @@ Use direct async.")
            (with-timeout (10)
              (while (accept-process-output
                      (get-buffer-process (current-buffer)) nil nil t)))
-           (should (string-match "^foo$" (buffer-string)))))
+           (should (string-match-p "^foo$" (buffer-string)))))
 
       ;; Cleanup.
       (put 'explicit-shell-file-name 'permanent-local nil)
@@ -5388,25 +5388,27 @@ Use direct async.")
           (tramp-remote-process-environment tramp-remote-process-environment)
            (inhibit-message t)
           (vc-handled-backends
-           (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
-             (cond
-              ((tramp-find-executable
-                v vc-git-program (tramp-get-remote-path v))
-               '(Git))
-              ((tramp-find-executable
-                v vc-hg-program (tramp-get-remote-path v))
-               '(Hg))
-              ((tramp-find-executable
-                v vc-bzr-program (tramp-get-remote-path v))
-               (setq tramp-remote-process-environment
-                     (cons (format "BZR_HOME=%s"
-                                   (file-remote-p tmp-name1 'localname))
-                           tramp-remote-process-environment))
-               ;; We must force a reconnect, in order to activate $BZR_HOME.
-               (tramp-cleanup-connection
-                tramp-test-vec 'keep-debug 'keep-password)
-               '(Bzr))
-              (t nil))))
+           (cond
+            ((tramp-find-executable
+              tramp-test-vec vc-git-program
+              (tramp-get-remote-path tramp-test-vec))
+             '(Git))
+            ((tramp-find-executable
+              tramp-test-vec vc-hg-program
+              (tramp-get-remote-path tramp-test-vec))
+             '(Hg))
+            ((tramp-find-executable
+              tramp-test-vec vc-bzr-program
+              (tramp-get-remote-path tramp-test-vec))
+             (setq tramp-remote-process-environment
+                   (cons (format "BZR_HOME=%s"
+                                 (file-remote-p tmp-name1 'localname))
+                         tramp-remote-process-environment))
+             ;; We must force a reconnect, in order to activate $BZR_HOME.
+             (tramp-cleanup-connection
+              tramp-test-vec 'keep-debug 'keep-password)
+             '(Bzr))
+            (t nil)))
           ;; Suppress nasty messages.
           (inhibit-message t))
       (skip-unless vc-handled-backends)
@@ -5732,7 +5734,7 @@ This does not support some special file names."
   "Check, whether an FTP-like method is used.
 This does not support globbing characters in file names (yet)."
   ;; Globbing characters are ??, ?* and ?\[.
-  (string-match
+  (string-match-p
    "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method)))
 
 (defun tramp--test-gvfs-p (&optional method)
@@ -5746,18 +5748,18 @@ If optional METHOD is given, it is checked first."
   "Check, whether the remote host runs HP-UX.
 Several special characters do not work properly there."
   ;; We must refill the cache.  `file-truename' does it.
-  (with-parsed-tramp-file-name
-      (file-truename tramp-test-temporary-file-directory) nil
-    (string-match "^HP-UX" (tramp-get-connection-property v "uname" ""))))
+  (file-truename tramp-test-temporary-file-directory) nil
+  (string-match-p
+   "^HP-UX" (tramp-get-connection-property tramp-test-vec "uname" "")))
 
 (defun tramp--test-ksh-p ()
   "Check, whether the remote shell is ksh.
 ksh93 makes some strange conversions of non-latin characters into
 a $'' syntax."
   ;; We must refill the cache.  `file-truename' does it.
-  (with-parsed-tramp-file-name
-      (file-truename tramp-test-temporary-file-directory) nil
-    (string-match "ksh$" (tramp-get-connection-property v "remote-shell" ""))))
+  (file-truename tramp-test-temporary-file-directory) nil
+  (string-match-p
+   "ksh$" (tramp-get-connection-property tramp-test-vec "remote-shell" "")))
 
 (defun tramp--test-mock-p ()
   "Check, whether the mock method is used.
@@ -5809,7 +5811,7 @@ This does not support special characters."
   "Check, whether the locale host runs MS Windows, and ps{cp,ftp} is used.
 This does not support utf8 based file transfer."
   (and (eq system-type 'windows-nt)
-       (string-match
+       (string-match-p
        (regexp-opt '("pscp" "psftp"))
        (file-remote-p tramp-test-temporary-file-directory 'method))))
 
@@ -6072,6 +6074,7 @@ This requires restrictions of file name syntax."
   (skip-unless (tramp--test-enabled))
   (skip-unless (not (tramp--test-rsync-p)))
   (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
+  (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p))))
 
   (tramp--test-special-characters))
 
@@ -6083,6 +6086,8 @@ Use the `stat' command."
   (skip-unless (tramp--test-sh-p))
   (skip-unless (not (tramp--test-rsync-p)))
   (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
+  (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p))))
+  ;; We cannot use `tramp-test-vec', because this fails during compilation.
   (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
     (skip-unless (tramp-get-remote-stat v)))
 
@@ -6101,6 +6106,8 @@ Use the `perl' command."
   (skip-unless (tramp--test-sh-p))
   (skip-unless (not (tramp--test-rsync-p)))
   (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
+  (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p))))
+  ;; We cannot use `tramp-test-vec', because this fails during compilation.
   (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
     (skip-unless (tramp-get-remote-perl v)))
 
@@ -6123,6 +6130,7 @@ Use the `ls' command."
   (skip-unless (not (tramp--test-rsync-p)))
   (skip-unless (not (tramp--test-windows-nt-and-batch-p)))
   (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
+  (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p))))
 
   (let ((tramp-connection-properties
         (append
@@ -6191,6 +6199,7 @@ Use the `ls' command."
   (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
   (skip-unless (not (tramp--test-ksh-p)))
   (skip-unless (not (tramp--test-crypt-p)))
+  (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p))))
 
   (tramp--test-utf8))
 
@@ -6206,6 +6215,8 @@ Use the `stat' command."
   (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
   (skip-unless (not (tramp--test-ksh-p)))
   (skip-unless (not (tramp--test-crypt-p)))
+  (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p))))
+  ;; We cannot use `tramp-test-vec', because this fails during compilation.
   (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
     (skip-unless (tramp-get-remote-stat v)))
 
@@ -6228,6 +6239,8 @@ Use the `perl' command."
   (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
   (skip-unless (not (tramp--test-ksh-p)))
   (skip-unless (not (tramp--test-crypt-p)))
+  (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p))))
+  ;; We cannot use `tramp-test-vec', because this fails during compilation.
   (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil
     (skip-unless (tramp-get-remote-perl v)))
 
@@ -6253,6 +6266,7 @@ Use the `ls' command."
   (skip-unless (not (tramp--test-windows-nt-and-pscp-psftp-p)))
   (skip-unless (not (tramp--test-ksh-p)))
   (skip-unless (not (tramp--test-crypt-p)))
+  (skip-unless (or (tramp--test-emacs26-p) (not (tramp--test-rclone-p))))
 
   (let ((tramp-connection-properties
         (append
@@ -6541,7 +6555,7 @@ process sentinels.  They shall not disturb each other."
              (message \"Tramp loaded: %%s\" (and (file-remote-p %S) t)))"
          tramp-test-temporary-file-directory)))
     (should
-     (string-match
+     (string-match-p
       "Tramp loaded: t[\n\r]+"
       (shell-command-to-string
        (format
@@ -6572,7 +6586,7 @@ process sentinels.  They shall not disturb each other."
     ;; Tramp doesn't load when `tramp-mode' is nil.
     (dolist (tm '(t nil))
       (should
-       (string-match
+       (string-match-p
        (format
        "Tramp loaded: nil[\n\r]+Tramp loaded: nil[\n\r]+Tramp loaded: 
%s[\n\r]+"
         tm)
@@ -6598,7 +6612,7 @@ process sentinels.  They shall not disturb each other."
               tramp-test-temporary-file-directory
               temporary-file-directory)))
       (should-not
-       (string-match
+       (string-match-p
        "Recursive load"
        (shell-command-to-string
         (format
@@ -6623,7 +6637,7 @@ process sentinels.  They shall not disturb each other."
                (load-path (cons \"/foo:bar:\" load-path))) \
            (tramp-cleanup-all-connections))"))
     (should
-     (string-match
+     (string-match-p
       (format
        "Loading %s"
        (regexp-quote
@@ -6670,11 +6684,11 @@ Since it unloads Tramp, it shall be the last test to 
run."
    (lambda (x)
      (and (or (and (boundp x) (null (local-variable-if-set-p x)))
              (and (functionp x) (null (autoloadp (symbol-function x)))))
-         (string-match "^tramp" (symbol-name x))
+         (string-match-p "^tramp" (symbol-name x))
          ;; `tramp-completion-mode' is autoloaded in Emacs < 28.1.
          (not (eq 'tramp-completion-mode x))
-         (not (string-match "^tramp\\(-archive\\)?--?test" (symbol-name x)))
-         (not (string-match "unload-hook$" (symbol-name x)))
+         (not (string-match-p "^tramp\\(-archive\\)?--?test" (symbol-name x)))
+         (not (string-match-p "unload-hook$" (symbol-name x)))
          (ert-fail (format "`%s' still bound" x)))))
   ;; The defstruct `tramp-file-name' and all its internal functions
   ;; shall be purged.
@@ -6682,15 +6696,15 @@ Since it unloads Tramp, it shall be the last test to 
run."
   (mapatoms
    (lambda (x)
      (and (functionp x)
-          (string-match "tramp-file-name" (symbol-name x))
+          (string-match-p "tramp-file-name" (symbol-name x))
           (ert-fail (format "Structure function `%s' still exists" x)))))
   ;; There shouldn't be left a hook function containing a Tramp
   ;; function.  We do not regard the Tramp unload hooks.
   (mapatoms
    (lambda (x)
      (and (boundp x)
-         (string-match "-\\(hook\\|function\\)s?$" (symbol-name x))
-         (not (string-match "unload-hook$" (symbol-name x)))
+         (string-match-p "-\\(hook\\|function\\)s?$" (symbol-name x))
+         (not (string-match-p "unload-hook$" (symbol-name x)))
          (consp (symbol-value x))
          (ignore-errors (all-completions "tramp" (symbol-value x)))
          (ert-fail (format "Hook `%s' still contains Tramp function" x))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]