From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28706 invoked from network); 4 Sep 2009 23:14:16 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) 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.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 4 Sep 2009 23:14:16 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 50483 invoked from network); 4 Sep 2009 23:14:09 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 4 Sep 2009 23:14:09 -0000 Received: (qmail 982 invoked by alias); 4 Sep 2009 23:14:04 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27242 Received: (qmail 942 invoked from network); 4 Sep 2009 23:14:03 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 4 Sep 2009 23:14:03 -0000 Received: from QMTA14.westchester.pa.mail.comcast.net (qmta14.westchester.pa.mail.comcast.net [76.96.59.212]) by bifrost.dotsrc.org (Postfix) with ESMTP id 0A67E801E2BF for ; Sat, 5 Sep 2009 01:13:56 +0200 (CEST) Received: from OMTA12.westchester.pa.mail.comcast.net ([76.96.62.44]) by QMTA14.westchester.pa.mail.comcast.net with comcast id cmaW1c0060xGWP85EnDwcQ; Fri, 04 Sep 2009 23:13:56 +0000 Received: from smtp.klanderman.net ([98.217.254.247]) by OMTA12.westchester.pa.mail.comcast.net with comcast id cnDw1c0035M2Np63YnDwPR; Fri, 04 Sep 2009 23:13:56 +0000 Received: from lwm.klanderman.net (unknown [192.168.100.50]) by smtp.klanderman.net (Postfix) with ESMTP id E2C6EB30147; Fri, 4 Sep 2009 19:13:54 -0400 (EDT) Received: by lwm.klanderman.net (Postfix, from userid 500) id BEB9B9FC5EB; Fri, 4 Sep 2009 19:13:54 -0400 (EDT) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19105.40754.702800.164855@gargle.gargle.HOWL> Date: Fri, 4 Sep 2009 19:13:54 -0400 From: Greg Klanderman To: Zsh list Subject: bug in 'b' array parameter subscript flag Reply-To: gak@klanderman.net X-Mailer: VM 7.17 under 21.4 (patch 17) "Jumbo Shrimp" XEmacs Lucid X-Virus-Scanned: ClamAV 0.94.2/9777/Sat Sep 5 00:17:01 2009 on bifrost X-Virus-Status: Clean when the 'b' flag is used with the 'i' flag, and there are no elements to be searched, '0' is incorrectly returned rather than one plus the array length: [~] phl| zsh -f phl% echo $ZSH_VERSION 4.3.10-dev-1 phl% echo $ZSH_PATCHLEVEL 1.4718 phl% unsetopt ksharrays phl% a=(bar) phl% echo $#a 1 phl% echo ${a[(ib:2:)foo]} ## BUG: this should return 2 0 phl% echo ${a[(i)foo]} ## just like this 2 the 'b' flag works correctly when the number of elements to be searched is non-zero: phl% a=(bar baz) phl% echo $#a 2 phl% echo ${a[(ib:2:)foo]} 3 also, the 'i' flag alone, with no elements to search works correctly: phl% a=() phl% echo $#a 0 phl% echo ${a[(i)foo]} 1 cheers, greg