From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11368 invoked from network); 13 Mar 2008 23:28:38 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 13 Mar 2008 23:28:38 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 57688 invoked from network); 13 Mar 2008 23:28:31 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 13 Mar 2008 23:28:31 -0000 Received: (qmail 10539 invoked by alias); 13 Mar 2008 23:28:27 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24709 Received: (qmail 10523 invoked from network); 13 Mar 2008 23:28:27 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 13 Mar 2008 23:28:27 -0000 Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by bifrost.dotsrc.org (Postfix) with ESMTP id 8E63280307F7 for ; Fri, 14 Mar 2008 00:28:22 +0100 (CET) Received: from torch.brasslantern.com ([71.116.105.150]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JXO008UMZV7PXA4@vms046.mailsrvcs.net> for zsh-workers@sunsite.dk; Thu, 13 Mar 2008 18:28:20 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id m2DNSIKt021834 for ; Thu, 13 Mar 2008 16:28:19 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id m2DNSIHu021833 for zsh-workers@sunsite.dk; Thu, 13 Mar 2008 16:28:18 -0700 Date: Thu, 13 Mar 2008 16:28:18 -0700 From: Bart Schaefer Subject: Re: zkbd fails: must be run as a function or shell script, not sourced In-reply-to: <20080313202748.GV30518@fsst.voodoo.lan> To: zsh workers Message-id: <080313162818.ZM21832@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <20080313202748.GV30518@fsst.voodoo.lan> Comments: In reply to Frank Terbeck "zkbd fails: must be run as a function or shell script, not sourced" (Mar 13, 9:27pm) X-Virus-Scanned: ClamAV 0.91.2/6225/Thu Mar 13 15:52:37 2008 on bifrost X-Virus-Status: Clean 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.