emacs-devel
[Top][All Lists]
Advanced

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

Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Han


From: Stefan Monnier
Subject: Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands.
Date: Fri, 18 Dec 2020 13:57:44 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> (defun start-file-process-shell-command (name buffer &rest args)
>   "..."
>   (with-connection-local-variables
>    (start-file-process
>     name buffer
>     shell-file-name shell-command-switch
>     (shell-quote-argument (mapconcat 'identity args " ")))))

Concatenating arguments with a " " separator is plain wrong.
That's why we have

   (declare (advertised-calling-convention (name buffer command) "23.1"))

so we can hopefully soon drop support for that concatenation.

Any caller which passes several `args` should be fixed.
Any chance this is the problem you're seeing?

If we disregard those wrong callers, the current definition is:

  (with-connection-local-variables
   (start-file-process
    name buffer
    shell-file-name shell-command-switch command))

So the `command` doesn't need any quoting here: it's
start-file-process's responsability to make sure it starts a process
with those 3 strings (shell-file-name as the name of the executable,
`shell-command-switch` as the first arg and `command` as the second).

In the case of Tramp's implementation of `start-file-process`, you're
going to run this process by constructing a command to send to the
remote shell, so you'll indeed need to turn this list of strings
into a single string and you need to do it by quoting those strings
using the quoting that corresponds to that of the remote shell (which
is indeed what `tramp-shell-quote-argument` does, IIUC).
IOW, I'd expect `start-file-process` to do something like

    (mapconcat #'tramp-shell-quote-argument args " ")

to construct the command to send to the remote shell.


        Stefan




reply via email to

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