From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3872 invoked by alias); 7 Jan 2012 20:17:47 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30101 Received: (qmail 5362 invoked from network); 7 Jan 2012 20:17:45 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 Received-SPF: neutral (ns1.primenet.com.au: 74.125.82.43 is neither permitted nor denied by SPF record at ntlworld.com) X-ProxyUser-IP: 86.6.29.42 Date: Sat, 7 Jan 2012 20:17:37 +0000 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: zsh hangs loading init files Message-ID: <20120107201737.44b3162c@pws-pc.ntlworld.com> In-Reply-To: <120106231700.ZM17143@torch.brasslantern.com> References: <20229.54117.22089.85103@gargle.gargle.HOWL> <20120105193518.GE80751@dan.emsphone.com> <120106231700.ZM17143@torch.brasslantern.com> X-Mailer: Claws Mail 3.7.10 (GTK+ 2.24.7; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 06 Jan 2012 23:17:00 -0800 Bart Schaefer wrote: > 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." Not sure it's even worth making this an option, since it's going to have to be off by default to avoid surprises and few people are going to bother to turn it on, and mosth PATH directories only contain executables anyway, but it's not much extra code. Index: Doc/Zsh/options.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v retrieving revision 1.105 diff -p -u -r1.105 options.yo --- Doc/Zsh/options.yo 28 Dec 2011 03:20:19 -0000 1.105 +++ Doc/Zsh/options.yo 7 Jan 2012 20:14:37 -0000 @@ -1155,6 +1155,20 @@ Whenever a command name is hashed, hash as well as all directories that occur earlier in the path. Has no effect if neither tt(HASH_CMDS) nor tt(CORRECT) is set. ) +pindex(HASH_EXECUTABLES_ONLY) +pindex(NO_HASH_EXECUTABLES_ONLY) +pindex(HASHEXECUTABLESONLY) +pindex(NOHASHEXECUTABLESONLY) +cindex(hashing, of executables) +cindex(executables, hashing) +item(tt(HASH_EXECUTABLES_ONLY))( +When hashing commands because of tt(HASH_COMMANDS), check that the +file to be hashed is actually an executable. This option +is unset by default as if the path contains a large number of commands, +or consists of many remote files, the additional tests can take +a long time. Trial and error is needed to show if this option is +beneficial. +) pindex(MAIL_WARNING) pindex(NO_MAIL_WARNING) pindex(MAILWARNING) Index: Src/hashtable.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/hashtable.c,v retrieving revision 1.34 diff -p -u -r1.34 hashtable.c --- Src/hashtable.c 9 May 2011 10:38:02 -0000 1.34 +++ Src/hashtable.c 7 Jan 2012 20:14:37 -0000 @@ -663,8 +663,9 @@ hashdir(char **dirp) * This is the same test as for the glob qualifier for * executable plain files. */ - if (stat(pathbuf, &statbuf) == 0 && - S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IXUGO)) + if (unset(HASHEXECUTABLESONLY) || + (stat(pathbuf, &statbuf) == 0 && + S_ISREG(statbuf.st_mode) && (statbuf.st_mode & S_IXUGO))) add = 1; } if (add) { Index: Src/options.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/options.c,v retrieving revision 1.58 diff -p -u -r1.58 options.c --- Src/options.c 8 Dec 2011 19:42:07 -0000 1.58 +++ Src/options.c 7 Jan 2012 20:14:37 -0000 @@ -140,6 +140,7 @@ static struct optname optns[] = { {{NULL, "globsubst", OPT_EMULATE|OPT_NONZSH}, GLOBSUBST}, {{NULL, "hashcmds", OPT_ALL}, HASHCMDS}, {{NULL, "hashdirs", OPT_ALL}, HASHDIRS}, +{{NULL, "hashexecutablesonly", 0}, HASHEXECUTABLESONLY}, {{NULL, "hashlistall", OPT_ALL}, HASHLISTALL}, {{NULL, "histallowclobber", 0}, HISTALLOWCLOBBER}, {{NULL, "histbeep", OPT_ALL}, HISTBEEP}, Index: Src/params.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/params.c,v retrieving revision 1.176 diff -p -u -r1.176 params.c --- Src/params.c 4 Jan 2012 22:35:55 -0000 1.176 +++ Src/params.c 7 Jan 2012 20:14:38 -0000 @@ -3780,9 +3780,6 @@ static struct localename { #ifdef LC_TIME {"LC_TIME", LC_TIME}, #endif -#ifdef LC_ALL - {"LC_ALL", LC_ALL}, -#endif {NULL, 0} }; @@ -3791,6 +3788,10 @@ static void setlang(char *x) { struct localename *ln; + char *x2; + + if ((x2 = getsparam("LC_ALL")) && *x2) + return; /* * Set the global locale to the value passed, but override Index: Src/zsh.h =================================================================== RCS file: /cvsroot/zsh/zsh/Src/zsh.h,v retrieving revision 1.178 diff -p -u -r1.178 zsh.h --- Src/zsh.h 8 Dec 2011 19:42:07 -0000 1.178 +++ Src/zsh.h 7 Jan 2012 20:14:38 -0000 @@ -1986,6 +1986,7 @@ enum { GLOBSUBST, HASHCMDS, HASHDIRS, + HASHEXECUTABLESONLY, HASHLISTALL, HISTALLOWCLOBBER, HISTBEEP, -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/