From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15834 invoked from network); 23 Jan 2007 13:11:18 -0000 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00, FORGED_RCVD_HELO autolearn=ham version=3.1.7 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 23 Jan 2007 13:11:18 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 75013 invoked from network); 23 Jan 2007 13:11:11 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 23 Jan 2007 13:11:11 -0000 Received: (qmail 16545 invoked by alias); 23 Jan 2007 13:11:09 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23126 Received: (qmail 16528 invoked from network); 23 Jan 2007 13:11:08 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 23 Jan 2007 13:11:08 -0000 Received: (qmail 74726 invoked from network); 23 Jan 2007 13:11:08 -0000 Received: from cluster-c.mailcontrol.com (168.143.177.190) by a.mx.sunsite.dk with SMTP; 23 Jan 2007 13:11:01 -0000 Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly07c.srv.mailcontrol.com (MailControl) with ESMTP id l0ND8RKG002148 for ; Tue, 23 Jan 2007 13:10:57 GMT Received: from news01.csr.com ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.1830); Tue, 23 Jan 2007 13:10:35 +0000 Date: Tue, 23 Jan 2007 13:10:32 +0000 From: Peter Stephenson To: Zsh Hackers Subject: Re: Bug: Wrong completion of $(( $(!cmd Message-Id: <20070123131032.34ee48e9.pws@csr.com> In-Reply-To: <200701231304.l0ND4b3t011195@news01.csr.com> References: <20070122234306.GA24536@primenet.com.au> <200701231304.l0ND4b3t011195@news01.csr.com> Organization: Cambridge Silicon Radio X-Mailer: Sylpheed version 2.2.10 (GTK+ 2.10.4; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 23 Jan 2007 13:10:35.0690 (UTC) FILETIME=[DEA660A0:01C73EEF] X-Scanned-By: MailControl A-07-06-80 (www.mailcontrol.com) on 10.67.0.117 Peter Stephenson wrote: > Geoff Wing wrote: > > On Saturday 2007-01-06 23:48 +1100, J_rg Sommer output: > > :% echo 12 > > :12 > > :% echo $(( $(!echo > > :% echo $($(( $(echo 12 > > > > and inungetc() just after gives me 11 lines of > > Warning: backing up wrong character. > > The problem is somewhere here (in lex.c). If dquote_parse() returns > non-zero it's an error indication, not a character, so the hungetc(c) is > definitely wrong in that case. However, I don't understand the > intention behind error handling at this point. I think we probably need > to return 1 earlier. Is it this simple? Seems to do the trick... Index: Src/lex.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/lex.c,v retrieving revision 1.37 diff -u -r1.37 lex.c --- Src/lex.c 19 Jan 2007 21:36:03 -0000 1.37 +++ Src/lex.c 23 Jan 2007 13:08:47 -0000 @@ -542,14 +542,14 @@ c = dquote_parse(')', 0); cmdpop(); *bptr = '\0'; - if (!c) { - c = hgetc(); - if (c == ')') - return 1; - hungetc(c); - lexstop = 0; - c = ')'; - } + if (c) + return 1; + c = hgetc(); + if (c == ')') + return 1; + hungetc(c); + lexstop = 0; + c = ')'; hungetc(c); lexstop = 0; while (len > oldlen) { -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview