Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Multi-Minute Startup?
- X-seq: zsh-users 13117
- From: "Aaron Davies" <aaron.davies@xxxxxxxxx>
- To: "Zsh Users" <zsh-users@xxxxxxxxxx>
- Subject: Re: Multi-Minute Startup?
- Date: Fri, 8 Aug 2008 14:33:09 +0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=Jdf2kbDCjM8AGeM2eG1YezTLkf9FtFpy18QfbQkRpkA=; b=nVmhfKlPZiy9caEM+o7g8yWYv2skXsYfVPXP7qAgabNy4h0N3T91jilFjJ7YH5Vbdl YNJz8BK43mgWhQWtq3E6FwqzVks22LOw4U4Rg/3qxVISivh6mnRi742P+6basOIiaykl qLQosh1WD53qFoFtUVgwaKxQu+snZ8s+u9soU=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=od4vvCm+rcaHwMr5TELYchm7MGv3Giw37rmZoUyoBd7KS8+RAlVUf9Tatt3RZm/lby f9nJ+o3i3KDC1fqnfUhmBQK2JJKb1ITQjWJoN09MbYuh04U/z46iySk2C8jSMYh5CT2x 26mvz8LigPHxMAD1aqnximGWt7hnoi8QdO8VM=
- In-reply-to: <c4e763ac0808071832j6f7393fay158c7a2485ca41c9@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <c4e763ac0808062357g44f7b75amf30db12fc1535409@xxxxxxxxxxxxxx> <alpine.LNX.1.10.0808070254580.26055@xxxxxxxxxxxxxxxxxxxxx> <c4e763ac0808070020r595f3b64u38eeefbc37bc85b6@xxxxxxxxxxxxxx> <alpine.LNX.1.10.0808070327310.26055@xxxxxxxxxxxxxxxxxxxxx> <c4e763ac0808070152k2846913dn4b637fe9ea275ef2@xxxxxxxxxxxxxx> <alpine.LNX.1.10.0808070509320.26055@xxxxxxxxxxxxxxxxxxxxx> <c4e763ac0808071832j6f7393fay158c7a2485ca41c9@xxxxxxxxxxxxxx>
On Fri, Aug 8, 2008 at 9:32 AM, Aaron Davies <aaron.davies@xxxxxxxxx> wrote:
> On Thu, Aug 7, 2008 at 5:28 PM, Benjamin R. Haskell <zsh@xxxxxxxxxx> wrote:
>
>> On Thu, 7 Aug 2008, Aaron Davies wrote:
>>
>>> Looking at compaudit itself, it looks like it's still running "getent
>>> group".
>>
>> Looking at compaudit more closely leads me to think something might be awry
>> with your environment variables (either LOGNAME or EGID). On my system
>> (Gentoo w/Zsh 4.3.4), the parts of compaudit germane to getent are:
>>
>>
>> ===============================
>> [[ -x /usr/bin/getent ]] || getent() {
>> if [[ $2 = <-> ]]; then
>> grep ":$2:[^:]*$" /etc/$1
>> else
>> grep "^$2:" /etc/$1
>> fi
>> }
>>
>> # ... trimmed
>>
>> # RedHat Linux "per-user groups" check. This is tricky, because it's very
>> # difficult to tell whether the sysadmin has put someone else into your
>> # "private" group (e.g., via the default group field in /etc/passwd, or
>> # by NFS group sharing with an untrustworthy machine). So we must assume
>> # that this has not happened, and pick the best group.
>>
>> local GROUP GROUPMEM _i_pw _i_gid _i_ulwdirs
>> if ((UID == EUID )); then
>> getent group $LOGNAME | IFS=: read GROUP _i_pw _i_gid GROUPMEM
>> else
>> getent group $EGID | IFS=: read GROUP _i_pw _i_gid GROUPMEM
>> fi
>> ===============================
>>
>> Is getent installed in /usr/bin on that machine? If not, maybe it's doing a
>> grep over a large, generated file? (Three minutes seems excessive, though.)
>
> getent is definitely present, and anyway, /etc/passwd and /etc/group
> are tiny stub files on this box--no more than 50 lines each.
>
>> If getent is there, maybe LOGNAME or EGID (whichever path is appropriate) is
>> unset. So, instead of (w/ a username of 'aaron'):
>
> LOGNAME appears to be set correctly (adavies).
>
>> getent group aaron | IFS=: read GROUP _i_pw _i_gid GROUPMEM
>> (finding a specific group's members, which should be fast, even over a long
>> distance -- otherwise many common operations would be annoyingly slow)
>>
>> it becomes:
>>
>> getent group | IFS=: read GROUP _i_pw _i_gid GROUPMEM
>> (which should be slow, since you're reading all 10,000 groups)
>>
>>
>> Can you find the specific invocation of getent that's slow for you?
>
> The code in my compaudit is
>
> ===============================
> # RedHat Linux "per-user groups" check. This is tricky, because it's very
> # difficult to tell whether the sysadmin has put someone else into your
> # "private" group (e.g., via the default group field in /etc/passwd, or
> # by NFS group sharing with an untrustworthy machine). So we must assume
> # that this has not happened, and pick the best group.
>
> 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 looks to me like it *will* get all groups.
>
> FWIW, "getent group" returns 773 lines and takes about 3.5 minutes to run.
i should add that this zsh reports itself as "zsh 4.2.0
(x86_64-suse-linux)", which looks seriously archaic. I don't see any
sign (from a quick scan of YaST and of novell's website) that anything
more recent is available pre-packaged for SuSE enterprise server
9--anyone know different, or will I have to try to convince the admins
to let me install from source?
--
Aaron Davies
aaron.davies@xxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author