From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14051 invoked from network); 21 Mar 2005 18:43:10 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 21 Mar 2005 18:43:10 -0000 Received: (qmail 78382 invoked from network); 21 Mar 2005 18:43:04 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 21 Mar 2005 18:43:04 -0000 Received: (qmail 20801 invoked by alias); 21 Mar 2005 18:43:00 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21045 Received: (qmail 20790 invoked from network); 21 Mar 2005 18:43:00 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 21 Mar 2005 18:43:00 -0000 Received: (qmail 77978 invoked from network); 21 Mar 2005 18:43:00 -0000 Received: from mailhost1.csr.com (HELO MAILSWEEPER01.csr.com) (81.105.217.43) by a.mx.sunsite.dk with SMTP; 21 Mar 2005 18:42:49 -0000 Received: from exchange03.csr.com (unverified [10.100.137.60]) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id ; Mon, 21 Mar 2005 18:41:14 +0000 Received: from news01.csr.com ([10.103.143.38]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 21 Mar 2005 18:44:50 +0000 Received: from news01.csr.com (localhost.localdomain [127.0.0.1]) by news01.csr.com (8.13.1/8.12.11) with ESMTP id j2LIglWG008342; Mon, 21 Mar 2005 18:42:47 GMT Received: from csr.com (pws@localhost) by news01.csr.com (8.13.1/8.13.1/Submit) with ESMTP id j2LIglgU008339; Mon, 21 Mar 2005 18:42:47 GMT Message-Id: <200503211842.j2LIglgU008339@news01.csr.com> X-Authentication-Warning: news01.csr.com: pws owned process doing -bs To: zsh-workers@sunsite.dk (Zsh hackers list), Mikael Magnusson Subject: Re: crash in tabcompleting In-reply-to: <200503211712.j2LHCMjW015774@news01.csr.com> References: <237967ef05032017571464ae4f@mail.gmail.com> <200503211106.j2LB6mHo006379@news01.csr.com> <237967ef05032104425384f32b@mail.gmail.com> <200503211712.j2LHCMjW015774@news01.csr.com> Date: Mon, 21 Mar 2005 18:42:46 +0000 From: Peter Stephenson X-OriginalArrivalTime: 21 Mar 2005 18:44:50.0365 (UTC) FILETIME=[10292ED0:01C52E46] X-Spam-Checker-Version: SpamAssassin 3.0.2 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, score=-2.6 required=6.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.2 X-Spam-Hits: -2.6 Peter Stephenson wrote: > Mikael Magnusson wrote: > > It seems one file is enough. I also failed to mention that zsh doesn't > > crash if there are any other files in the same directory. It has to be > > only ones which cause the problem I think. (not sure exactly what that > > is though). > > This script succeeds in creating the file for me: > > > > > > a='+WSdYWmEb - +WSdZfTBNMF8wmTCIMAI.avi' > > b="`echo $a|iconv -f utf7 -t utf8`" > > touch "$b" > > This is good enough for me to see that somewhere the completion system > is messing up the use of metafied characters: with debugging turned on, > there's an error message from "ztrsub" because there's a Meta at the end > of the variable. It looks like the code to move along compprefix (and compsuffix, though that didn't seem to show up here) didn't take account of Meta characters. I'd guess there's much, much more like this. This has been there for ages, but it's liable to show up in different ways. Index: Src/Zle/compcore.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v retrieving revision 1.69 diff -u -r1.69 compcore.c --- Src/Zle/compcore.c 14 Jan 2005 13:05:22 -0000 1.69 +++ Src/Zle/compcore.c 21 Mar 2005 18:38:44 -0000 @@ -1532,8 +1532,8 @@ untokenize(ss); compsuffix = ztrdup(ss); } - if ((i = strlen(compprefix)) && - compprefix[i - 1] == '\\' && compprefix[i - 2] != '\\') + if ((i = strlen(compprefix)) > 1 && compprefix[i - 1] == '\\' && + compprefix[i - 2] != '\\' && compprefix[i - 2] != Meta) compprefix[i - 1] = '\0'; tmp = tricat(compqiprefix, compiprefix, multiquote(qp, 1)); Index: Src/Zle/complete.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/complete.c,v retrieving revision 1.27 diff -u -r1.27 complete.c --- Src/Zle/complete.c 7 Dec 2004 16:55:11 -0000 1.27 +++ Src/Zle/complete.c 21 Mar 2005 18:38:44 -0000 @@ -821,18 +821,32 @@ add = -1; } else { p = compprefix + 1; + if (*p == Meta) + p++; add = 1; } - for (; l; l--, p += add) { + for (;;) { sav = *p; *p = '\0'; test = pattry(pp, compprefix); *p = sav; if (test && !--na) break; + if (add > 0) { + if (p == compprefix + l) + return 0; + if (*p == Meta) + p += 2; + else + p++; + } else { + if (p == compprefix) + return 0; + p--; + if (p > compprefix && p[-1] == Meta) + p--; + } } - if (!l) - return 0; if (mod) ignore_prefix(p - compprefix); } else { @@ -847,14 +861,30 @@ add = 1; } else { p = compsuffix + l - 1; + if (p > compsuffix && p[-1] == Meta) + p--; add = -1; } - for (; l; l--, p += add) + for (;;) { if (pattry(pp, p) && !--na) break; - if (!l) - return 0; + if (add > 0) { + if (p == compsuffix + l) + return 0; + if (*p == Meta) + p += 2; + else + p++; + } else { + if (p == compsuffix) + return 0; + p--; + if (p > compsuffix && p[-1] == Meta) + p--; + } + } + if (mod) ignore_suffix(ol - (p - compsuffix)); } -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070 ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. **********************************************************************