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...
Status: CONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Shell Tools project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-10-20 21:19 UTC by Enne Eziarc
Modified: 2024-03-03 15:26 UTC (History)
1 user (show)

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


Attachments

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 https://forums.gentoo.org/viewtopic-t-1087832.html#8273102, pasted here for your convenience:

_modules()
{
    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, https://github.com/scop/bash-completion/issues/136
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.