Subject: bug#63578: 29.0.91; Org Cannot tangle with tramp using sudo

From: Michael Albinus <[email-masked]>
Date: Sat, 20 May 2023 13:16:46 +0200

Kostadin Ninev <[email-masked]> writes:

Hi Kostadin,

> After a lot of debugging I propose this patch which fixes the problem
> for me without observable side effects:
>
> --- /usr/share/emacs/29.0.91/lisp/net/tramp.el  2023-05-18
>     15:20:57.000000000 +0300
> +++ tramp.el    2023-05-20 11:24:51.869320508 +0300
> @@ -4621,7 +4621,7 @@
>    (when-let ((hops (tramp-file-name-hop vec))
>              (item vec))
>      (dolist (proxy (reverse (split-string hops
>      tramp-postfix-hop-regexp 'omit)))
> -      (let* ((host-port (tramp-file-name-host-port item))
> +      (when-let* ((host-port (tramp-file-name-host-port item))
>              (user-domain (tramp-file-name-user-domain item))
>              (proxy (concat
>                      tramp-prefix-format proxy tramp-postfix-host-format))

It doesn't look proper to me; we cannot expect that both host-port and
user-domain are always non-nil.

> I realy hope this is fixed before the release of emacs 29.1. Let me
> know if I can anything else.-- Kostadin Ninev.

I have no idea yet what goes wrong, I'm trying to assemble a recipe for
reproduction first. Perhaps you can send the value of
tramp-default-proxies-alist at the moment everything goes wrong.

Do you use several multi-hops in parallel? Something like
"/ssh:user@server|sudo::" and "/ssh:anotheruser@anotherserver|sudo::"?

And while it might be good to have it fixed in Emacs 29.1, it is not a
must. There are regular Tramp releases on GNU ELPA, which could fix it
also after the Emacs 29.1 release.

Best regards, Michael.