From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14348 invoked from network); 27 Feb 2008 15:31:03 -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=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; 27 Feb 2008 15:31:03 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 58977 invoked from network); 27 Feb 2008 15:30:56 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 27 Feb 2008 15:30:56 -0000 Received: (qmail 16630 invoked by alias); 27 Feb 2008 15:30:52 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24611 Received: (qmail 16617 invoked from network); 27 Feb 2008 15:30:52 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 27 Feb 2008 15:30:52 -0000 Received: from cluster-d.mailcontrol.com (cluster-d.mailcontrol.com [217.69.20.190]) by bifrost.dotsrc.org (Postfix) with ESMTP id 379A48026E0B for ; Wed, 27 Feb 2008 16:30:44 +0100 (CET) Received: from rly07d.srv.mailcontrol.com (localhost.localdomain [127.0.0.1]) by rly07d.srv.mailcontrol.com (MailControl) with ESMTP id m1RFUfUL010625 for ; Wed, 27 Feb 2008 15:30:42 GMT Received: from submission.mailcontrol.com (submission.mailcontrol.com [86.111.216.190]) by rly07d.srv.mailcontrol.com (MailControl) id m1RFU9Qa007443 for zsh-workers@sunsite.dk; Wed, 27 Feb 2008 15:30:09 GMT Received: from dalamsexb02.AMERICAS.ROOT.PRI ([65.208.56.47]) by rly07d-eth0.srv.mailcontrol.com (envelope-sender Peter.Stephenson@csr.com) (MIMEDefang) with ESMTP id m1RFTpiw006332; Wed, 27 Feb 2008 15:30:05 +0000 (GMT) Received: from cameurexb01.EUROPE.ROOT.PRI ([10.100.137.61]) by dalamsexb02.AMERICAS.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Wed, 27 Feb 2008 09:29:58 -0600 Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Wed, 27 Feb 2008 15:29:57 +0000 Date: Wed, 27 Feb 2008 15:29:57 +0000 From: Peter Stephenson To: zsh-workers@sunsite.dk Cc: 466655@bugs.debian.org Subject: Re: Bug#466655: the expression {x=(); echo ${+x[(r)blah]}} changes meaning between 4.3.2 and current version Message-ID: <20080227152957.4413579d@news01> In-Reply-To: <20080227143540.GB8314@scowler.net> References: <20080220070905.7276.65390.reportbug@localhost.localdomain> <20080227143540.GB8314@scowler.net> Organization: CSR X-Mailer: Claws Mail 3.3.0 (GTK+ 2.12.5; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 27 Feb 2008 15:29:57.0377 (UTC) FILETIME=[9BD68F10:01C87955] X-Scanned-By: MailControl A-08-00-04 (www.mailcontrol.com) on 10.68.1.117 X-Virus-Scanned: ClamAV 0.91.2/6010/Wed Feb 27 13:54:14 2008 on bifrost X-Virus-Status: Clean On Wed, 27 Feb 2008 09:35:40 -0500 Clint Adams wrote: > On Wed, Feb 20, 2008 at 07:09:05AM +0000, Frederik Eaton wrote: > > Hello, one of my scripts has broken because of the following change: > > > > $ zsh --version > > zsh 4.3.2 (i686-pc-linux-gnu) > > $ x=(); echo ${+x[(r)blah]} > > 0 > > > > $ zsh --version > > zsh 4.3.5 (i686-pc-linux-gnu) > > $ x=(); echo ${+x[(r)blah]} > > 1 > > > > Is the behaviour of zsh's parameter expansion supposed to be stable? > > I think this is related to 23273* No, this is unexpected fallout from the changes to make zero subscripts behave in a more rational fashion, 23562. I hadn't even remembered this form worked with subscripts, but the the manual certainly suggests it should (and it's definitely useful). I've added a test that should keep it working. Index: Src/subst.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/subst.c,v retrieving revision 1.82 diff -u -r1.82 subst.c --- Src/subst.c 16 Dec 2007 14:05:16 -0000 1.82 +++ Src/subst.c 27 Feb 2008 15:28:41 -0000 @@ -1915,7 +1915,8 @@ hkeys|hvals| (arrasg ? SCANPM_ASSIGNING : 0)| (qt ? SCANPM_DQUOTED : 0))) || - (v->pm && (v->pm->node.flags & PM_UNSET))) + (v->pm && (v->pm->node.flags & PM_UNSET)) || + (v->flags & VALFLAG_EMPTY)) vunset = 1; if (wantt) { Index: Test/D04parameter.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/D04parameter.ztst,v retrieving revision 1.29 diff -u -r1.29 D04parameter.ztst --- Test/D04parameter.ztst 30 Oct 2007 14:01:35 -0000 1.29 +++ Test/D04parameter.ztst 27 Feb 2008 15:28:41 -0000 @@ -52,6 +52,14 @@ 0:$+... >1 1 0 0 + x=() + print ${+x} ${+x[1]} ${+x[(r)foo]} ${+x[(r)bar]} + x=(foo) + print ${+x} ${+x[1]} ${+x[(r)foo]} ${+x[(r)bar]} +0:$+... with arrays +>1 0 0 0 +>1 1 1 0 + set1=set1v null1= print ${set1:-set1d} ${set1-set2d} ${null1:-null1d} ${null1-null2d} x -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070