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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60499: 28.2; tramp: Remote host name not always accounted when compu


From: Michael Albinus
Subject: bug#60499: 28.2; tramp: Remote host name not always accounted when computing multi-hops
Date: Wed, 04 Jan 2023 18:26:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Jani Juhani Sinervo <jani@sinervo.fi> writes:

Hi Jani,

> When using a custom TRAMP method with a program that expects the host
> name to be passed in as an argument to a command-line switch, the
> natural way of writing the `tramp-login-args' like (("--switch" "%h"))
> does not work, since `tramp-compute-multi-hops' only considers the host
> name to have been used within the command template, if it is in its own
> list, as in (("--switch") ("%h")).
>
> This is a problem, because there are tools, like Toolbox[0], which
> allow running the command within a specific container. For example with
> Toolbox, it would look something like the following:
>
> `toolbox run -c container-name-here command'
>
> This can be turned into a TRAMP method relatively easily, and the most
> natural way to write the `tramp-login-args' would be the following:
>
> (tramp-login-args (("run") ("-c" "%h") ("sh")))

Thanks for the bug report.

> The code responsible can be found in `lisp/net/tramp.el' and within the
> function `tramp-compute-multi-hops'. Excerpt:
>
> We notice that the culprit here is the call to `member', where it
> erroneously checks for the host name being used by the command template
> by only checking whether the literal list '("%h") is within the
> `tramp-login-args'.
>
> My proposed fix would be the go through the `tramp-login-args' method
> parameter, and go through each of the list-of-lists to check whether
> there is a string "%h" there.

I've pushed a slightly simpler fix to the emacs-29 branch, see
appended. It will appear with the upcoming Emacs 29.1.

Until it is released, you could also try to apply it in Emacs 28.2 (I
didn't check myself). Or you wait for the next GNU ELPA release of
Tramp, 2.6.0.1, which will appear later this month.

Btw, the idea with toolbox looks good. I'll see whether I could add it
to Tramp 2.7, living in the Emacs master branch. However, I'd prefer to say

(tramp-login-args (("enter") ("-c" "%h")))

Best regards, Michael.

Attachment: txtMv8j7hx1ti.txt
Description: Text Data


reply via email to

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