Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
_groups change for Mac OS X version 10.5
- X-seq: zsh-users 12154
- From: "Ryan F" <urbaleeted@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: _groups change for Mac OS X version 10.5
- Date: Wed, 31 Oct 2007 10:14:29 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=tE1Enczz1Y/GoQfBo14Q3KkpRrHSzSluMt2ycnYN4PQ=; b=qPXC8fiaudzIZmxns401YJVdweAhPhRIbICXumrb5RKxAvbCHWOW3mNs/7kyBuNZ4rPY+51nvDA7WppCkmL2fvjM9D1wMaZFFQGXOWXRGsHxX9uW3uUtC7tNDf/BU0dd41L+2RopzNcF0xCz34afDT3Zb+20VeACGhe+i9GHvss=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=sDKKr0PURqYEIoPvd2bQDFwkjx+FEuyy51dn0x/LL5eCQW9Kp1lAbZ1mst1Ksilh5LzjT2K8+Saw+f1cf/+XKrcYzLZqxBJZdM3ea07PQhnzp3rILCKj2z1LMr0/vYlpCoPpU89Im2uDTwhmp+YJoMg2EViM+ptCgGzVS4nPWGQ=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
Hi,
In Mac OS X version 10.5, the lookupd command has been replaced with dscacheutil, which requires a change to _groups in order for group completion to work properly. Here's what Apple has done:
--- zsh-4.3.4/Completion/Unix/Type/_groups 2005-06-08 07:45:35.000000000 -0500
+++ /usr/share/zsh/4.3.4/functions/_groups
2007-09-23 20:40:47.000000000 -0500
@@ -7,7 +7,7 @@
if ! zstyle -a ":completion:${curcontext}:" groups groups; then
(( $+_cache_groups )) ||
if [[ $OSTYPE = darwin* ]]; then
- : ${(A)_cache_groups:=${${(M)${(f)"$(_call_program groups lookupd -q group)"}:#name*}##*: }}
+ : ${(A)_cache_groups:=${${(M)${(f)"$(_call_program groups dscacheutil -q group)"}:#name*}##*: }}
elif (( ${+commands[getent]} )); then
: ${(A)_cache_groups:=${${(s: :)$(_call_program groups getent group 2>/dev/null)}%%:*}}
else
However, this change would break pre-10.5 systems which have lookupd and not dscacheutil. I propose something like this:
--- zsh-4.3.4/Completion/Unix/Type/_groups.orig
2007-10-28 16:41:48.000000000 -0500
+++ zsh-4.3.4/Completion/Unix/Type/_groups 2007-10-28 16:42:55.000000000 -0500
@@ -7,7 +7,11 @@
if ! zstyle -a ":completion:${curcontext}:" groups groups; then
(( $+_cache_groups )) ||
if [[ $OSTYPE = darwin* ]]; then
- : ${(A)_cache_groups:=${${(M)${(f)"$(_call_program groups lookupd -q group)"}:#name*}##*: }}
+ if (( ${+commands[lookupd]} )); then
+ : ${(A)_cache_groups:=${${(M)${(f)"$(_call_program groups lookupd -q group)"}:#name*}##*: }}
+ elif (( ${+commands[dscacheutil]} )); 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)}%%:*}}
else
I suppose one could even get rid of the 'if [[ $OSTYPE == darwin* ]]; then...fi' part but that may not be as safe if non-OS X systems ever implement lookupd and/or dscacheutil commands which behave differently from the same commands on OS X.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author