Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh hangs loading init files



On 7 January 2012 02:36, Greg Klanderman <gak@xxxxxxxxxxxxxx> wrote:
>>>>>> On January 6, 2012 Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
>> I suspect this is the one, http://www.zsh.org/mla/users/2009/msg00786.html
>
>> +2009-09-21  Peter Stephenson  <pws@xxxxxxx>
>> +
>> +       * 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



Messages sorted by: Reverse Date, Date, Thread, Author