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

Re: Bug with _parameters and zmodload



Oliver Kiddle wrote:
> When I upgraded to 3.1.6-pws-2 (from 3.1.6-test-2 - I've been busy recently s
> o haven't upgraded for a while), I got a number of error messages of the foll
> owing 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.

This should fix this part.  The modules were trying to unset any existing
parameters when they installed their own.  The existing parameters were the
autoloadable ones, and it tried to autoload the parameter to unset it, which
it was already in the middle of doing so it couldn't.  The simplest fix is
to retrieve the existing param struct without autoloading and unset that.

I haven't touched the completion functions.  Probably there's no harm in
_parameters loading the parameter module to use to check the parameters,
since if it's autoloadable that should mean it's available for use in this
sort of context, but that's different from the real problem.

--- Src/Modules/mapfile.c.us	Mon Jul 19 18:05:29 1999
+++ Src/Modules/mapfile.c	Wed Sep  1 17:50:22 1999
@@ -83,7 +83,8 @@
     Param pm;
     HashTable ht;
 
-    unsetparam(mapfile_nam);
+    if ((pm = (Param) gethashnode2(paramtab, mapfile_nam)))
+	unsetparam_pm(pm, 0, 1);
     mapfile_pm = NULL;
 
     if (!(pm = createparam(mapfile_nam, PM_SPECIAL|PM_REMOVABLE|PM_HASHED)))
--- Src/Modules/parameter.c.us	Wed Sep  1 17:58:34 1999
+++ Src/Modules/parameter.c	Wed Sep  1 18:03:03 1999
@@ -617,23 +617,28 @@
      * As an example for autoloaded parameters, this is probably a bad
      * example, because we the zsh core doesn't support creation of
      * special hashes, yet. */
+    Param pm;
 
-    unsetparam(PAR_NAM);
+    if ((pm = (Param) gethashnode2(paramtab, PAR_NAM)))
+	unsetparam_pm(pm, 0, 1);
     if (!(parpm = createspecialhash(PAR_NAM, getpmparameter,
 				    scanpmparameters)))
 	return 1;
     parpm->flags |= PM_READONLY;
-    unsetparam(CMD_NAM);
+    if ((pm = (Param) gethashnode2(paramtab, CMD_NAM)))
+	unsetparam_pm(pm, 0, 1);
     if (!(cmdpm = createspecialhash(CMD_NAM, getpmcommand,
 				    scanpmcommands)))
 	return 1;
     cmdpm->sets.hfn = setpmcommands;
-    unsetparam(FUN_NAM);
+    if ((pm = (Param) gethashnode2(paramtab, FUN_NAM)))
+	unsetparam_pm(pm, 0, 1);
     if (!(funpm = createspecialhash(FUN_NAM, getpmfunction,
 				    scanpmfunctions)))
 	return 1;
     funpm->sets.hfn = setpmfunctions;
-    unsetparam(OPT_NAM);
+    if ((pm = (Param) gethashnode2(paramtab, OPT_NAM)))
+	unsetparam_pm(pm, 0, 1);
     if (!(optpm = createspecialhash(OPT_NAM, getpmoption,
 				    scanpmoptions)))
 	return 1;

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



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