* [patch] groups with spaces
@ 2015-11-22 23:15 Matthew Martin
0 siblings, 0 replies; only message in thread
From: Matthew Martin @ 2015-11-22 23:15 UTC (permalink / raw)
To: zsh-workers
While most utilities to disallow groups with spaces, LDAP seems to have
no such qualms. Patch below to handle spaces in _groups. (Apologies if
it's mangled; my normal mail setup is currently blocked.)
_chgrp tries to be helpful and only suggest a user's groups for
effectively non-root users. Both groups and id -Gn separate groups by
spaces, so their output can't distinguish between two groups and
a single group with a space in it. Should there be a _user_groups type
that can
${${(f)"$(getent group $(id -G))"}%%:*}
along with whatever OS X and YP need?
- Matthew Martin
diff --git a/Completion/Unix/Type/_groups b/Completion/Unix/Type/_groups
index a562426..c5e5aaf 100644
--- a/Completion/Unix/Type/_groups
+++ b/Completion/Unix/Type/_groups
@@ -13,9 +13,9 @@ if ! zstyle -a ":completion:${curcontext}:" groups
groups; then
: ${(A)_cache_groups:=${${(M)${(f)"$(_call_program groups
dscacheutil -q group)"}:#name*}##*: }}
fi
elif (( ${+commands[getent]} )); then
- : ${(A)_cache_groups:=${${(s: :)$(_call_program groups getent
group 2>/dev/null)}%%:*}}
+ : ${(A)_cache_groups:=${${(f)"$(_call_program groups getent
group 2>/dev/null)"}%%:*}}
else
- : ${(A)_cache_groups:=${${${(s: :)$(</etc/group)}%%:*}:#+}}
+ : ${(A)_cache_groups:=${${${(f)"$(</etc/group)"}%%:*}:#+}}
if (( ${+commands[ypcat]} )) &&
tmp=$(_call_program groups ypcat group.byname 2>/dev/null); then
_cache_groups+=( ${${(f)tmp}%%:*} ) # If you use YP
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-11-22 23:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-22 23:15 [patch] groups with spaces Matthew Martin
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).