1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-11 09:40:59 +01:00

40011: Make $_comp_priv_prefix only declared when required, and use that to have chgrp offer all groups under doas, ssh, etc as well.

This commit is contained in:
Daniel Shahaf 2016-11-24 07:02:11 +00:00
parent a81f280bfa
commit 1955cceec7
7 changed files with 17 additions and 5 deletions

View file

@ -1,5 +1,13 @@
2016-11-28 Daniel Shahaf <d.s@daniel.shahaf.name>
* 40011: Completion/Base/Core/_main_complete,
Completion/Solaris/Command/_pfexec,
Completion/Solaris/Command/_zlogin,
Completion/Unix/Command/_chown, Completion/Unix/Command/_doas,
Completion/Unix/Command/_sudo: Make $_comp_priv_prefix only
declared when required, and use that to have chgrp offer all
groups under doas, ssh, etc as well.
* 40010: Src/builtin.c, Test/A02alias.ztst: builtins: Say
'bad option: +x', not 'bad option: -x', when +x was passed.

View file

@ -38,7 +38,9 @@ local func funcs ret=1 tmp _compskip format nm call match min max i num\
_saved_colors="$ZLS_COLORS" \
_saved_colors_set=${+ZLS_COLORS} \
_ambiguous_color=''
local -a _comp_priv_prefix
# Hide any '_comp_priv_prefix' variable that happens to be defined in the calling scope.
local _comp_priv_prefix
unset _comp_priv_prefix
# _precommand sets this to indicate we are following a precommand modifier
local -a precommands

View file

@ -22,6 +22,7 @@ _privset() {
}
_pfexec() {
local -a _comp_priv_prefix
_arguments \
'-P[privileges to acquire]:privspec:_privset' \
'(-):command name: _command_names -e' \

View file

@ -1,9 +1,8 @@
#compdef zlogin
# Synced with the Nevada build 162 man page
local -a _comp_priv_prefix
_zlogin() {
local -a _comp_priv_prefix
_arguments -s \
'-E[Disable escape character]' \
'-e[Specify escape character]:character:' \

View file

@ -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

View file

@ -1,6 +1,7 @@
#compdef doas
local environ e cmd
local -a _comp_priv_prefix
zstyle -a ":completion:${curcontext}:" environ environ

View file

@ -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