GNU bug report logs - #31924
27.0.50; tramp handler /sudo::FILE fails when /bin/sh points to zsh

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Thu, 21 Jun 2018 09:11:01 UTC

Severity: normal

Found in version 27.0.50

Fixed in version 27.1

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 31924 <at> debbugs.gnu.org
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
Tino Calancha <tino.calancha <at> 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 <at> randomhost.your.domain:")
                        "remote-shell" "/bin/zsh"))

See the Tramp manual, (info "(tramp) Predefined connection information")

Best regards, Michael.




This bug report was last modified 5 years and 211 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.