From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9643 invoked from network); 26 Aug 2008 01:21:01 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 26 Aug 2008 01:21:01 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 92424 invoked from network); 26 Aug 2008 01:20:37 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 26 Aug 2008 01:20:37 -0000 Received: (qmail 9781 invoked by alias); 26 Aug 2008 01:20:23 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25534 Received: (qmail 9761 invoked from network); 26 Aug 2008 01:20:21 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 26 Aug 2008 01:20:21 -0000 Received: from vms173005pub.verizon.net (vms173005pub.verizon.net [206.46.173.5]) by bifrost.dotsrc.org (Postfix) with ESMTP id 33541801E2B4 for ; Tue, 26 Aug 2008 03:20:17 +0200 (CEST) Received: from torch.brasslantern.com ([96.238.220.178]) by vms173005.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0K66008WYP18VOC2@vms173005.mailsrvcs.net> for zsh-workers@sunsite.dk; Mon, 25 Aug 2008 20:19:57 -0500 (CDT) Received: from torch.brasslantern.com (localhost.localdomain [127.0.0.1]) by torch.brasslantern.com (8.13.1/8.13.1) with ESMTP id m7Q1JtIO027369 for ; Mon, 25 Aug 2008 18:19:55 -0700 Received: (from schaefer@localhost) by torch.brasslantern.com (8.13.1/8.13.1/Submit) id m7Q1JsnP027368 for zsh-workers@sunsite.dk; Mon, 25 Aug 2008 18:19:54 -0700 Date: Mon, 25 Aug 2008 18:19:54 -0700 From: Bart Schaefer Subject: Re: "pws non-canonical hack" problems In-reply-to: <20080825174751.38323d18@pws-pc> To: zsh-workers@sunsite.dk Message-id: <080825181954.ZM27367@torch.brasslantern.com> MIME-version: 1.0 X-Mailer: OpenZMail Classic (0.9.2 24April2005) Content-type: text/plain; charset=us-ascii References: <20080823072446.GM8612@altlinux.org> <080823075551.ZM5496@torch.brasslantern.com> <20080825174751.38323d18@pws-pc> Comments: In reply to Peter Stephenson "Re: "pws non-canonical hack" problems" (Aug 25, 5:47pm) X-Virus-Scanned: ClamAV 0.92.1/8089/Tue Aug 26 02:28:51 2008 on bifrost X-Virus-Status: Clean On Aug 25, 5:47pm, Peter Stephenson wrote: } } On Sat, 23 Aug 2008 07:55:49 -0700 } > } } > } _path_files: } > } 387 if [[ -e "$tmp3${(Q)PREFIX}${(Q)SUFFIX}" ]] then } > } 388 tmp1+=("$tmp3${(Q)PREFIX}${(Q)SUFFIX}") } > } 389 fi } > } } > } When I completing directory, sometimes file is being completed. } > } > The problem is that this code should not unconditionally append } > something to tmp1. It has to test again (probably by using some } > variant of the call to compfiles that appears 20 or so lines above) } > that some new file really was created that matches the qualifiers in } > the generated glob pattern. } } Er, isn't that what the -e test does? What I think you mean is there } may be options to compfiles that don't get taken account of at this point. I guess that's what I mean. The -e test is not sufficient; compfiles may have left tmp1 empty because "$tmp3${(Q)PREFIX}${(Q)SUFFIX}" names a file that exists but is not a directory. The -e test only confirms that the name exists after attempting to access it, not that (a) that name did not exist before and (b) it names the right type of object. } Unfortunately, the file completion code was never very intelligible } and there are way too many cases. If anyone can come up with a way of } limiting this test in the right way, great. It's pretty difficult for me to test because I don't have a file system that behaves in this magical way. But the answer, I think, is to skip the tmp1+= inside the loop and call compfiles again after the loop is finished.