Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Bug with _parameters and zmodload



When I upgraded to 3.1.6-pws-2 (from 3.1.6-test-2 - I've been busy recently so haven't upgraded for a while), I got a number of error messages of the following form:

_parameters: mapfile: autoload failed [43]

I get it for each of parameters, functions, options, commands and mapfile the first time I try to expand a variable after running zsh. After this it all works and the mapfile and parameter modules are loaded. The problem is a result of my having used zmodload -ap for the parameters in these modules in my .zshrc. I put it there so that the modules would be autoloaded if I tried to use them.

_parameters correctly determines that the parameters modules is not loaded (with zmodload -e) so uses typeset + to generate the list of parameters. This is fine but note that the list of parameters includes mapfile, parameters, functions etc which are all 'undefined'. Then on line 43 (as in the error message), _parameters goes on to divide the parameters into directories and not directories. When it reaches the undefined parameters (mapfile etc), it attempts to autoload the modules. This it ofcourse should not do - it should probably assume that the parameters aren't directories. I've got no idea why it prints an error message about failing to load the module, especially as it clearly does load the module.

My first thought on a fix for this was to change line 43 to something like:

if [[ ${(Pt)i} = undefined* ]] || [[ -d ${(P)i} ]]; then

(and swap the then/else parts arround) but this will return association or whatever after loading the module. The alternative is to use typeset but I haven't done a patch because there is probably a cleaner solution. A quick-fix would be to remove undefined parameters from the list of parameters as generated by typeset +.

The separate problem of the bogus autoload failed error message seems to only occur with autoloaded parameters - zftp etc (with zmodload -a zftp) has no such problems.

Another unrelated problem I have found is that the completion matching control to complete partial directories doesn't work when variables are used:
I'd expect:
cd $code[ai]/R/drop.1.34<tab>
to complete to:
cd $code[ai]/Releases/drop.1.34.0.rel/
but it doesn't.

Oliver



Messages sorted by: Reverse Date, Date, Thread, Author