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: Mon, 25 Jun 2018 14:54:59 +0200
Tino Calancha <tino.calancha <at> gmail.com> writes:

Hi Tino,

> Please consider to apply the restricted patch at the end of this
> message.  It's clean and it doesn't add method specific stuff.
>
> I have successfully connected into a remote machine using this patch,
> with my local machine having:
> /bin/sh -> /bin/zsh

Looks OK to me. You could install it into master.

>> 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'.
>
> Do you want to support /sudo when the local machine has
> /bin/sh -> /bin/zsh?
> * If yes: then we obviously need to introduce changes in the code; it's
>   a pity not supporting out of the box, i.e., with emacs -Q,
>   a great shell as zsh is.

We shall try it.

>> 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.
> Have you tried it? It works for me :-) and pretty well, actually.
> As you know better than me, the remote host _is_ just the local host
> when you are invoking /sudo method.

Not always. Think about a remote file name "/ssh:remotehost|sudo:remotehost:".
The remote host is _not_ just the local host.

So we must refrain from

+    (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))))

as shown in your first patch variant. Instead of using `file-truename',
one must run something like

--8<---------------cut here---------------start------------->8---
(tramp-open-shell
 vec
 (tramp-send-command-and-read
  vec (format "readlink --canonicalize %s"
              (tramp-get-method-parameter vec 'tramp-remote-shell))))
--8<---------------cut here---------------end--------------->8---

Completely untested.

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.