unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Tino Calancha <tino.calancha@gmail.com>
Cc: 31924@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	[thread overview]
Message-ID: <8736xbf2l8.fsf@gmx.de> (raw)
In-Reply-To: <87vaa7odeg.fsf@calancha-pc.dy.bbexcite.jp> (Tino Calancha's message of "Mon, 25 Jun 2018 10:36:39 +0900")

Tino Calancha <tino.calancha@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.





  reply	other threads:[~2018-06-25 12:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21  9:09 bug#31924: 27.0.50; tramp handler /sudo::FILE fails when /bin/sh points to zsh Tino Calancha
2018-06-21 11:05 ` Michael Albinus
2018-06-24  7:07   ` Tino Calancha
2018-06-24  7:15     ` Tino Calancha
2018-06-24 10:33     ` Michael Albinus
2018-06-25  1:36       ` Tino Calancha
2018-06-25 12:54         ` Michael Albinus [this message]
2019-10-09 11:00           ` Michael Albinus
2019-10-16 10:41             ` Tino Calancha
2019-10-16 11:01               ` Michael Albinus
2019-10-16 11:36                 ` Tino Calancha
2019-10-16 13:21                   ` Michael Albinus
2019-10-17 15:24                     ` Tino Calancha
2019-10-17 16:24                       ` Michael Albinus
2018-06-25 15:22         ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8736xbf2l8.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=31924@debbugs.gnu.org \
    --cc=tino.calancha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).