[Bug 261728] If sh became a usable interactive shell, then why can't it tab-autocomplete file.(mine).1.txt and file.(mine).2.txt?

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 08 Feb 2022 16:34:37 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261728

Daniel Tameling <tamelingdaniel@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tamelingdaniel@gmail.com

--- Comment #6 from Daniel Tameling <tamelingdaniel@gmail.com> ---
Created attachment 231647
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=231647&action=edit
Add ')' and '}' to the word delimiters for the completion. They were missing.

I had a look at what is going on and this looks like a bug. The word delimiters
passed to libedit are L" \t\n\"\\'`@$><=;|&{(". This is missing ')' and '}'. So
when it is going backwards through
file.\(mine\).
it recognizes the ')' as a normal character, but the '\' is actually a word
delimiter and it then thinks that the ')' starts a new word. So when trying to
complete the expression it looks for files starting with ")." and if there is,
for example, a file ").test", one gets file.\(mine\\).test, which isn't the
right thing to do.
What it should do is recognize the ')' as a word delimiter, realize that the
'\' before that means that it's escaped and use the whole string for the
completion. So one has to add ')' and '}' to the word delimiters. The attached
patched fixed the issue in my experiments.

-- 
You are receiving this mail because:
You are the assignee for the bug.