From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28939 invoked from network); 23 Feb 2008 18:11:40 -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.5 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; 23 Feb 2008 18:11:40 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 71485 invoked from network); 23 Feb 2008 18:11:35 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 23 Feb 2008 18:11:35 -0000 Received: (qmail 21964 invoked by alias); 23 Feb 2008 18:11:31 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24590 Received: (qmail 21944 invoked from network); 23 Feb 2008 18:11:30 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 23 Feb 2008 18:11:30 -0000 Received: from mtaout02-winn.ispmail.ntl.com (mtaout02-winn.ispmail.ntl.com [81.103.221.48]) by bifrost.dotsrc.org (Postfix) with ESMTP id 9A3C88026E0B for ; Sat, 23 Feb 2008 19:11:26 +0100 (CET) Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com with ESMTP id <20080223181332.GLHU27871.mtaout02-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com> for ; Sat, 23 Feb 2008 18:13:32 +0000 Received: from pws-pc ([81.107.42.63]) by aamtaout02-winn.ispmail.ntl.com with ESMTP id <20080223181254.XLFZ17393.aamtaout02-winn.ispmail.ntl.com@pws-pc> for ; Sat, 23 Feb 2008 18:12:54 +0000 Date: Sat, 23 Feb 2008 18:09:45 +0000 From: Peter Stephenson To: zsh-workers@sunsite.dk (Zsh hackers list) Subject: Re: PATCH: completion of glob qualifiers Message-ID: <20080223180945.5cafe400@pws-pc> In-Reply-To: <080222220655.ZM31839@torch.brasslantern.com> References: <11164.1203725067@pws-pc> <080222220655.ZM31839@torch.brasslantern.com> X-Mailer: Claws Mail 3.3.0 (GTK+ 2.12.5; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.0 c=1 a=Rw7lO6RaNG4A:15 a=3FTp5y5X6ml6ZCsPBftHHg==:17 a=NLZqzBF-AAAA:8 a=CJHxvXbyZ4O2kbliVCUA:9 a=-r08mneUdeIi4z5W1FgA:7 a=_eOGPHymz6KH1pDLMnWbiLXYTsYA:4 a=I6wTmPyJxzYA:10 a=_dQi-Dcv4p4A:10 a=LY0hPdMaydYA:10 X-Virus-Scanned: ClamAV 0.91.2/5947/Sat Feb 23 16:40:48 2008 on bifrost X-Virus-Status: Clean On Fri, 22 Feb 2008 22:06:55 -0800 Bart Schaefer wrote: > schaefer<501> echo ${var:Oops. Bug in parse_subst_string: errflag This certainly isn't new, and in fact I think it's overzealous error checking. Because we're in a context where we might not be able to parse something (we're doing unquoting of a string which could contain anything, not necessarily something that can be parsed), the error should be suppressed, and indeed noerrs is on and errflag is explicitly and unconditionally reset by the caller of this function. So I think we just need the debug code to respect noerrs. I've put a comment by the definition of noerrs reminding us how it works. I feel such a spoilsport doing that. (I note we end up in -default- rather than -brace-parameter- completion, as in the case after "${(". I suspect it might be better to handle this in the shell code, say _dispatch, rather than trying to hack the already horrific context parsing inside the shell.) Index: Src/exec.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/exec.c,v retrieving revision 1.129 diff -u -r1.129 exec.c --- Src/exec.c 21 Feb 2008 18:27:04 -0000 1.129 +++ Src/exec.c 23 Feb 2008 18:03:29 -0000 @@ -46,7 +46,10 @@ /**/ int noerrexit; -/* suppress error messages */ +/* + * noerrs = 1: suppress error messages + * noerrs = 2: don't set errflag on parse error, either + */ /**/ mod_export int noerrs; Index: Src/lex.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/lex.c,v retrieving revision 1.43 diff -u -r1.43 lex.c --- Src/lex.c 17 Dec 2007 14:20:25 -0000 1.43 +++ Src/lex.c 23 Feb 2008 18:03:29 -0000 @@ -1619,7 +1619,7 @@ * Historical note: we used to check here for olen == l, but * that's not necessarily the case if we stripped an RCQUOTE. */ - if (c != STRING || errflag) { + if (c != STRING || (errflag && !noerrs)) { fprintf(stderr, "Oops. Bug in parse_subst_string: %s\n", errflag ? "errflag" : "c != STRING"); fflush(stderr); -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/