zsh-workers
 help / color / mirror / code / Atom feed
From: Greg Klanderman <gak@klanderman.net>
To: zsh-workers@sunsite.dk
Subject: Re: completion bug: treats substitution of unset parameter as empty string
Date: Thu, 10 Sep 2009 10:30:42 -0400	[thread overview]
Message-ID: <m3hbvana7h.fsf@klanderman.net> (raw)
In-Reply-To: <200909100926.n8A9QFTh025636@news01.csr.com> (Peter Stephenson's message of "Thu, 10 Sep 2009 10:26:15 +0100")

>>>>> On September 10, 2009 Peter Stephenson <pws@csr.com> 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='[^/]'


  reply	other threads:[~2009-09-10 14:31 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-29 18:25 Greg Klanderman
2009-09-09  4:10 ` Greg Klanderman
2009-09-10  9:26   ` Peter Stephenson
2009-09-10 14:30     ` Greg Klanderman [this message]
2009-09-10 14:40       ` Peter Stephenson
2009-09-10 15:23         ` Greg Klanderman

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=m3hbvana7h.fsf@klanderman.net \
    --to=gak@klanderman.net \
    --cc=zsh-workers@sunsite.dk \
    /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).