0

When pressing tab to autocomplete a command (e.g. cd) bash hangs for a couple of seconds before completing it.

  • when using set -x nothing is printed prior to the hang
  • When using a tty console from Ctrl-Alt-FXX there is no lag
  • strace reveals that the problem is in rl_getc:
3428  11:03:21.516869 pselect6(1, [0], NULL, NULL, NULL, {[], 8}) = 1 (in [0]) <3.154249>
 > /lib/x86_64-linux-gnu/libc-2.27.so(pselect+0x59) [0x116dc9]
 > /bin/bash(rl_getc+0xb2) [0xc4032]
 > /bin/bash(rl_read_key+0xc4) [0xc48c4]
 > /bin/bash(readline_internal_char+0x77) [0xad187]
 > /bin/bash(readline+0x45) [0xad945]
 > /bin/bash(reader_loop+0x699) [0x32759]
 > /bin/bash(decode_prompt_string+0x101d) [0x34b3d]
 > /bin/bash(read_secondary_line+0x2aca) [0x37b8a]
 > /bin/bash(yyparse+0x428) [0x3b308]
 > /bin/bash(parse_command+0x36) [0x31ef6]
 > /bin/bash(read_command+0x58) [0x31ff8]
 > /bin/bash(reader_loop+0x119) [0x321d9]
 > /bin/bash(main+0xecf) [0x30c8f]
 > /lib/x86_64-linux-gnu/libc-2.27.so(__libc_start_main+0xe7) [0x21c87]
 > /bin/bash(_start+0x2a) [0x3155a]

(logged with sudo strace -t -k -t -f -T -s9999 -p3428)

I have tried the steps here including uninstalling git and turning my sound off. I have also commented out the contents of my .bashrc to no avail.

Any ideas on what could be the issue here?

  • What is your terminal type? If you run `TERM=dumb` does it help? It **might** be that your terminal definition has function key sequences that start with tab, so bash is waiting to see if there are any more characters to be sent. Does pressing `tab` `tab` help at all? Do you have a `~/.inputrc`? What is the output of `bind -p | grep C-i`? – icarus Nov 19 '22 at 20:50
  • Does this answer your question? [How to debug and fix slow autocomplete in bash?](https://unix.stackexchange.com/questions/70885/how-to-debug-and-fix-slow-autocomplete-in-bash) – AdminBee Apr 19 '23 at 09:17

1 Answers1

0

I am working on macOS with iTerm2. I resolved the issue by checking the "Silence bell" option in iTerm.

Settings > Profiles(Default) > Terminal > Notifications > ✅ Silence bell

See: How to debug and fix slow autocomplete in bash?

AdminBee
  • 21,637
  • 21
  • 47
  • 71
Mekal
  • 101
  • 2