Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[patch] groups with spaces
- X-seq: zsh-workers 37201
- From: Matthew Martin <phy1729@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: [patch] groups with spaces
- Date: Sun, 22 Nov 2015 17:15:39 -0600
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=nFq6pRBn32T0z1iC8HALOdH2GsQbTx3hESiIB8aSmy4=; b=Nwd3ewUExLEuO1oHCfY9UsL3Mp2UWogtQBVNupCEp7i1buSZqYbZSNRHiwOs4wuqFM mWCBE/erVAYSN4BUIKwyYmKBd/gTAu4cZHvRBOEJ83aIRWbonIzJhQFvxXz9HoAHzTF7 GXlGarv7PCpVebLtQPAFccpIorEzTTp0CZRaCRnvIGUSkhjKN8zApjrAY03j4YoJM+Ka ueHGjCMc0WfpYLPu8RtfjYFyWkO1GdJS0uSnU524IrLQAaW7TlgmSQW0UW9/+UgZgGI8 eBQuOi8S8trh6wdz3J3WlO2AHP8DuIV1sJjx/biZKoD9c6HcFAAGKjKNsOOHarNTHjcG QRPA==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author