Hi, thanks for the report.

On 25 Nov 2018, Timo Weingärtner wrote:

>with the last upgrade of bash-completion completing hostnames has
>become slow (takes more than two seconds). My /etc/ssh/ssh_known_hosts
>file has quite some size (23084 lines / 12 MB), but this was not a
>problem with the previous implementation.

OK, sounds like a lot of time.

>I guess the problem is the while read … done < known_hosts_file loop,
>where the shell has to read() one byte at a time, causing a massive
>amount of syscalls (which have become even more costly this year).

I have backported a patch [1] from the upstream master branch, in order
to fix bug #848125 [2].  Running the following command against current
upstream sources shows that there are no newer patches related to this
(lines 1479 to 1665 contain the function, _known_hosts_real, that
parses the known_hosts file):

  git log --stat -L1479,1665:bash_completion
  (lastest commit is the patch that I backported [1])

I think we need to forward this problem report upstream.  Do you have
more information that I could add to it (maybe the syscall trace you
ran)?

PS: I don't want to remove the patch from Debian, because it would only
solve the problem you are reporting until bash-completion 2.9 is
released.

[1] 
https://github.com/scop/bash-completion/commit/71ac42b98c0eba39819fb8478d6443032c6ef6f1
[2] https://bugs.debian.org/848125

Reply via email to