From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22282 invoked from network); 5 Jan 2004 16:14:27 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 5 Jan 2004 16:14:27 -0000 Received: (qmail 16332 invoked by alias); 5 Jan 2004 16:14:10 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19336 Received: (qmail 16262 invoked from network); 5 Jan 2004 16:14:10 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 5 Jan 2004 16:14:10 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 5 Jan 2004 16:14:9 -0000 Received: from EXCHANGE02.csr.com (unverified) by MAILSWEEPER01.csr.com (Content Technologies SMTPRS 4.3.12) with ESMTP id for ; Mon, 5 Jan 2004 16:09:40 +0000 Received: from csr.com ([192.168.144.127]) by EXCHANGE02.csr.com with Microsoft SMTPSVC(5.0.2195.5329); Mon, 5 Jan 2004 16:09:49 +0000 To: Zsh hackers list Subject: Re: zsh crashes on completeion of utf-8 file-names. In-reply-to: "Peter Stephenson"'s message of "Mon, 05 Jan 2004 14:17:07 GMT." <7460.1073312227@csr.com> Date: Mon, 05 Jan 2004 16:07:54 +0000 Message-ID: <11091.1073318874@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 05 Jan 2004 16:09:49.0558 (UTC) FILETIME=[5846E960:01C3D3A6] Peter Stephenson wrote: > "Zvi Har'El" wrote: > > I know that zsh-4.1.1 still doesn't support utf-8, but as realeased it coul > d > > do completion on utf-8 file names. However, I recently updated from the cvs > > and now zsh crashes on completions of names, when I have two candidates of > th > > e > > form RA and RB, and I hit R. This happens when R=U+05E8 (0xd7 0xa8) or > > U+05E9 (0xd7 0xa9) and A and B are U+05D0 and U+05D1. > > I managed to reproduce this with zsh -f on a directory containing only > the files > > touch $'\xd7\xa8\xd7\x90' > touch $'\xd7\xa8\xd7\x91' Phew. I hope this really is the fix because I don't want to have to trawl around down there again... Deep inside the completion code, it works out whether two matches have a common prefix. It was treating Meta characters as ordinary characters. So the unambiguous part of the string to insert got truncated at the Meta. This would have shown up any time the only possible matches differed by a metafied character. Unless you have a lot of strings with 8-bit characters, that's probably not very common. This seems to fix it here. (By the way, every time I send a message saying I think setting lastval = 0 in bin_eval is the correct fix for the eval "" bug, it disappears. So let's see if tacking it on here confuses the system sufficiently.) Index: Src/Zle/compmatch.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compmatch.c,v retrieving revision 1.37 diff -u -r1.37 compmatch.c --- Src/Zle/compmatch.c 8 Aug 2001 07:41:01 -0000 1.37 +++ Src/Zle/compmatch.c 5 Jan 2004 16:04:39 -0000 @@ -1584,8 +1584,15 @@ if (check_cmdata(md, sfx)) return ret; + /* + * Look for a common prefix. Be careful not to include + * a widowed Meta in the prefix. If we do include metafied + * characters, at this stage we still need the overall length + * including Meta's as separate characters. + */ for (l = 0, p = str, q = md->str; - l < len && l < md->len && p[ind] == q[ind]; + l < len && l < md->len && p[ind] == q[ind] + && (p[ind] != Meta || p[ind+1] == q[ind+1]); l++, p += add, q += add); if (l) { -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, 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. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com **********************************************************************