From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16706 invoked from network); 10 Sep 2009 14:31:20 -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 new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 10 Sep 2009 14:31:20 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 79983 invoked from network); 10 Sep 2009 14:31:02 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 10 Sep 2009 14:31:02 -0000 Received: (qmail 15759 invoked by alias); 10 Sep 2009 14:30:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27259 Received: (qmail 15729 invoked from network); 10 Sep 2009 14:30:54 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 10 Sep 2009 14:30:54 -0000 Received: from QMTA08.westchester.pa.mail.comcast.net (qmta08.westchester.pa.mail.comcast.net [76.96.62.80]) by bifrost.dotsrc.org (Postfix) with ESMTP id 109FB8026E39 for ; Thu, 10 Sep 2009 16:30:44 +0200 (CEST) Received: from OMTA18.westchester.pa.mail.comcast.net ([76.96.62.90]) by QMTA08.westchester.pa.mail.comcast.net with comcast id eze81c0061wpRvQ582WctQ; Thu, 10 Sep 2009 14:30:36 +0000 Received: from smtp.klanderman.net ([98.217.254.247]) by OMTA18.westchester.pa.mail.comcast.net with comcast id f2aX1c0025M2Np63e2aXti; Thu, 10 Sep 2009 14:34:31 +0000 Received: from lwm.klanderman.net (unknown [192.168.100.50]) by smtp.klanderman.net (Postfix) with ESMTP id 42DFCB3015C for ; Thu, 10 Sep 2009 10:30:43 -0400 (EDT) Received: by lwm.klanderman.net (Postfix, from userid 500) id 27B539FC5F3; Thu, 10 Sep 2009 10:30:43 -0400 (EDT) From: Greg Klanderman To: zsh-workers@sunsite.dk Subject: Re: completion bug: treats substitution of unset parameter as empty string Reply-To: gak@klanderman.net Date: Thu, 10 Sep 2009 10:30:42 -0400 In-Reply-To: <200909100926.n8A9QFTh025636@news01.csr.com> (Peter Stephenson's message of "Thu, 10 Sep 2009 10:26:15 +0100") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (linux) References: <19056.37899.24683.999959@gargle.gargle.HOWL> <200909100926.n8A9QFTh025636@news01.csr.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV 0.94.2/9791/Thu Sep 10 03:03:33 2009 on bifrost X-Virus-Status: Clean >>>>> On September 10, 2009 Peter Stephenson wrote: > See _comp_options and _comp_setup in compinit and the use of _comp_setup > in _main_complete. OK, thanks for the pointer.. Here's a patch to fix the originally reported problem - that _path_files incorrectly treats a parameter expansion of an unset parameter as the empty string, i.e. that % ls $foobar/ lists completions under '/'. thanks, Greg Index: Completion/Unix/Type/_path_files =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_path_files,v retrieving revision 1.47 diff -u -r1.47 _path_files --- Completion/Unix/Type/_path_files 5 Aug 2009 00:46:45 -0000 1.47 +++ Completion/Unix/Type/_path_files 10 Sep 2009 14:26:53 -0000 @@ -247,7 +247,9 @@ # meant as a partial path. linepath="${(M)pre##*\$[^/]##/}" + setopt nounset # do not treat an unset parameter expansion as the empty string eval 'realpath=${(e)~linepath}' 2>/dev/null + setopt unset [[ -z "$realpath" || "$realpath" = "$linepath" ]] && return 1 pre="${pre#${linepath}}" i='[^/]'