zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: zsh hangs loading init files
Date: Fri, 06 Jan 2012 23:17:00 -0800	[thread overview]
Message-ID: <120106231700.ZM17143@torch.brasslantern.com> (raw)
In-Reply-To: <m3k454i9oy.fsf@klanderman.net>
In-Reply-To: <CAHYJk3T+_Ym1pSLL-Koz=xjifmpWrJEUB5kJO2bWEgBnPPn8Fw@mail.gmail.com>
In-Reply-To: <m3hb08i98o.fsf@klanderman.net>
In-Reply-To: <CAHYJk3SOA70LoL-ajb1BJAY_Jg+6QQmgK52VMos6p9k-vhCimw@mail.gmail.com>

On Jan 6,  8:27pm, Greg Klanderman wrote:
}
} hmm looks like users/14411

In that message, PWS pondered:

> I'm not sure why we don't check that commands are executables, was there
> ever a reason?

Apparently the answer is "Yeah, if you've got 10,000 executables or
a remote filesystem in your path, it takes a really long time to stat
them all."

On Jan 6,  8:36pm, Greg Klanderman wrote:
}
} 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.

The zsh/parameter module uses the HASH_LIST_ALL option to determine
whether to fill the hash table when referencing $commands.  I'm not
sure that's documented anywhere ... this is also true for spelling
correction, so the part of the HASH_CMDS doc that refers to CORRECT
is at least incomplete.

Another way to cause the table to be filled is to use "whence -m".

On Jan 7,  2:56am, Mikael Magnusson wrote:
}
} There is no option to disable the stat()ing while filling the hash

Perhaps what should have been done is to stat them when reading them
back, but that would have required some state bits in the table.  An
option would be the next best thing.

} 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.

Hrm.  I'm not able to reproduce that from "zsh -f".

torch% setopt no${^options[(I)hash*]}
torch% hash -r
torch% ls
...
torch% print $#commands
0
torch% setopt hashdirs
torch% ls
...
torch% print $#commands
0
torch% 


  reply	other threads:[~2012-01-07  7:17 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
2012-01-07  7:17           ` Bart Schaefer [this message]
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=120106231700.ZM17143@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --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).