Bash tab-completion in 18.06.1 not working correctly

Hey guys, I have a question. I upgraded from 15.05 to 18.06 and one thing that i have noticed is that using TAB in bash is not working ( yes , bash! not ash ).
Example:

cd /et<TAB> will auto complete to /etc/, but it if use two more tabs to list the contents of  /etc, it will not work.

Anyone knows why ?

Have you checked that all the bash completion scripts have been installed and are being source-d when you connect?

Hi @jeff, i am not talking about bash-completion scripts. I am talking about the most basic feature of bash, list contents of a directory by double tab.

OpenWrt does not use bash but busybox ash instead.

Edit: I also did a quick test on my Debian box here and it does not list directory contents either when pressing double tab. In fact I don't recall my shell ever doing that. Mine lists available exectuable commands when pressing double tab.

Hey @jow, i know openwrt uses busybox ash, but i am using the bash feed.

About the list contents, yes it does.
Try
ls -l /op<TAB><TAB><TAB>, The first tab will complete the /op to /opt/ and the following two will show the directory content so you know how to complete.
Actually even ash has support for this. ( i just do not remember if it it disabled by default or not )

Thanks !

Ah you're talking about tab completion. That works as expected for me on 18.06.1

1 Like

@jow, in ash i think it works, but it is broken in bash. ( Is it working for you in bash ? )

No idea, I don't use bash on OpenWrt.

Edit: I now noticed your original post is about bash, so please disregard my comments. Consider opening a bug in the packages feed.

Thanks ! Maybe someone who is using answer here =) . but i have no idea why it is not working.

Searching answer but only here:sweat:

https://github.com/scop/bash-completion is probably what you're looking for (not packaged)

Sorry to revive this thread, but I have searched and it is the most recent one with the problem. I just updated (reinstall, no keep-config!) from LEDE 17 to latest stable 18.06.4 and have the same problem. This is NOT about the default shell, ASH, but the packaged and available to install BASH. It worked before LEDE, as I had openwrt designated driver working good before, too.

The completion of commands and filenames works, ONLY if there is only a single match (i.e. you type tcpdu and it completes to tcpdump). The ALT+= combo works too.

It is not a xterm thing as I have tried to login from the TTY too (TERM=linux).

Has to be something that changed with the 18.06 bash package compile flags or terminal settings, or a default package that was installed before as a dependency and now it's not.

Edit: Google fu "bash ambiguous" found it elsewhere! Has something to do with readline defaults. Putting it here so anybody else can benefit.

bind "set show-all-if-ambiguous on"
4 Likes

Thanks ! Really helpful !

 -----------------------------------------------------
 OpenWrt 18.06.2, r7676-cddd7b4c77
 -----------------------------------------------------
root@OpenWrt:~#  head -n 1 /etc/passwd 
root:x:0:0:root:/root:/bin/bash
root@OpenWrt:~#  ls -l /usr/bin/<TAB> # nothing shows up here
root@OpenWrt:~#  bind "set show-all-if-ambiguous on"
root@OpenWrt:~#  ls -l /usr/bin/<TAB> # works fine
Display all 131 possibilities? (y or n)^C

I put these line in ~/.inputrc too:

root@OpenWrt:~#  cat ~/.inputrc  
set show-all-if-ambiguous on
set completion-ignore-case on

Note:
I turn to oh-my-zsh months ago, it's more powerful.

1 Like

Just as a warning, setting bash as login shell for root comes with the danger to soft-brick your device over sysupgrades (as /bin/bash is lost over the sysupgrade, while /etc/passwd and friends remain, referring to a non-existent binary as root's shell).

5 Likes