Closed snelg closed 3 years ago
thank you, didn't see that issue before - that is a nice investigation!
didn't see that issue before
Yeah, guess I should have cross-posted in the first place :)
this might block stable merge of rm2fb until we figure it out or use old toolchain
Thanks for reporting @snelg! This does not seem to be linked to the toolchain or to recent changes in rm2fb though, since I managed to reproduce the crash using rm2fb 1.0.0-7 from Toltec stable.
to understand: does it crash on the second run? is this something that is automatically handled since koreader.sh has a loop in it?
To produce the logs above I ran rm2fb-client ./reader.lua
directly from the /opt/koreader
directory. The first log file corresponds to a successful KOReader run, the second file corresponds to a crash. The koreader.sh
wrapper seems to generate the /opt/koreader/cache/fontinfo.dat
file when it’s missing (not sure how yet), so the app does not crash.
Setting LD_LIBRARY_PATH
to ./libs:
(as done by the koreader.sh
wrapper) seems to fix it. So the following command does not crash, even if the fontinfo.dat
file is missing:
$ LD_LIBRARY_PATH=./libs: rm2fb-client ./reader.lua
Comparing strace logs shows that, without the flag, both the system /usr/lib/libharfbuzz.so.0
library and then the local /opt/koreader/libs/libharfbuzz.so.0
library get loaded. With the flag, only the local one gets loaded.
It looks like I hit a bug that shadowed another one here. Running LD_LIBRARY_PATH=./libs: LD_PRELOAD="/path/to/librm2fb_client.so.1.0.0" ./reader.lua
with the latest rm2fb release (v0.0.3 downloaded from this repo’s releases) does result in a crash, whereas it did not crash using the earlier rm2fb release. So there does seem to be a regression introduced in rm2fb. I’ll investigate the segfault.
Here’s my hypothesis: a change introduced in the toolchain cancels the effect of the LD_LIBRARY_PATH
environment variable. Evidence:
reader.lua
using the shim from Toltec stable and a run using the v0.0.3 shim shows that the former loads the system libharfbuzz.so and the latter loads the local one.@NiLuJe pinging you, as you might have some insight.
c.f., my answers in https://github.com/toltec-dev/toolchain/issues/8, which follow the same train of thought as @matteodelabre ;)
Only crashes if it's a fresh koreader installation, or more particularly if
koreader/cache/fontinfo.dat
does not yet exist. See https://github.com/toltec-dev/toolchain/issues/8