mirror of
https://github.com/zsh-users/zsh
synced 2024-10-07 08:30:06 +00:00
28037: improved error messages for module autoloads
of math functions and builtins
This commit is contained in:
parent
4af11dc57a
commit
e6f14352d6
|
@ -1,5 +1,9 @@
|
|||
2010-06-14 Peter Stephenson <pws@csr.com>
|
||||
|
||||
* 28037: Src/exec.c, Src/math.c, Src/module.c,
|
||||
Test/V01zmodload.ztst: improved error messages for autoloading
|
||||
math functions and builtins (but not conditions).
|
||||
|
||||
* 28010: configure.ac, Src/compat.c: use getcwd() as fallback
|
||||
if zgetcwd() fails.
|
||||
|
||||
|
@ -13285,5 +13289,5 @@
|
|||
|
||||
*****************************************************
|
||||
* This is used by the shell to define $ZSH_PATCHLEVEL
|
||||
* $Revision: 1.5002 $
|
||||
* $Revision: 1.5003 $
|
||||
*****************************************************
|
||||
|
|
|
@ -2274,18 +2274,20 @@ static HashNode
|
|||
resolvebuiltin(const char *cmdarg, HashNode hn)
|
||||
{
|
||||
if (!((Builtin) hn)->handlerfunc) {
|
||||
char *modname = dupstring(((Builtin) hn)->optstr);
|
||||
/*
|
||||
* Ensure the module is loaded and the
|
||||
* feature corresponding to the builtin
|
||||
* is enabled.
|
||||
*/
|
||||
(void)ensurefeature(((Builtin) hn)->optstr, "b:",
|
||||
(void)ensurefeature(modname, "b:",
|
||||
(hn->flags & BINF_AUTOALL) ? NULL :
|
||||
hn->nam);
|
||||
hn = builtintab->getnode(builtintab, cmdarg);
|
||||
if (!hn) {
|
||||
lastval = 1;
|
||||
zerr("unknown builtin: %s", cmdarg);
|
||||
zerr("autoloading module %s failed to define builtin: %s",
|
||||
modname, cmdarg);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -941,8 +941,9 @@ callmathfunc(char *o)
|
|||
zerr("wrong number of arguments: %s", o);
|
||||
}
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
zerr("unknown function: %s", n);
|
||||
}
|
||||
|
||||
dummy.type = MN_INTEGER;
|
||||
dummy.u.l = 0;
|
||||
|
|
|
@ -1273,7 +1273,10 @@ getmathfunc(const char *name, int autol)
|
|||
(void)ensurefeature(n, "f:", (flags & MFF_AUTOALL) ? NULL :
|
||||
name);
|
||||
|
||||
return getmathfunc(name, 0);
|
||||
p = getmathfunc(name, 0);
|
||||
if (!p) {
|
||||
zerr("autoloading module %s failed to define math function: %s", n, name);
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@
|
|||
print "Shouldn't get here.")
|
||||
1:Failed builtin autoload
|
||||
?(eval):3: module `zsh/parameter' has no such feature: `b:fail': autoload cancelled
|
||||
?(eval):3: unknown builtin: fail
|
||||
?(eval):3: autoloading module zsh/parameter failed to define builtin: fail
|
||||
|
||||
(zmodload -u zsh/parameter
|
||||
zmodload -aF zsh/parameter p:fail
|
||||
|
@ -158,7 +158,7 @@
|
|||
(( fail() )) )
|
||||
2:Failed math function autoload
|
||||
?(eval):3: module `zsh/parameter' has no such feature: `f:fail': autoload cancelled
|
||||
?(eval):3: unknown function: fail
|
||||
?(eval):3: autoloading module zsh/parameter failed to define math function: fail
|
||||
|
||||
zmodload -aF zsh/parameter f:fail2
|
||||
1:Immediate autoload failure on non-existent feature when module loaded
|
||||
|
|
Loading…
Reference in a new issue