zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: gak@klanderman.net
Cc: zsh-workers@zsh.org
Subject: Re: zsh hangs loading init files
Date: Sat, 7 Jan 2012 02:56:45 +0100	[thread overview]
Message-ID: <CAHYJk3SOA70LoL-ajb1BJAY_Jg+6QQmgK52VMos6p9k-vhCimw@mail.gmail.com> (raw)
In-Reply-To: <m3hb08i98o.fsf@klanderman.net>

On 7 January 2012 02:36, Greg Klanderman <gak@klanderman.net> wrote:
>>>>>> On January 6, 2012 Mikael Magnusson <mikachu@gmail.com> wrote:
>
>> I suspect this is the one, http://www.zsh.org/mla/users/2009/msg00786.html
>
>> +2009-09-21  Peter Stephenson  <pws@csr.com>
>> +
>> +       * users/14411: Src/hashtable.c: only hash stat-able executable
>> +       regular files in the command table.
>> +
>
> You probably haven't gotten my followup to my followup yet.
>
> Adding "setopt nohashdirs" gets me past the $(uname -s) quickly, but
> then later, accessing $commands[foo] still causes it to go stat()
> every file under every element of my path.  Which is causing the 10-30
> second hang.

There is no option to disable the stat()ing while filling the hash,
and you do want to fill the hash, or you won't be able to complete any
command names.
% setopt no${^options[(I)hash*]}
% hash -r
% ls #to put one command in the hash
% l<tab>
---- external command
ls


Incidentally, the manpage says
       HASH_DIRS <D>
              Whenever a command name is hashed, hash the directory
containing it,
              as well as all directories that occur earlier in the path.  Has no
              effect if neither HASH_CMDS nor CORRECT is set.

However, setting hashdirs still causes the hash to be filled when both
hashcmds and correct are unset.

% setopt no${^options[(I)hash*]}
% hash -r
% ls
% hash | wc -l
1
% setopt hashdirs
% ls
% hash | wc -l
3480

-- 
Mikael Magnusson


  reply	other threads:[~2012-01-07  1:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-05 16:44 Greg Klanderman
2012-01-05 19:35 ` Dan Nelson
2012-01-07  1:12   ` Greg Klanderman
2012-01-07  1:27     ` Greg Klanderman
2012-01-07  1:28     ` Mikael Magnusson
2012-01-07  1:36       ` Greg Klanderman
2012-01-07  1:56         ` Mikael Magnusson [this message]
2012-01-07  7:17           ` Bart Schaefer
2012-01-07 20:17             ` Peter Stephenson
2012-01-09 20:19               ` Greg Klanderman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHYJk3SOA70LoL-ajb1BJAY_Jg+6QQmgK52VMos6p9k-vhCimw@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=gak@klanderman.net \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).