zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@sunsite.dk>
Subject: Re: zkbd fails: must be run as a function or shell script, not sourced
Date: Thu, 13 Mar 2008 16:28:18 -0700	[thread overview]
Message-ID: <080313162818.ZM21832@torch.brasslantern.com> (raw)
In-Reply-To: <20080313202748.GV30518@fsst.voodoo.lan>

On Mar 13,  9:27pm, Frank Terbeck wrote:
}
} The zkbd function currently fails to start. In particular, it seems to
} be the following test (I don't actually understand how that test works
} at all :-):
} 
} [snip]
} [[ -o interactive ]] && {
}     local -i ARGC
}     (ARGC=0) 2>/dev/null || {
}         print -u2 ${0}: must be run as a function or shell script, not sourced
}         return 1
}     }
} }
} [snap]

If you remove the "2>/dev/null" you get the error message:

zkbd:5: read-only variable: ARGC

The trick here is that, at the top level of the shell, declaring ARGC to
be local is a no-op.  Inside a function, however, declaring it local is
creating a new parameter, which should lose its read-only-ness.  Somehow
ARGC has lost the PM_HIDE attribute.

Changing "local -i ARGC" to "local -ih ARGC" to explicitly hide the
special-ness of ARGC will make zkbd work again, but I am puzzled as to
why it suddenly became necessary to include "-h".  The call signature
of load_module() changed a bit and consequently so did module.c, but
I can't see how that would have changed the way the builtin special
parameters are created; the IPDEF1 macro and its usage for ARGC have
not changed in quite some time.

So although I say "lost PM_HIDE", in point of fact I don't know how it
had PM_HIDE in the first place.


  parent reply	other threads:[~2008-03-13 23:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-13 20:27 Frank Terbeck
2008-03-13 20:35 ` Mikael Magnusson
2008-03-13 20:52   ` Frank Terbeck
2008-03-13 23:28 ` Bart Schaefer [this message]
2008-03-14 19:57   ` Peter Stephenson

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=080313162818.ZM21832@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@sunsite.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).