about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthew Martin <phy1729@gmail.com>2019-04-22 22:04:24 -0500
committerMatthew Martin <phy1729@gmail.com>2019-04-22 22:04:24 -0500
commit39b0f5540c624f11d087632ae2d67a113d84a773 (patch)
tree1b780a38b32aebbcfbe9d6b61cdf12dcb021c803
parenta4f44972076ac86bde7f8b96c18b10807d580965 (diff)
downloadzsh-39b0f5540c624f11d087632ae2d67a113d84a773.tar.gz
zsh-39b0f5540c624f11d087632ae2d67a113d84a773.tar.xz
zsh-39b0f5540c624f11d087632ae2d67a113d84a773.zip
unposted: _pick_variant: Use ${(P) ::= rather than eval
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Base/Utility/_pick_variant8
2 files changed, 7 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 8003ef322..641af5671 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2019-04-22  Matthew Martin  <phy1729@gmail.com>
 
+	* unposted: Completion/Base/Utility/_pick_variant: Use
+	${(P) ::= rather than eval.
+
 	* 44242: Completion/Unix/Command/_chown,
 	Completion/Unix/Command/_ln, Completion/Unix/Command/_mv,
 	Completion/Unix/Command/_rm, Completion/Unix/Command/_rmdir:
diff --git a/Completion/Base/Utility/_pick_variant b/Completion/Base/Utility/_pick_variant
index b75233038..9d705cf10 100644
--- a/Completion/Base/Utility/_pick_variant
+++ b/Completion/Base/Utility/_pick_variant
@@ -17,7 +17,7 @@ done
 if (( ${#precommands:|builtin_precommands} )); then
   pre=command
 elif (( $+opts[-b] && ( $precommands[(I)builtin] || $+builtins[$opts[-c]] ) )); then
-  (( $+opts[-r] )) && eval "${opts[-r]}=$opts[-b]"
+  (( $+opts[-r] )) && : ${(P)opts[-r]::=$opts[-b]}
   return 0
 elif (( $precommands[(I)builtin] )); then
   pre=builtin
@@ -28,7 +28,7 @@ else
 fi
 
 if [[ $pre != builtin ]] && (( $+_cmd_variant[$opts[-c]] )); then
-  (( $+opts[-r] )) && eval "${opts[-r]}=${_cmd_variant[$opts[-c]]}"
+  (( $+opts[-r] )) && : ${(P)opts[-r]::=${_cmd_variant[$opts[-c]]}}
   [[ $_cmd_variant[$opts[-c]] = "$1" ]] && return 1
   return 0
 fi
@@ -37,13 +37,13 @@ output="$(_call_program variant $pre $opts[-c] "${@[2,-1]}" </dev/null 2>&1)"
 
 for cmd pat in "$var[@]"; do
   if [[ $output = *$~pat* ]]; then
-    (( $+opts[-r] )) && eval "${opts[-r]}=$cmd"
+    (( $+opts[-r] )) && : ${(P)opts[-r]::=$cmd}
     _cmd_variant[$opts[-c]]="$cmd"
     return 0
   fi
 done
 
-(( $+opts[-r] )) && eval "${opts[-r]}=$1"
+(( $+opts[-r] )) && : ${(P)opts[-r]::=$1}
 [[ $pre != builtin ]] && _cmd_variant[$opts[-c]]="$1"
 
 return 1