about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2018-03-24 15:11:19 +0100
committerOliver Kiddle <okiddle@yahoo.co.uk>2018-03-24 15:11:19 +0100
commita2459bee7971a46573e9b06b93013336ef6b9651 (patch)
tree362d45dab54f1999cee810dfba2f2109628ec7a9
parent259ac472eac291c8c103c7a0d8a4eaf3c2942ed7 (diff)
downloadzsh-a2459bee7971a46573e9b06b93013336ef6b9651.tar.gz
zsh-a2459bee7971a46573e9b06b93013336ef6b9651.tar.xz
zsh-a2459bee7971a46573e9b06b93013336ef6b9651.zip
42521 based on 42049 (SATOH Fumiyasu): fix finding of includes in make completion
make always includes relative to the current directory rather than
relative to the including Makefile.
-rw-r--r--ChangeLog4
-rw-r--r--Completion/Unix/Command/_make18
2 files changed, 11 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 5c1806cf7..78ebfcbfb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2018-03-24  Oliver Kiddle  <okiddle@yahoo.co.uk>
 
+	* 42521 based on 42049 (SATOH Fumiyasu):
+	Completion/Unix/Command/_make: make always includes relative
+	to the current directory rather than relative to the Makefile
+
 	* 42519, CVE-2018-1083: Src/Zle/compctl.c: check bounds on
 	PATH_MAX-sized buffer used for file completion candidates
 
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index 1da865ed0..1761bba71 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -69,7 +69,7 @@ _make-expandVars() {
 }
 
 _make-parseMakefile () {
-  local input var val target dep TAB=$'\t' dir=$1 tmp IFS=
+  local input var val target dep TAB=$'\t' tmp IFS=
 
   while read input
   do
@@ -108,14 +108,10 @@ _make-parseMakefile () {
         f=${f%[\">]}
       fi
       f=$(_make-expandVars $f)
-      case $f in
-        (/*) ;;
-        (*) f=$dir/$f ;;
-      esac
 
       if [[ -r $f ]]
       then
-        _make-parseMakefile ${f%%/[^/]##} < $f
+        _make-parseMakefile < $f
       fi
       ;;
     esac
@@ -150,7 +146,7 @@ _make-findBasedir () {
 
 _make() {
 
-  local prev="$words[CURRENT-1]" file expl tmp is_gnu dir incl match
+  local prev="$words[CURRENT-1]" file expl tmp is_gnu incl match
   local context state state_descr line
   local -a option_specs
   local -A VARIABLES VAR_ARGS opt_args
@@ -266,16 +262,16 @@ _make() {
       if [[ $is_gnu == gnu ]] 
       then
         if zstyle -t ":completion:${curcontext}:targets" call-command; then
-          _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
+          _make-parseMakefile < <(_call_program targets "$words[1]" -nsp --no-print-directory -f "$file" .PHONY 2> /dev/null)
         else
-          _make-parseMakefile $PWD < $file
+          _make-parseMakefile < $file
         fi
       else
         if [[ $OSTYPE == (freebsd|dragonfly|netbsd)* || /$words[1] == */bmake* ]]; then
           TARGETS+=(${=${(f)"$(_call_program targets "$words[1]" -s -f "$file" -V.ALLTARGETS 2> /dev/null)"}})
-          _make-parseMakefile $PWD < <(_call_program targets "$words[1]" -nsdg1Fstdout -f "$file" .PHONY 2> /dev/null)
+          _make-parseMakefile < <(_call_program targets "$words[1]" -nsdg1Fstdout -f "$file" .PHONY 2> /dev/null)
         else
-          _make-parseMakefile $PWD < $file
+          _make-parseMakefile < $file
         fi
       fi
     fi