Subject: Re: bug#53053: 28.0.90; Tramp completion bug of path /sudo::~/

From: Michael Albinus <[email-masked]>
Date: Fri, 07 Jan 2022 15:05:38 +0100

Daniel Mendler <[email-masked]> writes:

Hi Daniel,

> 1. emacs -Q
> 2. C-x f /sudo::~/ (alternatively use an ssh path of a similar form)
> 3. Open the completion buffer by pressing ?
> 4. Click/select a directory in the completions buffer
>
> The resulting path looks like this:
>
> /sudo::~dir/
>
> The underlying issue is that somewhere a wrong completion boundary is
> reported by the Emacs completion table for non-normalized file paths
> which contain ~. This issue also affects other completion UIs. The issue
> is present on both 27 and 28.

I can confirm this. Tested with recent Emacs 29.0.50. As far as Tramp is
concerned, I see

--8<---------------cut here---------------start------------->8---
1 -> (file-name-all-completions "" #("/sudo:root@gandalf:/root/" 6 10 (tramp-default t) 11 18 (tramp-default t)))
1 <- file-name-all-completions: (".tcshrc" ".bash_profile" ".viminfo" ".cshrc" "tmp/" "../" ".cache/" ".local/" ".tramp_history" ".bash_history" "anaconda-ks.cfg" "./" ".bashrc" ".history" ".emacs.d/" ".config/" ".bash_logout" ".dbus/" ".ssh/")
--8<---------------cut here---------------end--------------->8---

This looks proper. However, when clicking on "tmp/" (as said in your
recipe), I get "/sudo::~tmp/".

I'm not an expert in the completion machinery, so I cannot contribute
much more to this problem.

Best regards, Michael.