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

Re: The default $fpath



On Sun, 07 Sep 2014 14:01:22 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> } The proposal is simply to provide a directory where there's some
> } reasonable chance it will be found by all installations of the shell on
> } the same system regardless of configuration.
> 
> Actually, I think the proposal is to provide a directory where all OTHER
> softwares' configuration systems can install shell functions so that they
> are found by all installations of zsh on ANY system, regardless of the
> local-zsh-builder's and/or system-zsh-packager's idea of the path to the
> functions provided by zsh itself.

Yes, indeed, the idea is to make this as global as possible.  If you
happen not to use this directory, that's fine: (i) the shell itself and
the standard installation stuff don't care (ii) presumably, therefore,
you've made your own arrangements for fpath, which is the best guarantee
of consistency on your system anyway.

> } [...] If this builtin default becomes configurable
> } to use different directories the whole advantage is lost; it's far better
> } to use common run-time code to ensure a non-default directory.
> 
> This point, however, holds true either way.  I just think it's impossible
> to promise that the directory will exist; certainly the zsh installer
> should not unilaterally create it.

Yes, I agree with both points.  I don't think that removes its utility,
though.

> } I'd really like to know if there are any problems caused by *this*
> } proposal, adding /usr/local/share/zsh/site-functions to the compiled-in
> } path.
> 
> I can't think of any; presumably the configure-time (?) code for this
> would resemble
> 
>     if [ X$ac_default_prefix != X/usr/local ]
>     then fixed_sitefndir=/usr/local/zsh/site-functions
>     elif [ X$tzsh_name != Xzsh ]
>     then fixed_sitefndir=/usr/local/zsh/site-functions
>     else fixed_sitefndir=''
>     fi
> 
> and then zsh.mdd would use something like
> 
>     echo '#define FIXED_FPATH_DIR "'$(fixed_sitefndir)'"' >> zshpaths.h.tmp;
> 
> and finally somewhere in Src/init.c the fpath would be prefixed with the
> value of FIXED_FPATH_DIR if it is non-empty.

OK, so that's an answer to my other open question: you're suggesting (i)
if the prefix is /usr/local and this is a standard zsh installation
we keep things the way they are (ii) otherwise the new component is
the first thing to be tried in the default fpath.

> The worst that happens is that /usr/local is a remote file system (which
> would seem rather unlikely) and zsh gets slowed down every time fpath is
> searched for a directory there that doesn't exist.

Does seem a bit perverse...  we could add a --disable-fixed-sitenfndir
for the paranoid.  In other words, this is a simple boolean; either you
want the shell to be compatible with this pseudostandard, or you don't.

pws



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