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)
This commit is contained in:
Michael Albinus 2022-02-08 15:45:09 +01:00
parent 9966d9574b
commit fe37e49a97
2 changed files with 20 additions and 1 deletions

View 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

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