Martin Joerg <[email protected]> writes:

Hi Martin,

> The problem seems to be that the way tramp-sh-handle-make-process
> splits the argument for commands of the form "sh -c argument" does not
> work correctly when the argument contains quoted strings.

Yes. So I will apply the appended patch (but overlong shell commands
cannot be protected any longer then).

Does it work for you?

Best regards, Michael.

*** /tmp/ediffDLrYgI	2020-10-21 14:41:25.282014563 +0200
--- /home/albinus/src/tramp-2-4-stable/lisp/tramp-sh.el	2020-10-21 14:41:04.465299738 +0200
***************
*** 2863,2870 ****
  	       ;; command.
  	       (heredoc (and (stringp program)
  			     (string-match-p "sh$" program)
  			     (string-equal "-c" (car args))
! 			     (= (length args) 2)))
  	       ;; When PROGRAM is nil, we just provide a tty.
  	       (args (if (not heredoc) args
  		       (let ((i 250))
--- 2863,2872 ----
  	       ;; command.
  	       (heredoc (and (stringp program)
  			     (string-match-p "sh$" program)
+ 			     (= (length args) 2)
  			     (string-equal "-c" (car args))
! 			     ;; Don't if there is a string.
! 			     (not (string-match-p "'\\|\"" (cadr args)))))
  	       ;; When PROGRAM is nil, we just provide a tty.
  	       (args (if (not heredoc) args
  		       (let ((i 250))

Reply via email to