zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: PATCH: Re: missing -o kshautoload checks
Date: Tue, 1 Aug 2000 10:25:18 +0200 (MET DST)	[thread overview]
Message-ID: <200008010825.KAA06563@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Bart Schaefer"'s message of Tue, 1 Aug 2000 07:12:36 +0000


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@informatik.hu-berlin.de


             reply	other threads:[~2000-08-01  8:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-01  8:25 Sven Wischnowsky [this message]
2000-08-01 14:15 ` Bart Schaefer
2000-08-01 14:23 Sven Wischnowsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200008010825.KAA06563@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).