zsh-workers
 help / color / mirror / code / Atom feed
From: Clint Adams <schizo@debian.org>
To: zsh-workers@sunsite.dk
Subject: [stew@vireo.org: Bug#295511: patch]
Date: Wed, 2 Mar 2005 00:28:45 -0500	[thread overview]
Message-ID: <20050302052845.GA27771@scowler.net> (raw)

Wayne, any thoughts?

----- Forwarded message from Mike O'Connor <stew@vireo.org> -----

Here is a patch that seems to fix this bug.  What I have done is to
alter the _make completion functions so that recursion in expanding
variables is limited to only going 10 levels deep.

-stew


diff -ru zsh-4.2.4/Completion/Unix/Command/_make zsh-4.2.4-makecompletionfix/Completion/Unix/Command/_make
--- zsh-4.2.4/Completion/Unix/Command/_make	2005-03-01 23:17:01.000000000 -0500
+++ zsh-4.2.4-makecompletionfix/Completion/Unix/Command/_make	2005-03-01 23:16:18.000000000 -0500
@@ -3,7 +3,10 @@
 local prev="$words[CURRENT-1]" file expl tmp is_gnu dir incl
 
 expandVars() {
-    local open close var val tmp=$1 ret=$1
+    local open close var val tmp=$2 ret=$2
+    if (( $1 == 0 )); then
+	return
+    fi
     while :; do
 	var=${tmp#*\$}
 	if [[ $var != $tmp ]]; then
@@ -37,7 +40,7 @@
 	    case $var in
 	    ([[:alnum:]_]#)
 		val=${(P)var}
-		val=$(expandVars $val)
+		val=$(expandVars $(($1 - 1)) $val)
 		ret=${ret//\$$open$var$close/$val}
 		;;
 	    esac
@@ -63,12 +66,12 @@
 	    var=${input%%[ $TAB]#:=*}
 	    val=${input#*=}
 	    val=${val##[ $TAB]#}
-	    val=$(expandVars $val)
+	    val=$(expandVars 10 $val)
 	    eval $var=\$val
 	    ;;
 	([[:alnum:]][^$TAB:=]#:[^=]*)
 	    input=${input%%:*}
-	    print $(expandVars $input)
+	    print $(expandVars 10 $input)
 	    ;;
 	($incl *)
 	    local f=${input##$incl ##}
@@ -76,7 +79,7 @@
 		f=${f#[\"<]}
 		f=${f%[\">]}
 	    fi
-	    f=$(expandVars $f)
+	    f=$(expandVars 10 $f)
 	    case $f in
 	    (/*) ;;
 	    (*)  f=$dir/$f ;;




----- End forwarded message -----


             reply	other threads:[~2005-03-02  5:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-02  5:28 Clint Adams [this message]
2005-03-02 18:51 ` Wayne Davison
2005-03-02 19:17   ` Wayne Davison
2005-03-02 20:25   ` Clint Adams

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=20050302052845.GA27771@scowler.net \
    --to=schizo@debian.org \
    --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).