GNU bug report logs - #60499
28.2; tramp: Remote host name not always accounted when computing multi-hops

Previous Next

Package: emacs;

Reported by: Jani Juhani Sinervo <jani <at> sinervo.fi>

Date: Mon, 2 Jan 2023 18:24:02 UTC

Severity: normal

Found in version 28.2

Fixed in version 29.1

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

Bug is archived. No further changes may be made.

Full log


Message #8 received at 60499 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Jani Juhani Sinervo <jani <at> sinervo.fi>
Cc: 60499 <at> debbugs.gnu.org
Subject: Re: bug#60499: 28.2; tramp: Remote host name not always accounted
 when computing multi-hops
Date: Wed, 04 Jan 2023 18:26:25 +0100
[Message part 1 (text/plain, inline)]
Jani Juhani Sinervo <jani <at> 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.

[Message part 2 (text/x-patch, attachment)]

This bug report was last modified 2 years and 134 days ago.

Previous Next


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