From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9056 invoked from network); 9 Feb 2004 22:34:49 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 9 Feb 2004 22:34:49 -0000 Received: (qmail 16410 invoked by alias); 9 Feb 2004 22:34:42 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19410 Received: (qmail 16396 invoked from network); 9 Feb 2004 22:34:42 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 9 Feb 2004 22:34:42 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [63.249.88.2] by sunsite.dk (MessageWall 1.0.8) with SMTP; 9 Feb 2004 22:34:41 -0000 Received: by binome.blorf.net (Postfix, from userid 1000) id BA1DA6F03; Mon, 9 Feb 2004 14:34:40 -0800 (PST) Date: Mon, 9 Feb 2004 14:34:40 -0800 From: Wayne Davison To: Peter Stephenson Cc: Zsh hackers list Subject: Re: zsh crashes on completeion of utf-8 file-names. Message-ID: <20040209223440.GE958@blorf.net> References: <7460.1073312227@csr.com> <11091.1073318874@csr.com> <20040105170850.GB4482@blorf.net> <20040206165709.GB6749@blorf.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="17pEHd4RhPHOinZp" Content-Disposition: inline In-Reply-To: <20040206165709.GB6749@blorf.net> User-Agent: Mutt/1.5.5.1+cvs20040105i --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I was thinking about the case of the reverse scan, and it occurred to me that if the character that followed the Meta matched a normal character in the other string, a reverse scan could end up in the middle of a meta sequence. This patch fixes this. Note that this code depends on the (apparent) fact that a meta char cannot be followed by the same value (e.g. we must be sure that when we see a meta value, it is the start of a meta sequence and not the end). ..wayne.. --17pEHd4RhPHOinZp Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="meta.patch" --- compmatch.c 9 Feb 2004 05:49:52 -0000 1.40 +++ compmatch.c 9 Feb 2004 22:03:27 -0000 @@ -1593,10 +1593,15 @@ sub_match(Cmdata md, char *str, int len, l < len && l < md->len && p[ind] == q[ind]; l++, p += add, q += add) {} - /* Make sure we don't end with a widowed Meta (which can only - * happen in a forward scan). */ - if (l && add == 1 && p[-1] == Meta) - l--; + /* Make sure we don't end in the middle of a Meta sequence. */ + if (add = 1) { + if (l && p[-1] == Meta) + l--; + } else { + if (l && ((l < len && p[-1] == Meta) + || (l < md->len && q[-1] == Meta))) + l--; + } if (l) { /* There was a common prefix, use it. */ md->len -= l; len -= l; --17pEHd4RhPHOinZp--