summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2005-03-02 20:31:17 +0000
committerClint Adams <clint@users.sourceforge.net>2005-03-02 20:31:17 +0000
commitb456dfcfbab00a025df7e152fc78ecd255031f44 (patch)
treebda64a1db46c68e6a5519c447a082a73d94f85e2 /Completion
parent3321b48303d2845724f97b707e6d9679b9e718cf (diff)
downloadzsh-b456dfcfbab00a025df7e152fc78ecd255031f44.tar.gz
zsh-b456dfcfbab00a025df7e152fc78ecd255031f44.tar.xz
zsh-b456dfcfbab00a025df7e152fc78ecd255031f44.zip
* 20906: Completion/Unix/Command/_make: patch from Mike "Stew" O'Connor
 to limit recursion depth in make completion variable expansion.
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_make13
1 files changed, 8 insertions, 5 deletions
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index 3b0bc2476..91dcc1558 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -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 @@ expandVars() {
 	    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 @@ parseMakefile() {
 	    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 @@ parseMakefile() {
 		f=${f#[\"<]}
 		f=${f%[\">]}
 	    fi
-	    f=$(expandVars $f)
+	    f=$(expandVars 10 $f)
 	    case $f in
 	    (/*) ;;
 	    (*)  f=$dir/$f ;;