bug-gnu-emacs
[Top][All Lists]
Advanced

[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: Mon, 25 Jun 2018 14:54:59 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Tino Calancha <address@hidden> 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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]