Behaviour of kpsea re symlinks to directories

Karl Berry karl at freefriends.org
Sun Mar 27 23:00:29 CEST 2022


Hi Yann,

    I would not call strictly a bug because this is, iirc, a documented 
    behaviour, 

Yes. https://tug.org/texinfohtml/kpathsea.html#Subdirectory-expansion

    So, is the performance tradeoff for doing so still occurring nowadays ? 

Well, (thankfully) nothing has changed about the relevant Unix
filesystem semantics. They still have st_nlink==2 if there are no
subdirectories.

    symlinks were checked before deciding not to recur, since we list all 
    files in the folder anyway ?

All entries should not get stat-ed, when there are no subdirs.
(Normally.) Kpse would not recurse into the directory to look for
subdirs. That's the whole point.

Or did I break this when I put in the casefolding madness? To be honest,
I'm not sure.
    
    And this is very difficult to pin down as the source of "texlive does 
    not find my files despite them being accessible from local texmf !!".

Yes, I understand the problem.

    ln -s /tmp/target ~/texmf/tex/latex/newfolder/link

I'm guessing the problem is only seen in TEXMFHOME? In other trees
(aside from the little-used/known TEXMFCONFIG and TEXMFVAR), !! is
specified so searches use ls-R, and the st_nlink trick does not apply --
and symlinks are not followed, or read, I think.

Now, since TEXMFHOME is generally small (relatively speaking), and the
other significant trees use !!, maybe we could turn off the check
without inducing noticeable pain.  People with very large TEXMFHOME's
might want to use !!, but they would probably already be doing that, if
they care.

I feel unsure. Can you try an analogous "symlink search" in TEXMFLOCAL?
Can you run a simple "symlink search" in TEXMFHOME under strace, and see
what stat() is called on?

Thanks,
Karl


More information about the tex-live mailing list.