[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: |
Michael Albinus |
Subject: |
Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands. |
Date: |
Fri, 18 Dec 2020 18:23:39 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> BTW, what would go wrong if you did
>>> (setq command (mapcar #'tramp-shell-quote-argument command))?
>>
>> Tried that, didn't work. Imagine, you call "M-x rgrep" on a remote
>> machine. This ends up in a make-process call with :command
> [...]
>> As you see, three arguments "/bin/sh" "-c" and "find ...". If I do your
>> proposal, Tramp would send finally
>
> I don't understand: your code leaves "sh" and "-c" and passes the third
> through `tramp-shell-quote-argument`, but that should give the exact
> same result as passing all three through `tramp-shell-quote-argument`
> since "sh" and "-c" are both left unchanged by `tramp-shell-quote-argument`.
>
> What am I missing?
The example I gave you was simplified. If you look into
tramp-handle-make-process, you'll see a more complex machinery. And yes,
I've tried several variants of quoting before I found this working
solution.
But I don't believe it shall be solved in this function. Because it is
about quoting of a shell command, it is likely that it would be better
fixed in start-file-process-shell-command. I would prefer
(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 " ")))))
However, shell-quote-argument quotes wrt the local shell. A shell on the
remote host might quote differently. Maybe we make
start-file-process-shell-command a magic function? or shell-quote-argument?
Don't know. I'll experiment with this next days. People will be in the
Xmas break, so there's time.
> Stefan
Best regards, Michael.
- Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands., Stefan Monnier, 2020/12/18
- Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands., Michael Albinus, 2020/12/18
- Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands., Stefan Monnier, 2020/12/18
- Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands., Stefan Monnier, 2020/12/18
- Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands., Michael Albinus, 2020/12/18
- Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands., Stefan Monnier, 2020/12/18
- Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands.,
Michael Albinus <=
- Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands., Stefan Monnier, 2020/12/18
- Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands., Michael Albinus, 2020/12/19
- Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands., Michael Albinus, 2020/12/20
- Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands., Stefan Monnier, 2020/12/20
- Re: master 0ad1c0d: * lisp/net/tramp.el (tramp-handle-make-process): Handle shell commands., Andreas Schwab, 2020/12/18