emacs-diffs
[Top][All Lists]
Advanced

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

master fe37e49a97: Fix processes on remote default-directory with specia


From: Michael Albinus
Subject: master fe37e49a97: Fix processes on remote default-directory with special characters
Date: Tue, 8 Feb 2022 09:45:18 -0500 (EST)

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

    Fix processes on remote default-directory with special characters
    
    * lisp/net/tramp.el (tramp-handle-make-process): Quote `localname'.
    
    * test/lisp/net/tramp-tests.el (tramp--test-check-files):
    Test also remote `default-directory' for processes.  (Bug#53846)
---
 lisp/net/tramp.el            |  4 +++-
 test/lisp/net/tramp-tests.el | 17 +++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 6d8f267ddf..05a80e1dcf 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4292,7 +4292,9 @@ substitution.  SPEC-LIST is a list of char/value pairs 
used for
               (command (mapconcat #'tramp-shell-quote-argument command " "))
               ;; Set cwd and environment variables.
               (command
-               (append `("cd" ,localname "&&" "(" "env") env `(,command ")"))))
+               (append
+                `("cd" ,(tramp-shell-quote-argument localname) "&&" "(" "env")
+                env `(,command ")"))))
 
          ;; Check for `tramp-sh-file-name-handler', because something
          ;; is different between tramp-sh.el, and tramp-adb.el or
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index a4f2fe9e0e..d78e8815b2 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -6475,6 +6475,23 @@ This requires restrictions of file name syntax."
                    (delete-file file3)
                    (should-not (file-exists-p file3))))
 
+               ;; Check, that a process runs on a remote
+               ;; `default-directory' with special characters.  See
+               ;; Bug#53846.
+               (when (and (tramp--test-expensive-test-p)
+                          (tramp--test-supports-processes-p))
+                 (let ((default-directory file1))
+                   (dolist (this-shell-command
+                            (append
+                             ;; Synchronously.
+                             '(shell-command)
+                             ;; Asynchronously.
+                             (and (tramp--test-asynchronous-processes-p)
+                                  '(tramp--test-async-shell-command))))
+                     (with-temp-buffer
+                       (funcall this-shell-command "cat -- *" (current-buffer))
+                       (should (string-equal elt (buffer-string)))))))
+
                (delete-file file2)
                (should-not (file-exists-p file2))
                (delete-directory file1)



reply via email to

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