From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13932 invoked by alias); 9 Nov 2009 16:30:19 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 27373 Received: (qmail 13991 invoked from network); 9 Nov 2009 16:30:16 -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.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <091109082958.ZM26466@torch.brasslantern.com> Date: Mon, 09 Nov 2009 08:29:58 -0800 In-reply-to: <19191.43212.832827.724369@gargle.gargle.HOWL> Comments: In reply to Greg Klanderman "bug in 'rm' completion" (Nov 9, 12:29am) References: <19191.43212.832827.724369@gargle.gargle.HOWL> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh list Subject: Re: bug in 'rm' completion MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Nov 9, 12:29am, Greg Klanderman wrote: } } Will look into fixing these at some point but figured I'd report them } first in case the fix is obvious to anyone out there.. I assume both } examples are manifestations of the same bug. At first I thought this was a(nother) problem with _path_files but it appears instead to be pretty plainly this in _rm: case $state in (file) declare -a ignored ignored=(${line//(#m)[\[\]()\\*?#<>~\^]/\\$MATCH}) _files -F ignored && ret=0 ;; esac A _complete_debug trace shows: +_rm:33> case file (file) +_rm:35> declare -a ignored +_rm:36> ignored=( foo ) +_rm:37> _files -F ignored The most recent change was: 2009-08-17 Peter Stephenson * 27219: Completion/Unix/Type/_files: "_files -F " wasn't correctly handled, which broke duplicate filtering in _rm. (BTW "wasn't" has a UTF-8 apostrophe in the actual ChangeLog file.) So _rm is attempting to filter duplicates out of the completion list, but ends up filtering out unambiguous prefixes as well. Fixing one bug exposed a different one. The easy fix of swapping in { _files -F ignored || _files } solves the foo{1,2,3} variant but not the foo{,-bar} variant because the presence of foo-bar allows _files -F to succeed even though it skips foo. There may not be a way to satisfy all constraints here.