diff options
author | Bart Schaefer <barts@users.sourceforge.net> | 2001-07-09 16:20:03 +0000 |
---|---|---|
committer | Bart Schaefer <barts@users.sourceforge.net> | 2001-07-09 16:20:03 +0000 |
commit | 1f62b5acbe4a6e5c2c1f704ab1dcfd207afe9919 (patch) | |
tree | c4696fbdd7fd0d8aead8f734011590e785d251b2 | |
parent | be4592f7dcf8b4427320cc4ef4b009d6a4aab47f (diff) | |
download | zsh-1f62b5acbe4a6e5c2c1f704ab1dcfd207afe9919.tar.gz zsh-1f62b5acbe4a6e5c2c1f704ab1dcfd207afe9919.tar.xz zsh-1f62b5acbe4a6e5c2c1f704ab1dcfd207afe9919.zip |
Fix function stack unwinding on autoload failures.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | Src/exec.c | 13 |
2 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog index a9d86fc27..008d2c5b9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2001-07-09 Bart Schaefer <schaefer@zsh.org> + + * 15321: Src/exec.c: Fix line numbers in an error message; unwind + function context properly on obscure autoloading failures. + 2001-07-07 Bart Schaefer <schaefer@zsh.org> * 15308: Src/builtin.c: Fix infinite loop on `r OLD=NEW' when OLD diff --git a/Src/exec.c b/Src/exec.c index 426d151b5..071dee7cc 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -3264,7 +3264,10 @@ loadautofn(Shfunc shf, int fksh, int autol) execode(prog, 1, 0); shf = (Shfunc) shfunctab->getnode(shfunctab, n); if (!shf || (shf->flags & PM_UNDEFINED)) { + /* We're not actually in the function; decrement locallevel */ + locallevel--; zwarn("%s: function not defined by file", n, 0); + locallevel++; popheap(); return NULL; } @@ -3350,9 +3353,7 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval) if(++funcdepth > MAX_FUNCTION_DEPTH) { zerr("maximum nested function level reached", NULL, 0); - scriptname = oldscriptname; - popheap(); - return; + goto undoshfunc; } #endif fstack.name = dupstring(name); @@ -3373,15 +3374,15 @@ doshfunc(char *name, Eprog prog, LinkList doshargs, int flags, int noreturnval) errflag = 1; else lastval = 1; - popheap(); - scriptname = oldscriptname; - return; + goto doneshfunc; } prog = shf->funcdef; } runshfunc(prog, wrappers, fstack.name); + doneshfunc: funcstack = fstack.prev; #ifdef MAX_FUNCTION_DEPTH + undoshfunc: --funcdepth; #endif if (retflag) { |