summary refs log tree commit diff
path: root/Completion/Unix
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-11-24 07:02:11 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-11-28 07:16:39 +0000
commit1955cceec79107b6571646b695d334df8e4a6cd8 (patch)
tree4acf7ec7315d5361561254e1d2088886342c2c47 /Completion/Unix
parenta81f280bfa185ba1df9c5ffee535631e4f1736f4 (diff)
downloadzsh-1955cceec79107b6571646b695d334df8e4a6cd8.tar.gz
zsh-1955cceec79107b6571646b695d334df8e4a6cd8.tar.xz
zsh-1955cceec79107b6571646b695d334df8e4a6cd8.zip
40011: Make $_comp_priv_prefix only declared when required, and use that to have chgrp offer all groups under doas, ssh, etc as well.
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Command/_chown4
-rw-r--r--Completion/Unix/Command/_doas1
-rw-r--r--Completion/Unix/Command/_sudo1
3 files changed, 4 insertions, 2 deletions
diff --git a/Completion/Unix/Command/_chown b/Completion/Unix/Command/_chown
index 641b5a773..5750c65ab 100644
--- a/Completion/Unix/Command/_chown
+++ b/Completion/Unix/Command/_chown
@@ -45,8 +45,8 @@ _arguments -C -s "$args[@]" '*:files:->files' && ret=0
 case $state in
   owner)
     if [[ $service = chgrp ]] || compset -P '*[:.]'; then
-      if (( EGID && $+commands[groups] && ! $+funcstack[(r)_sudo] )); then  # except for root
-       _wanted groups expl 'group' compadd $(groups) && return 0
+      if (( EGID && $+commands[groups] && ! $+_comp_priv_prefix )); then  # except for sudo
+       _wanted groups expl 'group' compadd -- $(groups) && return 0
       fi
       _groups && ret=0
     else
diff --git a/Completion/Unix/Command/_doas b/Completion/Unix/Command/_doas
index b36388ead..94395557c 100644
--- a/Completion/Unix/Command/_doas
+++ b/Completion/Unix/Command/_doas
@@ -1,6 +1,7 @@
 #compdef doas
 
 local environ e cmd
+local -a _comp_priv_prefix
 
 zstyle -a ":completion:${curcontext}:" environ environ
 
diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo
index 0a212b723..aa7a1a498 100644
--- a/Completion/Unix/Command/_sudo
+++ b/Completion/Unix/Command/_sudo
@@ -4,6 +4,7 @@ setopt localoptions extended_glob
 
 local environ e cmd
 local -a args
+local -a _comp_priv_prefix
 
 zstyle -a ":completion:${curcontext}:" environ environ