Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completion bug: treats substitution of unset parameter as empty string
- X-seq: zsh-workers 27259
- From: Greg Klanderman <gak@xxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: completion bug: treats substitution of unset parameter as empty string
- Date: Thu, 10 Sep 2009 10:30:42 -0400
- In-reply-to: <200909100926.n8A9QFTh025636@xxxxxxxxxxxxxx> (Peter Stephenson's message of "Thu, 10 Sep 2009 10:26:15 +0100")
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <19056.37899.24683.999959@xxxxxxxxxxxxxxxxxx> <m3pra0oj0b.fsf@xxxxxxxxxxxxxx> <200909100926.n8A9QFTh025636@xxxxxxxxxxxxxx>
- Reply-to: gak@xxxxxxxxxxxxxx
>>>>> On September 10, 2009 Peter Stephenson <pws@xxxxxxx> 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/ <tab>
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='[^/]'
Messages sorted by:
Reverse Date,
Date,
Thread,
Author