[tex-live] FInding locally installed packages in different environments

Karl Berry karl at freefriends.org
Fri Apr 20 00:08:01 CEST 2018


    I still find it extremely strange that this should be "irremediable" ...

It is not technically "irremediable". As I commented in
kpathsea/elt-dirs.c more than 25 years ago, it is perfectly easy to
avoid the optimization of a directory having 2 links => leaf => don't
check symlinks. Non-Unixy systems don't have that optimization
possibility, for instance.

However, the downside of turning off the optimization is that every
entry of every (heretofore leaf) directory will be stat(2)d. This is an
expensive operation, even on today's computers, because all that data
won't be in the disk/cpu caches, and will get promptly thrown away.

Having symlinks to outside dirs seems relatively rare to me. I don't
like the idea of making everyone pay a price to support a rare
occurrence.  Creating an empty directory in a directory with symlinks
that should be followed seems like a reasonable workaround to me.

However ... I guess the counterargument is that this whole optimization
only happens in non-!! directories like TEXMFHOME, and those are most
likely small, so then it doesn't matter how much extra work the
searching does.

So, I don't know. -k


-----------------------------------------------------------------------------
kpathsea/elt-dirs.c
..
              /* Should we recurse?  To see if the subdirectory is a
                 leaf, check if it has two links (one for . and one for
                 ..).  This means that symbolic links to directories do
                 not affect the leaf-ness.  This is arguably wrong, but
                 the only alternative I know of is to stat every entry
                 in the directory, and that is unacceptably slow.

                 The #ifdef here makes all this configurable at
                 compile-time, so that if we're using VMS directories or
                 some such, we can still find subdirectories, even if it
                 is much slower.  */
#ifdef ST_NLINK_TRICK
              /* With SAS/C++ 6.55 on the Amiga, stat sets the st_nlink
                 field to -1 for a file, or to 1 for a directory.
                 Cygwin 1.7 also leaves st_nlink as 1:
                 http://cygwin.com/ml/cygwin-developers/2008-04/msg00110.html
                 */
              if (links != 2)
#endif /* ST_NLINK_TRICK */
                /* All criteria are met; find subdirectories.  */
                  do_subdir (kpse, str_list_ptr, FN_STRING (name),
                           potential_len, post);
..


More information about the tex-live mailing list