]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix processes on remote default-directory with special characters
authorMichael Albinus <michael.albinus@gmx.de>
Tue, 8 Feb 2022 14:45:09 +0000 (15:45 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Tue, 8 Feb 2022 14:45:09 +0000 (15:45 +0100)
* 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
test/lisp/net/tramp-tests.el

index 6d8f267ddf4b1db3ece1e86174ea9220f9f8d77f..05a80e1dcf5563f92115a55a717f82da40984940 100644 (file)
@@ -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
index a4f2fe9e0e281dcf0b75d464815b1dddbbf02b13..d78e8815b25a7d3b765516038806354f35763e9a 100644 (file)
@@ -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)