mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-29 10:23:29 +00:00
texlive: fix kpathsea path expansion.
When expanding path variables, kpathsea uses a trick to speed up identifying leaf directories. The manual says > The trick is that in every real Unix implementation (as opposed to the POSIX > specification), a directory which contains no subdirectories will have > exactly two links (namely, one for . and one for ..). That is to say, the > st_nlink field in the ‘stat’ structure will be two. Thus, we don’t have to > stat everything in the bottom-level (leaf) directories—we can just check > st_nlink, notice it’s two, and do no more work. > > But if you have a directory that contains a single subdirectory and 500 > regular files, st_nlink will be 3, and Kpathsea has to stat every one of those > 501 entries. Therein lies slowness. > > You can disable the trick by undefining ST_NLINK_TRICK in > kpathsea/config.h. (It is undefined by default except under Unix.) This does not work as expected with nixpkgs symlink trees and programs that rely on kpathsea path expansion do not work properly. One example is luaotfload's font database, which is populated by the font files in the directories obtained by path-expanding the value of the `OPENTYPEFONTS` configuration variable with kpathsea. The expanded value can be checked with `kpsewhich --show-path="opentype fonts"`. Before this change, the expanded value does not include the various font directories symlinked into `/texmf/fonts/opentype/public`, since kpathsea considers this a leaf directory (every child is a symlink, not a directory). Hence luaotfload does not find the fonts in the texlive installation. This patch disables this trick.
This commit is contained in:
parent
d4a78d5f09
commit
bab298bf03
@ -30,6 +30,14 @@ let
|
||||
for i in texk/kpathsea/mktex*; do
|
||||
sed -i '/^mydir=/d' "$i"
|
||||
done
|
||||
|
||||
# ST_NLINK_TRICK causes kpathsea to treat folders with no real subfolders
|
||||
# as leaves, even if they contain symlinks to other folders; must be
|
||||
# disabled to work correctly with the nix store", see section 5.3.6
|
||||
# “Subdirectory expansion” of the kpathsea manual
|
||||
# http://mirrors.ctan.org/systems/doc/kpathsea/kpathsea.pdf for more
|
||||
# details
|
||||
sed -i '/^#define ST_NLINK_TRICK/d' texk/kpathsea/config.h
|
||||
'';
|
||||
|
||||
configureFlags = [
|
||||
|
Loading…
Reference in New Issue
Block a user