Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
compaudit slow with many groups
- X-seq: zsh-workers 19662
- From: Danek Duvall <duvall@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: compaudit slow with many groups
- Date: Fri, 19 Mar 2004 13:57:24 -0800
- Mail-followup-to: Danek Duvall <duvall@xxxxxxxxxxx>, zsh-workers@xxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
At work, we have 1168 groups defined in NIS, and the entire database
dumped via "getent group" is over 100kB. This makes compaudit very slow
on startup if the groups are not all cached locally, and makes it a drag
logging in to a machine with zsh as my shell.
The code to blame is on line 85:
local GROUP GROUPMEM _i_pw _i_gid _i_ulwdirs
while IFS=: read GROUP _i_pw _i_gid GROUPMEM; do
if (( UID == EUID )); then
[[ $GROUP == $LOGNAME ]] && break
else
(( _i_gid == EGID )) && break # Somewhat arbitrary
fi
done <<(getent group)
which seems somewhat inefficient. Would something along the lines of
local GROUP GROUPMEM _i_pw _i_gid _i_ulwdirs
if (( UID == EUID )); then
getent group $UID | IFS=: read GROUP _i_pw _i_gid GROUPMEM
[[ $GROUP == $LOGNAME ]] || unset GROUP GROUPMEM
else
getent group $EGID | IFS=: read GROUP _i_pw _i_gid GROUPMEM
(( _i_gid == EGID )) || unset GROUP GROUPMEM
fi
work? I'm not positive this is the right set of tests, but if not,
there ought to be some similar way of reducing the overhead of the
function. Is there any system where getent can't take two arguments?
Or perhaps it ought to be conditional on some style being set or unset.
Thanks,
Danek
Messages sorted by:
Reverse Date,
Date,
Thread,
Author