Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 669128 - app-shells/bash-completion-2.8 - extremely slow and wrong kernel module tab completion
Summary: app-shells/bash-completion-2.8 - extremely slow and wrong kernel module tab c...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michał Górny
Depends on:
Reported: 2018-10-20 21:19 UTC by Enne Eziarc
Modified: 2020-02-21 07:03 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Note You need to log in before you can comment on or make changes to this bug.
Description Enne Eziarc 2018-10-20 21:19:12 UTC
The "_modules" helper function in /usr/share/bash-completion/bash-completion does a crude recursive ls of the module directory, recursing into both the ./source and ./build symlinks if present (and ./build/source for out-of-tree builds), and then includes all .o files from the build tree in the results. This makes the terminal non-responsive for several minutes on my machine, and the output is pretty much useless for commands like modprobe.

I hacked together a more correct version in, pasted here for your convenience:

    COMPREPLY=( $( compgen -W "$(shopt -s globstar failglob
        printf '%s\n' /lib/modules/"${1:?}"/!(source|build)/**/*.@(o|ko|ko.gz|ko.xz) | \
        sed -e 's@^.*/\(.*\)\.k\?o\(\.[gx]z\)\?@\1@' )" -- "$cur" ) )

There's already an open bug upstream for the slowness,
However, given they haven't bothered to ack it in 15 months, maybe it'd be appropriate for the ebuild to apply this fix, as it's more likely to affect Gentoo users than binary distros.