[tex-live] Patch for "texdoc -s" to use the ls-R database

Frank Küster frank at kuesterei.ch
Mon May 28 12:18:49 CEST 2007

"George N. White III" <gnwiii at gmail.com> wrote:

> On 5/25/07, Frank Küster <frank at kuesterei.ch> wrote:
>> Hi all,
>> with teTeX, I've been using "texdoc -s" a lot.  With a full texlive
>> install, this is hardly usable, because it runs "find" over all
>> $TEXMF/doc trees, which takes ages.  Of course if you use it a second
>> time, it's much faster as long as the directories are cached, but you
>> never want to use it the first time, not with utilities like "locate"
>> present on your system.
> I not sure what you mean.  Your script just looks in the last
> texmf-tree.  The reason for using TEXDOCS is to ensure that
> all the $TEXMF/doc trees are searched.

That's of course a bug in my patch, but the difference between grepping
through a couple of ls-R files and running find over as many TEXMF trees
should be significant on any system.

> Unfortunately, kpsewhich --expand-path='$TEXDOCS'
> gives directories under the top-level "doc" directory.

 kpsewhich --expand-braces='$TEXDOCS' 

> The loop to construct lsR_files:
>      OLDIFS=$IFS
>      IFS=':'
>      for path in `kpsewhich --expand-path='$TEXMF'`; do
>       lsR_files=$(eval TEXMFDBS=\$path kpsewhich ls-R)
>      done
>      IFS=$OLDIFS
> saves only the last one.  Do you want to exclude the other
> trees, or did you mean:
>       lsR_files="$lsR_files $(env TEXMFDBS=$path kpsewhich ls-R)"

Yes, that's the bug.

> There are still performance problems.  Try to find the latin modern
> docs:
> "texdoc -s lmodern" doesn't help, but "texdoc -s lm" takes much too
> long because the last kpathsea search is run for every lm*.tfm file!
> What is needed is a way to select only the shortest prefixes from
> "kpsewhich --expand-path='$TEXDOCS'" so that find isn't searching
> the same places over and over:
> $ kpsewhich --expand-path='$TEXDOCS' | tr ':' ' ' | wc
>      1    1630  110497

I'll think about that.

Regards, Frank

Dr. Frank Küster
Single Molecule Spectroscopy, Protein Folding @ Inst. f. Biochemie, Univ. Zürich
Debian Developer (teTeX/TeXLive)

More information about the tex-live mailing list