-
Notifications
You must be signed in to change notification settings - Fork 13
More useful error message if no writeable cache path #314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to be able to do this, but because of
luaotfload/src/luaotfload-init.lua
Lines 293 to 306 in ecfe7d0
| do | |
| local saved_reporter = texio.reporter | |
| local saved_exit = os.exit | |
| local errmsg | |
| function texio.reporter(msg, ...) | |
| errmsg = msg | |
| end | |
| function os.exit() | |
| error(errmsg) | |
| end | |
| load_fontloader_module "basics-gen" | |
| texio.reporter = saved_reporter | |
| os.exit = saved_exit | |
| end |
(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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.