[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#31924: 27.0.50; tramp handler /sudo::FILE fails when /bin/sh points
From: |
Michael Albinus |
Subject: |
bug#31924: 27.0.50; tramp handler /sudo::FILE fails when /bin/sh points to zsh |
Date: |
Sun, 24 Jun 2018 12:33:11 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Tino Calancha <tino.calancha@gmail.com> writes:
> Hi Michael,
Hi Tino,
> I got a patch that works in my box. It does 2 things:
>
> 1) Ensure that zsh is invoked as zsh, that is, not as sh. Otherwise
> our dotfiles are ignored, and we keep getting the bracketed paste
> codes.
>
> 2) I also need to disable the zsh option promptcr, otherwise after I
> introduce my root password, Emacs gets stuck in `tramp-wait-for-output';
> this is becuse some '\r' are added in front the prompt, so the
> regexp in ``tramp-wait-for-regexp' cannot match.
Point 2) is OK. But your solution for point 1) doesn't work in general.
> @@ -4110,7 +4112,11 @@ tramp-open-connection-setup-interactive-shell
> process to set up. VEC specifies the connection."
> (let ((tramp-end-of-output tramp-initial-end-of-output)
> (case-fold-search t))
> - (tramp-open-shell vec (tramp-get-method-parameter vec
> 'tramp-remote-shell))
> + (tramp-open-shell
> + vec
> + (if (not (equal "sudo" (tramp-file-name-method vec)))
> + (tramp-get-method-parameter vec 'tramp-remote-shell)
> + (file-truename (tramp-get-method-parameter vec 'tramp-remote-shell))))
In tramp-sh.el, there shall be no code which relies on a given
method. Everything which is method specific, must be configured in
`tramp-methods'.
Furthermore, this code does not work at all. (file-truename "/bin/sh")
is always eval'ed on the local host, but you want to get information
about the remote host.
The better solution is to overwrite the `tramp-remote-shell' connection
property. Do something like this:
(add-to-list 'tramp-connection-properties
(list (regexp-quote "/ssh:user@randomhost.your.domain:")
"remote-shell" "/bin/zsh"))
See the Tramp manual, (info "(tramp) Predefined connection information")
Best regards, Michael.