summaryrefslogtreecommitdiffstats
path: root/Completion/Unix
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2005-03-02 20:40:07 +0000
committerClint Adams <clint@users.sourceforge.net>2005-03-02 20:40:07 +0000
commit6670fac7c41a9233e011a1fae04acff511dde957 (patch)
tree46a1b093f981af5a11f44a282c037c1287447f09 /Completion/Unix
parentFixed a possible infinite recursion in _make. (diff)
downloadzsh-6670fac7c41a9233e011a1fae04acff511dde957.tar
zsh-6670fac7c41a9233e011a1fae04acff511dde957.tar.gz
zsh-6670fac7c41a9233e011a1fae04acff511dde957.tar.bz2
zsh-6670fac7c41a9233e011a1fae04acff511dde957.tar.lz
zsh-6670fac7c41a9233e011a1fae04acff511dde957.tar.xz
zsh-6670fac7c41a9233e011a1fae04acff511dde957.tar.zst
zsh-6670fac7c41a9233e011a1fae04acff511dde957.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/Unix')
-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 ;;