You are not logged in.
Hi,
Since last zsh update, I can't get 'modinfo' & 'modprobe' completion, only 'rmmod' & 'modprobe -r' are working actually (easy with '/proc/modules'). It seems that a new caching algorithm was implemented in the last version but I don't understand it . Diff with zsh 4.3.11 _modutils :
--- Sources/zsh-4.3.11/Completion/Linux/Command/_modutils 2009-07-14 10:57:13.000000000 +0200(B
+++ /usr/share/zsh/functions/Completion/Linux/_modutils 2011-06-02 13:02:04.000000000 +0200(B
@@ -1,8 +1,23 @@(B
#compdef lsmod modinfo modprobe rmmod insmod
+_modules_caching_policy()(B
+{(B
+ # Rebuild every week, or if $modules_dir is newer than the cache(B
+ local -a oldp(B
+(B
+ oldp=( "$1"(Nmw+1) )(B
+ (( $#oldp )) || [[ $modules_dir -nt $1 ]](B
+}(B
+(B
local curcontext="$curcontext" expl state line modules ign args ret=1
local -r modules_dir=/lib/modules
+local update_policy(B
+zstyle -s ":completion:*:*:$service:*" cache-policy update_policy(B
+if [[ -z "$update_policy" ]]; then(B
+ zstyle ":completion:*:*:$service:*" cache-policy _modules_caching_policy(B
+fi(B
+(B
args=(
'(-)'{-V,--version}'[print version]'
'(-)'{-h,--help}'[print help text]'
@@ -39,6 +54,7 @@(B
"(-v --verbose $ign)"{-v,--verbose}'[print all commands as executed]' \
'(-C --config)'{-C,--config}'[specify config file]:config file:_files' \
"(-r --remove -l --list -t --type -a --all $ign)"{-r,--remove}'[remove module (stacks)]' \
+ "(-l --list -t --type -a --all $ign)"{'-i[ignore install/remove commands in config file]','--ignore-install[ignore install commands in config file]','--ignore-remove[ignore remove commands in config file]'} \(B
"(* -l --list -r --remove $ign)"{-l,--list}'[list matching modules]' \
"(-c $ign)1:modules:->loadable_modules" \
"(-c -l --list -t --type $ign)*:params:->params" && ret=0
@@ -87,7 +103,13 @@(B
else
kver=$(uname -r)
fi
- modules=( $modules_dir/$kver/(*~(source|build))/**/*(.:t:r) )(B
+ if [[ -z $modules ]] && ! _cache_invalid modules-$kver && \(B
+ ! _retrieve_cache modules-$kver;(B
+ then (B
+ # 2011-01-02 gi1242: Do we need .o files? Or is .ko enough?(B
+ modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko)(.:t:r) )(B
+ _store_cache modules-$kver modules(B
+ fi(B
if [[ $state = loadable_modules ]]; then
modules=( ${modules:#(${(j:|:)~${=loaded_modules//_/-}})} )
Last edited by Drexya (2011-06-13 01:46:34)
Sorry for my poor english.
Offline
I noticed this too. From what I understood, the zsh completion searches for modules as .ko files in /lib/modules for modprobe and modinfo, while the latest Arch kernel actually gzips the module files into .ko.gz
To fix this, change the line from /usr/share/zsh/functions/Completion/Linux/_modutils where it says (you should be able to find it again by searching for ko)
modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko)(.:t:r) )
to this:
modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko|ko.gz)(.:t:r) )
Works just fine for me now.
Last edited by paranoos (2011-06-12 23:18:44)
Offline
I think this is worth a bug report!
Offline
Wow, thanks it works, but there's a problem, modules appears with *.ko suffix so
modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko|ko.gz)(.:t:r:r) )
is even better .
taken from http://zsh.sourceforge.net/Guide/zshguide05.html :
print ${p:t:r}
will work for both arrays and scalars: the :t takes only the tail of the filename, stripping the directories, and the :r removes the suffix. These two operators could have slightly unexpected effects in versions of zsh before 4.0.1, removing `suffixes' which contained directory paths, for example (though this is what the pattern forms taken separately do, too).
Last edited by Drexya (2011-06-13 01:45:45)
Sorry for my poor english.
Offline