finding locations of many files via kpse

Karl Berry karl at freefriends.org
Wed Jul 3 00:10:15 CEST 2024


Hi Norbert (and Deyan and all),

    Maybe I look into kpsewhich and an options to output a different format
    where missing files are easily distinguished.

I think you or I should add a couple of print statements so that in the
case of multiple input files, the output is better. First idea:

someinputfile.tex<tab>/some/location/someinputfile.tex
nonesuch.tex

Or in the case of -a, put all the results on the same line:
etex.src<tab>/u/texlive/karl/Master/texmf-dist/tex/luatex/hyph-utf8/etex.src<tab>/u/texlive/karl/Master/texmf-dist/tex/plain/etex/etex.src
nonesuch.tex

In any case, the idea is to make it simple to tell the result for each
search.  I clearly never thought about actual usage for the multiple
input files case.  The current output of reporting only the matches
seems useless (it was just how it came out "by default" as I writing the
program).  Deyan, are you actually parsing the output from
multiple-inputs?

Although maybe for compatibility-safety the new format should only be
enabled with an option, unfortunately.

As for the output format: No TL filename will ever contain a tab, but I
guess users' files might. Or a NUL byte. Maybe a --delimiter option
(yuck). Or a more complex format where the results are on different
lines, for complete generality, for isntance:

someinputfile.tex
->/some/location/someinputfile.tex
nonesuch 
->

Anyway, you get the idea. Let's just fix kpsewhich. Not hard.
See the "/* Usual case: look up each given
filename." loop at the end of kpsewhich.c.

Overall, I expect updating the documentation, writing a test, etc., will
be more work than tweaking the code :).


Finally, another alternative: if it needs to work with old kpsewhich, it
occurs to me (untested) that you could parse the --debug output. You
could narrow the debug output with whatever option gives the result and
as little else as possible. (I can research if need be.) -k


More information about the texhax mailing list.