Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

luaotfload does not follow symlinks #325

Closed
fgrsnau opened this issue Apr 4, 2016 · 2 comments
Closed

luaotfload does not follow symlinks #325

fgrsnau opened this issue Apr 4, 2016 · 2 comments

Comments

@fgrsnau
Copy link

fgrsnau commented Apr 4, 2016

If the ~/.fonts directory is symlinked to a different directory, luaotfload fails to index fonts in this location. Only scanning is affected. Once the fonts are included in the luaoftload font database everthing works as expected.

In file luaotfload-database.lua the functions find_files_indeed and find_files use the function lfsisdir and thus simply skip symlinks. Something like lfslisdir (in the sense of stat vs lstat) should have been used.

@phi-gamma
Copy link
Member

···<date: 2016-04-04, Monday>···<from: Stefan Haller>···

Thanks for reporting!

If the ~/.fonts directory is symlinked to a different
directory, luaotfload fails to index fonts in this location. Only
scanning is affected. Once the fonts are included in the
luaoftload font database everthing works as expected.

Scanning works here:

~ ▶ luaotfload-tool -V

luaotfload-tool:
        Luaotfload font management and diagnostic utility.
        License: GNU GPL v2.0.
        Report problems to <https://github.com/lualatex/luaotfload/issues>

luaotfload-tool version: "2.6"
Revision: "55799dad5b8a2716aea1cfee28b4ce093e587f8a"
Lua interpreter: stock; version "Lua 5.2"
Luatex version: 0.89.4
Platform: type=unix name=linux
    +  machine: x86_64
    + nodename: phlegethon
    +  release: 4.1.19-1-lts
    +  sysname: Linux
    +  version: #1 SMP Sun Mar 6 09:23:49 CET 2016
Index: version="55799dad5b8a2716aea1cfee28b4ce093e587f8a
~ ▶ [ -d .fonts ] || echo "nope" 2>&1
~ ▶ luaotfload-tool -uv
luaotfload | db : Updating the font names database.
luaotfload | db : Scanning TEXMF for fonts...
luaotfload | db : Scanning system fonts...
luaotfload | db : Scanning 3200 collected font files ...
~ ▶ luaotfload-tool --list '*' >/tmp/fonts-content-before
~ ▶ mv .fonts actual-home-fonts
~ ▶ luaotfload-tool -uv
luaotfload | db : Updating the font names database.
luaotfload | db : Scanning TEXMF for fonts...
luaotfload | db : Scanning system fonts...
luaotfload | db : Scanning 2595 collected font files ...
~ ▶ ln -s actual-home-fonts .fonts
~ ▶ readlink -f .fonts
/home/phg/actual-home-font
~ ▶ luaotfload-tool -uv
luaotfload | db : Updating the font names database.
luaotfload | db : Scanning TEXMF for fonts...
luaotfload | db : Scanning system fonts...
luaotfload | db : Scanning 3200 collected font files ...
~ ▶ luaotfload-tool --list '*' >/tmp/fonts-content-after
~ ▶ diff -q /tmp/fonts-content-before /tmp/fonts-content-after
~ ▶ 

What does readlink ~/.fonts return?
What does luaotfload -V yield for you?

Best,
Philipp

@phi-gamma
Copy link
Member

I’ve just given this another go because I wasn’t sure: There’s no bug.
In fact, lfs.isdir() does follow links, as does lfs.attributes() if
called on a symlink path. Try this and you’ll see:

#!/usr/bin/env texlua
print (">>", lfs.isdir("/home/MYUSER/.fonts") and "dir" or "nope")
print (">>", lfs.attributes("/home/MYUSER/.fonts", "mode"))
print (">>", lfs.attributes("/home/MYUSER/.fonts"))

Consequently, Luaotfload correctly finds fonts if ~/.fonts or anything
under it are just symlinks.

Please reopen if you have further data.

phi-gamma added a commit to phi-gamma/luaotfload that referenced this issue Jun 8, 2016
Addresses lualatex#359 and lualatex#325

To avoid duplicate entries, paths have to be resolved before collecting
them. This necessitates loop detection of some sort, currently
implemented naively as a flat table containing the directories already
traversed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants