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

Re: hashdirs in non-interactive shell

On Feb 3,  6:14pm, Nikolai Weibull wrote:
} Why is hashdirs on by default in a non-interactive shell?  This option
} can increase start-up time quite a bit on systems were stat() isn't
} unnecessarily fast.

The short answer is that it's on by default because the state of most
options is determined only by what emulation mode is in effect, and
it didn't occur to anyone to make an exception of HASH_DIRS.

The longer answer is that there are so many options that we long ago
gave up trying to manage implicit dependencies among them, so there
are a large number of what might be considered nonsense combinations.
After considerable argument, the default set ended up being those
that seemed likely to be most attractive to a new interactive user.

Still, at the risk of descending onto the slippery slope, we could
handle this the way MONITOR is now handled.  The slippery part is
that this likely applies to CORRECT, all the completion and history
options, and so on, and off we go ...

Index: init.c
RCS file: /extra/cvsroot/zsh/zsh-4.0/Src/init.c,v
retrieving revision 1.34
diff -c -r1.34 init.c
--- init.c	21 Dec 2010 16:41:16 -0000	1.34
+++ init.c	4 Feb 2011 15:55:49 -0000
@@ -243,6 +243,7 @@
      * still 2 at the end, we set it to the value of INTERACTIVE.
     opts[MONITOR] = 2;   /* may be unset in init_io() */
+    opts[HASHDIRS] = 2;  /* same relationship to INTERACTIVE */
     opts[SHINSTDIN] = 0;
     opts[SINGLECOMMAND] = 0;
@@ -351,6 +352,8 @@
     opts[INTERACTIVE] = !!opts[INTERACTIVE];
     if (opts[MONITOR] == 2)
 	opts[MONITOR] = opts[INTERACTIVE];
+    if (opts[HASHDIRS] == 2)
     pparams = x = (char **) zshcalloc((countlinknodes(paramlist) + 1) *
sizeof(char *));
     while ((*x++ = (char *)getlinknode(paramlist)));

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