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

PATCH: Re: missing -o kshautoload checks



Bart Schaefer wrote:

> ...
> 
> I haven't actually tried it, but I'm pretty sure that if you `zcompile -z'
> a file that ends with `[[ -o kshautoload ]] && $0 "$@"', and you have
> kshautoload set, you'll end up executing the function *twice* the first
> time it's autoloaded.  So really we should be *removing* all the checks
> for kshautoload, not adding more of them.

No, it is *not* executed on the first call. Ok, it is executed, but
one won't see that because it only redefines itself (and any helper
functions).


I have to apologise for not removing the kshautoload tests when I
added the `zcompile -z' description.

The hunk in exec.c fixes a real bug: with a function that redefines
itself we can't use the old shfunc structure to get the name to store
in scriptname.

Bye
 Sven

Index: Completion/Bsd/_bsd_pkg
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Bsd/_bsd_pkg,v
retrieving revision 1.2
diff -u -r1.2 _bsd_pkg
--- Completion/Bsd/_bsd_pkg	2000/05/16 16:21:33	1.2
+++ Completion/Bsd/_bsd_pkg	2000/08/01 08:24:01
@@ -65,4 +65,4 @@
   esac
 }
 
-[[ -o kshautoload ]] || _bsd_pkg "$@"
+_bsd_pkg "$@"
Index: Completion/Bsd/_kld
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Bsd/_kld,v
retrieving revision 1.1
diff -u -r1.1 _kld
--- Completion/Bsd/_kld	2000/04/20 09:45:04	1.1
+++ Completion/Bsd/_kld	2000/08/01 08:24:01
@@ -38,4 +38,4 @@
   esac
 }
 
-[[ -o kshautoload ]] || _kld "$@"
+_kld "$@"
Index: Completion/Commands/_next_tags
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Commands/_next_tags,v
retrieving revision 1.7
diff -u -r1.7 _next_tags
--- Completion/Commands/_next_tags	2000/06/07 06:47:40	1.7
+++ Completion/Commands/_next_tags	2000/08/01 08:24:01
@@ -138,4 +138,4 @@
   fi
 }
 
-[[ -o kshautoload ]] || _next_tags "$@"
+_next_tags "$@"
Index: Completion/User/_cvs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_cvs,v
retrieving revision 1.11
diff -u -r1.11 _cvs
--- Completion/User/_cvs	2000/07/20 16:13:21	1.11
+++ Completion/User/_cvs	2000/08/01 08:24:01
@@ -817,4 +817,4 @@
   }
 }
 
-[[ -o kshautoload ]] || _cvs "$@"
+_cvs "$@"
Index: Completion/User/_mailboxes
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_mailboxes,v
retrieving revision 1.4
diff -u -r1.4 _mailboxes
--- Completion/User/_mailboxes	2000/06/22 04:11:35	1.4
+++ Completion/User/_mailboxes	2000/08/01 08:24:01
@@ -175,4 +175,4 @@
   return ret
 }
 
-[[ -o kshautoload ]] || _mailboxes "$@"
+_mailboxes "$@"
Index: Completion/X/_xset
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/_xset,v
retrieving revision 1.3
diff -u -r1.3 _xset
--- Completion/X/_xset	2000/05/06 07:59:53	1.3
+++ Completion/X/_xset	2000/08/01 08:24:01
@@ -195,4 +195,4 @@
   _xset_parse
 }
 
-[[ -o kshautoload ]] || _xset "$@"
+_xset "$@"
Index: Completion/X/_xwit
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/_xwit,v
retrieving revision 1.5
diff -u -r1.5 _xwit
--- Completion/X/_xwit	2000/05/06 07:59:53	1.5
+++ Completion/X/_xwit	2000/08/01 08:24:01
@@ -173,4 +173,4 @@
   _xwit_parse
 }
 
-[[ -o kshautoload ]] || _xwit "$@"
+_xwit "$@"
Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.14
diff -u -r1.14 exec.c
--- Src/exec.c	2000/07/27 17:48:48	1.14
+++ Src/exec.c	2000/08/01 08:24:02
@@ -3189,7 +3189,7 @@
 	return 1;
 
     oldscriptname = scriptname;
-    scriptname = dupstring(state->prog->shf->nam);
+    scriptname = dupstring(shf->nam);
     execode(shf->funcdef, 1, 0);
     scriptname = oldscriptname;
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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