Bug 254789 - Tab completion acts differently in sh than csh when a directory name contains a space
Summary: Tab completion acts differently in sh than csh when a directory name contains...
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: misc (show other bugs)
Version: Unspecified
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-04-05 13:54 UTC by Patrick McMunn
Modified: 2021-04-16 21:47 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick McMunn 2021-04-05 13:54:41 UTC
I first noticed this issue while using FreeBSD 13-RC4. It is still present in RC5. However because the bug is kind of subtle, it's possible it's been there a while and I just never noticed it. In any case, the behavior I expect from tab completion in the terminal is that a tab will complete a filename and enter a space automatically after the filename, but if tab completion fills out a directory name, it will put a forward slash after the directory name with no space. This is useful because an additional tab can be used to fill out additional elements in a path.

However, I noticed that if a directory name contains a space, a tab will complete the directory name and automatically put a space at the end with no forward slash. In other words, it treats a directory name with a space the same as it treats a filename. This is annoying when trying to use tab to complete a path name with multiple elements because it requires a backspace and a forward slash before using tab again.

But this bug only affects regular users and not root. Apparently this is because regular users use sh by default while root uses csh by default. If I type "csh" at the command line as a regular user to open a new shell, I get the expected behavior back. Also, even in sh, if a path name is prepended with double quotes, a tab will fill in a forward slash and no space at the end even when a space exists in a directory name. So this is currently the workaround.
Comment 1 Piotr Pawel Stefaniak freebsd_committer 2021-04-05 14:27:14 UTC
I believe that's a bug in libedit that was squashed 8 days ago: https://github.com/NetBSD/src/commit/e1238f5879df3108e50da5f57d2bd4c409553ceb
and quickly imported to main: https://cgit.FreeBSD.org/src/commit/?id=19318a62d7f8cfe2f0f5c24178fa33e8844ae5d1
Comment 2 Patrick McMunn 2021-04-16 21:47:25 UTC
This issue is still present in 13-RELEASE.