From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28976 invoked from network); 27 Jan 2007 23:50:08 -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.5 required=5.0 tests=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; 27 Jan 2007 23:50:08 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 48330 invoked from network); 27 Jan 2007 23:50:02 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 27 Jan 2007 23:50:02 -0000 Received: (qmail 20697 invoked by alias); 27 Jan 2007 23:49:59 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 23138 Received: (qmail 20687 invoked from network); 27 Jan 2007 23:49:59 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 27 Jan 2007 23:49:59 -0000 Received: (qmail 47976 invoked from network); 27 Jan 2007 23:49:59 -0000 Received: from mtaout01-winn.ispmail.ntl.com (81.103.221.47) by a.mx.sunsite.dk with SMTP; 27 Jan 2007 23:49:53 -0000 Received: from aamtaout03-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com with ESMTP id <20070127234952.HFFD9447.mtaout01-winn.ispmail.ntl.com@aamtaout03-winn.ispmail.ntl.com> for ; Sat, 27 Jan 2007 23:49:52 +0000 Received: from pwslaptop.csr.com ([82.6.97.4]) by aamtaout03-winn.ispmail.ntl.com with ESMTP id <20070127234952.RRQM26699.aamtaout03-winn.ispmail.ntl.com@pwslaptop.csr.com> for ; Sat, 27 Jan 2007 23:49:52 +0000 Received: from pwslaptop.csr.com (pwslaptop.csr.com [127.0.0.1]) by pwslaptop.csr.com (8.13.8/8.13.7) with ESMTP id l0RNl3fe027816 for ; Sat, 27 Jan 2007 23:47:03 GMT Message-Id: <200701272347.l0RNl3fe027816@pwslaptop.csr.com> From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: 4.3.2/20061219 -> 4.3.2/20070126 very broken In-Reply-To: Message from Peter Stephenson of "Sat, 27 Jan 2007 18:55:43 GMT." <20070127185543.19ac6b8e.p.w.stephenson@ntlworld.com> Date: Sat, 27 Jan 2007 23:47:03 +0000 Here's a further improvement... the previous patch didn't pass on the Bnull, which I added specially so that the completion code could see it when trying to complete words inside $'...', and I missed the admittedly rather special case of an escaped backslash that had \M- or \C- before it. Index: Src/utils.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/utils.c,v retrieving revision 1.151 diff -u -r1.151 utils.c --- Src/utils.c 27 Jan 2007 19:01:11 -0000 1.151 +++ Src/utils.c 27 Jan 2007 23:45:36 -0000 @@ -4915,27 +4915,45 @@ *t++ = *++s ^ 32; else { if (itok(*s)) { + /* + * We need to be quite careful here. We haven't + * necessarily got an input stream with all tokens + * removed, so the majority of tokens need passing + * through untouched and without Meta handling. + * However, me may need to handle tokenized + * backslashes. + */ if (meta || control) { /* * Presumably we should be using meta or control * on the character representing the token. + * + * Special case: $'\M-\\' where the token is a Bnull. + * This time we dump the Bnull since we're + * replacing the whole thing. The lexer + * doesn't know about the meta or control modifiers. */ - *t++ = ztokens[*s - Pound]; + if ((how & GETKEY_DOLLAR_QUOTE) && *s == Bnull) + *t++ = *++s; + else + *t++ = ztokens[*s - Pound]; } else if (how & GETKEY_DOLLAR_QUOTE) { + /* + * We don't want to metafy this, it's a real + * token. + */ + *tdest++ = *s; if (*s == Bnull) { /* * Bnull is a backslash which quotes a couple * of special characters that always appear * literally next. See strquote handling - * in gettokstr() in lex.c. + * in gettokstr() in lex.c. We need + * to retain the Bnull (as above) so that quote + * handling in completion can tell where the + * backslash was. */ *tdest++ = *++s; - } else { - /* - * We don't want to metafy this, it's a real - * token. - */ - *tdest++ = *s; } continue; } else Index: Test/A03quoting.ztst =================================================================== RCS file: /cvsroot/zsh/zsh/Test/A03quoting.ztst,v retrieving revision 1.2 diff -u -r1.2 A03quoting.ztst --- Test/A03quoting.ztst 27 Jan 2007 19:01:11 -0000 1.2 +++ Test/A03quoting.ztst 27 Jan 2007 23:45:36 -0000 @@ -17,6 +17,20 @@ 0:$'-style quotes with backslashed backslashes >'a \' is 'a backslash' is 'a \' + chars=$(print -r $'BS\\MBS\M-\\') + for (( i = 1; i <= $#chars; i++ )); do + char=$chars[$i] + print $(( [#16] #char )) + done +0:$'-style quote with metafied backslash +>16#42 +>16#53 +>16#5C +>16#4D +>16#42 +>16#53 +>16#DC + print -r '''' setopt rcquotes # We need to set rcquotes here for the next example since it is -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/