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

Re: zkbd fails: must be run as a function or shell script, not sourced



On Thu, 13 Mar 2008 16:28:18 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> If you remove the "2>/dev/null" you get the error message:
> 
> zkbd:5: read-only variable: ARGC
> 
>...
> So although I say "lost PM_HIDE", in point of fact I don't know how it
> had PM_HIDE in the first place.

It didn't.  I think the relevant change is this:

@@ -2033,6 +2033,10 @@
 	 * because we've checked for unpleasant surprises above.
 	 */
 	pm->node.flags = (PM_TYPE(pm->node.flags) | on | PM_SPECIAL) & ~off;
+	/*
+	 * Readonlyness of special parameters must be preserved.
+	 */
+	pm->node.flags |= tpm->node.flags & PM_READONLY;
 	if (newspecial == NS_SECONDS) {
 	    /* We save off the raw internal value of the SECONDS var */
 	    tpm->u.dval = getrawseconds();

So what was happening before was that ARGC wasn't being hidden, it was
staying special but was incorrectly being marked as not readonly, which
doesn't make sense since the special meaning is by definition a readonly
one (and goodness knows what effect changing it had).  It seems to me
therefore that adding the "-h" in zkbd is the pukka thing to do.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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