dlopen shared library symlink using major version name. #1106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, I'm not sure is it worth to change it now because that may breaks old setups of weasyprint but if I would releasing new software I would go with that change. The main disadvantage of current code was found in #1003 (comment), when we zip libraries and theirs hard symlinks each symlink become separate file as a result weasyprint loads the .so file while the rest of the system is linked with .so.N file that leads to segfaults.
Related cairocffi PR Kozea/cairocffi#156
PR Rationale
cffi.dlopen should use .so.N symlinks instead of .so to
make sure we load ABI compatible version of the library and
the same library used by the rest of the system.
cffi uses
ctypes.util.find_library
to search for librariesand the docs for
find_library
states that"The exact functionality is system dependent."
so different system may expect different names for the same library.
To overcome that problem we try to load several names until success
among these names exact file name with
.so
suffixeg.
libcairo.so
but .so symlink is not always safe to use.Shared library usually consist of two of three files:
When -lcairo flag is used linker search for libcairo.so,
but when the programm loaded it loads libcairo.so.N where N
is the version that it was linked with.
Some downsides of .so usage:
version 2 but libcairo.so points at libcairo.so.1
-dev
in debian and
-devel
in centos and they are just symlinksto the .so.N files. So it safer to search for .so.N files they
will exist even if dev package is not installed.
them we get two copies of the library and while the rest of the
system will use .so.N file we will load .so files that may lead
to crash