Subject: bug#65431: 30.0.50; pcomplete should not quote everything in a file name

From: Jim Porter <[email-masked]>
Date: Mon, 21 Aug 2023 10:51:27 -0700

On 8/21/2023 7:10 AM, Michael Albinus wrote:
> 
> - emacs -Q -l tramp --eval "(tramp-change-syntax 'separate)" -f eshell
> 
> - Type "cd /[ssh/localho TAB"
> 
> - This expands to "cd /[ssh/localhost\]"
> 
> Due to the quoted right square bracket, the cd command fails. pcomplete
> should be taught to not quote everything in a file name.

I believe the problem is actually the *left* square bracket. Both square 
brackets should be quoted; otherwise, [...] gets treated as a glob. I'm 
a little surprised that the tab-completion even works here; I guess it's 
more forgiving than it should be. However, if you type "cd /\[ssh/loca 
TAB", it should work correctly.

I see a couple of options:

1) Could Pcomplete fix the unquoted "[" for us? *Should* it?

2) I see that Pcomplete fails if you try to quote the whole file name, 
like "cd '/[ssh:loca TAB". Maybe we should fix that. Then users could 
rely on quoting with ' or " to escape the special glob characters instead.