zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: Zsh list <zsh-workers@zsh.org>
Subject: Re: bug in 'rm' completion
Date: Mon, 09 Nov 2009 08:29:58 -0800	[thread overview]
Message-ID: <091109082958.ZM26466@torch.brasslantern.com> (raw)
In-Reply-To: <19191.43212.832827.724369@gargle.gargle.HOWL>

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  <p.w.stephenson@ntlworld.com>

        * 27219: Completion/Unix/Type/_files: "_files -F <array>" 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.


      parent reply	other threads:[~2009-11-09 16:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-09  5:29 Greg Klanderman
2009-11-09 16:17 ` Greg Klanderman
2009-11-09 17:29   ` Bart Schaefer
2009-11-09 17:52     ` Greg Klanderman
2009-11-09 21:20       ` Greg Klanderman
2009-11-10 15:52         ` Bart Schaefer
2009-11-12  2:48           ` Greg Klanderman
2009-11-12  4:21             ` Bart Schaefer
2009-11-12 17:22               ` Greg Klanderman
2009-11-09 16:29 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=091109082958.ZM26466@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).