From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4322 invoked from network); 19 Mar 2004 21:57:33 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 19 Mar 2004 21:57:33 -0000 Received: (qmail 28664 invoked by alias); 19 Mar 2004 21:57:27 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 19662 Received: (qmail 28570 invoked from network); 19 Mar 2004 21:57:26 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 19 Mar 2004 21:57:26 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [66.93.131.57] by sunsite.dk (MessageWall 1.0.8) with SMTP; 19 Mar 2004 21:57:26 -0000 Received: from lorien.emufarm.org (localhost [127.0.0.1]) by lorien.emufarm.org (8.12.7/8.12.7) with ESMTP id i2JLvO1t014581 for ; Fri, 19 Mar 2004 13:57:25 -0800 Received: (from duvall@localhost) by lorien.emufarm.org (8.12.7/8.12.7/Submit) id i2JLvOC6014580 for zsh-workers@sunsite.dk; Fri, 19 Mar 2004 13:57:24 -0800 Date: Fri, 19 Mar 2004 13:57:24 -0800 From: Danek Duvall To: zsh-workers@sunsite.dk Subject: compaudit slow with many groups Message-ID: <20040319215724.GB23658@lorien.emufarm.org> Mail-Followup-To: Danek Duvall , zsh-workers@sunsite.dk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.4i 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