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

PATCH: Re: Crash of 4.2.0-dev-1



Bart Schaefer wrote:
> I presume of 4.2.0 also.  Reproduce as follows:
>
> (1) Place the following in a file "kshtest" in a directory in fpath:
> 
>     print "Running kshtest"
>     unfunction kshtest
> 
> (2) Run zsh -f and execute:
> 
>     setopt kshautoload
>     autoload +X -k kshtest
>     kshtest
> 
> (3) Observe the [correct] error:
> 
> 	zsh: kshtest: function not defined by file

I wonder if the following is advisable?  I haven't investigated in any
more detail whether it helps.

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.60
diff -u -r1.60 exec.c
--- Src/exec.c	20 Apr 2004 12:11:16 -0000	1.60
+++ Src/exec.c	21 Apr 2004 15:07:31 -0000
@@ -3546,10 +3546,10 @@
     if (prog->flags & EF_RUN) {
 	Shfunc shf;
 
-	runshfunc(prog, NULL, fstack.name);
-
 	prog->flags &= ~EF_RUN;
 
+	runshfunc(prog, NULL, fstack.name);
+
 	if (!(shf = (Shfunc) shfunctab->getnode(shfunctab,
 						(name = fname)))) {
 	    zwarn("%s: function not defined by file", name, 0);

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



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