[tex-k] kpsewhich, TEXINPUTS, -expand-var, and -progname

Olaf Weber olaf@infovore.xs4all.nl
02 Apr 2001 09:09:48 +0200


Tom Kacvinsky writes:

> I am in the process of setting up some shell scripts wherby I
> customize search paths by setting the environment TEXINPUTS (I'm
> using tcsh).  The way I am customizing TEXINPUTS is by appending `:'
> to a `:' separated list of paths.  For example:

>     setenv TEXINPUTS /foo//:/bar//:

> What I would then like to see is how TEXINPUTS looks when latex,
> tex, pdftex, et. al. are invoked.  I am trying to do this by using
> kpsewhich:

>    kpsewhich -progname=tex -expand-var='$TEXINPUTS'
>    kpsewhich -progname=latex -expand-var='$TEXINPUTS'

>    etc...

> The output I get is simply this:

>    /foo//:/bar//:

> What I would expect to see (because of the trailing `:') is this:

>   /foo//:/bar//:<contents of TEXINPUTS.latex, TEXINPUTS.tex, etc...>

> Where the stuff in <...> depends on which program name is supplied with the
> -progname switch.

> Is this a bug in kpsewhich, or is kpsewhich acting as intended?

kpsewhich is acting as it is written.  Whether this should be as
intended is another issue.  Compare:

infovore:/home/olaf$ kpsewhich --progname=latex --expand-var='$TEXINPUTS'
.:{/home/olaf/texmf,!!/var/lib/texmf,!!/usr/local/share/texmf.local,!!/usr/local/share/texmf}/tex/{latex,generic,}//
infovore:/home/olaf$ TEXINPUTS_latex=/tmp/foo//: kpsewhich --progname=latex --expand-var='$TEXINPUTS'
/tmp/foo//:

As you noted, --expand-var does not append the "default" settings.
--show-path does, but it also expands the '//' constructs, which is
I/O (and time) expensive.

I'd like to change kpsewhich so that in --expand-var works as you
expected, so that the last example would become

infovore:/home/olaf$ TEXINPUTS_latex=/tmp/foo//: kpsewhich --progname=latex --expand-var='$TEXINPUTS'
/tmp/foo//:.:{/home/olaf/texmf,!!/var/lib/texmf,!!/usr/local/share/texmf.local,!!/usr/local/share/texmf}/tex/{latex,generic,}//

The question is, to what extent do scripts and such rely on the
current behaviour; is this a change that can be made without imposing
unreasonable costs on others?

-- 
Olaf Weber

Do not meddle in the affairs of sysadmins,
        for they are quick to anger and have no need for subtlety.