[Bash-completion-devel] Bug#733815: Modules completion takes a very long time

auil at usp.br auil at usp.br
Tue Dec 31 20:14:25 UTC 2013


Package: bash-completion 
Version: 1:2.0-1 

Problem: The modules completion is performed by this function 

_modules() 
{ 
local modpath 
modpath=/lib/modules/$1 
COMPREPLY=( $( compgen -W "$( command ls -RL $modpath 2>/dev/null | \ 
sed -ne 's/^\(.*\)\.k\{0,1\}o\(\.[gx]z\)\{0,1\}$/\1/p' )" -- "$cur" ) ) 
} 

Because the "-L" option, the command "ls" above follows symbolic links. 

For this reason, the completion of the commands "modinfo" and "modprobe" 
takes a really very long time when you have the symlinks "build" 
and "source" in $modpath. 

These symlinks are automatically added by the kernel's Debian package 
generated by make-kpkg. 


Fix: Just drop the "-L" option in the command "ls". 

Alternatively you can use something like 

find -P $modpath -type f -name '*.ko' 2>/dev/null | \ 
sed -e 's|.*/||g;s/[.]ko$//' 

Regards, 

Fernando Auil 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/bash-completion-devel/attachments/20131231/d0b4c205/attachment.html>


More information about the Bash-completion-devel mailing list