From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11961 invoked by alias); 10 Feb 2011 17:28:36 -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: 28731 Received: (qmail 1801 invoked from network); 10 Feb 2011 17:28:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <110210092820.ZM30702@torch.brasslantern.com> Date: Thu, 10 Feb 2011 09:28:20 -0800 In-reply-to: <110210084252.ZM30454@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Another _path_files bug?" (Feb 10, 8:42am) References: <110210084252.ZM30454@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: Another _path_files bug? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Feb 10, 8:42am, Bart Schaefer wrote: } } torch% setopt completeinword } torch% ls Test/ } torch% ls Test//Test/Makefile } } This only happens when there is only a single completion in the directory. } If the completion is ambiguous, it works correctly: } } The first significant difference seems to be at around line 740 - 760 of } _path_files where, in the completeinword case, $mid gets assigned on line } 749. I think, but am not yet sure, that when $tsuf contains but does not } begin with a "/", then at line 754 (and possibly also at line 752, but } again not sure) $cpre should NOT have a trailing slash appended. That may or may not be the case, but I've narrowed this down to the compadd at line 783. In the failing case, this does: compadd -Qf -J -default- -J -default- -p Test/ \ -s /Makefile -W Test// -M 'r:|/=* r:|=*' - Test That is, it's attempting to make "Test" one of the completions, and at the same time assert that "/Makefile" should be a suffix. The trouble is that it's also making "Test/" a prefix (-p). The -p argument is "${Uopt:+$IPREFIX}$linepath$tmp3/" where Uopt and IPREFIX and linepath are all empty. tmp3="${mid%/*/}" from line 773, which is just $mid because "Test/" does not begin with a slash. I think it's pretty obvious that we don't want to be treating "Test" as both a completion and a prefix, but we need the -p option in the event that $linepath is not empty. Also it's not clear that the final slash should always be appended to the -p argument as it is there. What's the right thing to do?