More useful error message if no writeable cache path#314
More useful error message if no writeable cache path#314brprice wants to merge 1 commit intolatex3:devfrom
Conversation
kpathsea has some perhaps-surprising rules around "safe filenames". We attempt to make this information more discoverable by linking from the error message.
|
|
||
| if not writable then | ||
| logs.report("system","no writeable cache path, quiting") | ||
| logs.report("system","no writeable cache path, quiting. Try setting TEXMFCACHE or TEXMFVAR and reading https://www.tug.org/texinfohtml/kpathsea.html#Safe-filenames") |
There was a problem hiding this comment.
(Not a luaotfload developer, so feel free to ignore any of my comments here)
I don't think that logs.report wraps its output (assuming that it behaves like the version from ConTeXt), so it might be better to add the hint to a separate line:
| logs.report("system","no writeable cache path, quiting. Try setting TEXMFCACHE or TEXMFVAR and reading https://www.tug.org/texinfohtml/kpathsea.html#Safe-filenames") | |
| logs.report("system","no writeable cache path, quiting") | |
| logs.report("system","Try setting TEXMFCACHE or TEXMFVAR and reading https://www.tug.org/texinfohtml/kpathsea.html#Safe-filenames") |
In general though, adding a hint to this error message seems like a really good idea to me.
There was a problem hiding this comment.
I would like to be able to do this, but because of
luaotfload/src/luaotfload-init.lua
Lines 293 to 306 in ecfe7d0
(I'm not a lua dev, so could easily be missing something here)
Trying to embed a newline in the string also makes the reporting a bit odd wrt indentation.
luaotfload | load : FATAL ERROR
luaotfload | load : × Failed to load "fontloader" module "basics-gen".
luaotfload | load : × Error message:
luaotfload | load : × "./luaotfload-init.lua:301: system : no writeable cache path, quiting.\
Try setting TEXMFCACHE or TEXMFVAR and reading https://www.tug.org/texinfohtml/kpathsea.html#Safe-filenames".
...
./luaotfload-init.lua:301: system : no writeable cach
e path, quiting.
Try setting TEXMFCACHE or TEXMFVAR and reading https://www.tug.org/texinfohtml/
kpathsea.html#Safe-filenames
whereas just one long string gives
luaotfload | load : FATAL ERROR
luaotfload | load : × Failed to load "fontloader" module "basics-gen".
luaotfload | load : × Error message:
luaotfload | load : × "./luaotfload-init.lua:301: system : no writeable cache path, quiting. Try setting TEXMFCACHE or TEXMFVAR and reading https://www.tug.org/texinfohtml/kpathsea.html#Safe-filenames".
...
./luaotfload-init.lua:301: system : no writeable cach
e path, quiting. Try setting TEXMFCACHE or TEXMFVAR and reading https://www.tug
.org/texinfohtml/kpathsea.html#Safe-filenames
I'm not particularly happy with either option here. Hopefully a maintainer can suggest a non-invasive change with nicer output.
There was a problem hiding this comment.
Either option is fine really. Currently the output looks weird but that shouldn't be worked around here but fixed in the output printer.
I think doing multiple calls to texio.reporter is the cleanest option for now.
kpathsea has some perhaps-surprising rules around "safe filenames". We attempt to make this information more discoverable by linking from the error message.
I have spent a bunch of time debugging why upgrading texlive-2023 to texlive-2025 meant I couldn't build my document via nix. The error message was rather unhelpful (yes there is a writeable cache directory, it is right there) as I was unaware of the "no hidden directories" rule. Hopefully this patch will save some time for the next person to trip across this (i.e. me in a few months time!)
Probably there is better phrasing of the additions to the message.