Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[stew@xxxxxxxxx: Bug#295511: patch]



Wayne, any thoughts?

----- Forwarded message from Mike O'Connor <stew@xxxxxxxxx> -----

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 -----



Messages sorted by: Reverse Date, Date, Thread, Author