Subject: bug#53223: 27.2; multi-hop TRAMP with find-file-visit-truename t

From: Michael Albinus <[email-masked]>
Date: Thu, 13 Jan 2022 15:00:40 +0100

Aleksei Fedotov <[email-masked]> writes:

> Hi,

Hi Aleksei,

> I've spotted a problem with TRAMP when using multi-hop ssh with
> find-file-visit-truename set to t.
>
> Assuming that there is a remote machine XXX.YYY.com with SSH server. On local
> machine I run emacs like that:
>
>> emacs -Q --eval '(progn \
>>       (require (quote tramp)) \
>>       (setq find-file-visit-truename t) \
>>       (with-current-buffer (find-file "/ssh:[email-masked]|ssh:localhost:") \
>>       (tramp-cleanup-all-connections) \
>>       (revert-buffer)))'
>
> It successfully connects to the remote machine and opens dired buffer with the
> correct content, but the filename name in the dired header is not
> '/ssh:XXX.YYYY.com|ssh:localhost:' as I might expect, but
> '/ssh:localhost:/root:'. After (revert-buffer) I get an error in *Messages*:
>
>> tramp-handle-access-file: Reading directory: No such file or directory /ssh:localhost:/root/
>
> The issue does not reproduce if find-file-visit-truename set to nil. It looks like 'file-truename' doesn't work correctly with multi-hop tramp file names.

Tramp behaves as expected. You use an ad-hoc multi-hop remote file
name. Such ad-hoc definitions are removed when you call
`tramp-cleanup-all-connections'. This is described in the Tramp manual
(info "(tramp) Ad-hoc multi-hops")
(info "(tramp) Cleanup remote connections")

If you want to keep multi-hop definitions permanently, configure
`tramp-default-proxies-alist' as described in the Tramp manual, or set
`tramp-save-ad-hoc-proxies' to t. See (info "(tramp) Multi-hops")

Best regards, Michael.