summaryrefslogtreecommitdiff
path: root/girepository
diff options
context:
space:
mode:
authorRok Mandeljc <rok.mandeljc@gmail.com>2021-11-27 20:05:32 +0100
committerRok Mandeljc <rok.mandeljc@gmail.com>2021-11-27 20:52:07 +0100
commit56df7b0f007fe260b2bd26ef9cc331ad73022700 (patch)
tree7ab07aba0f112a6d86aae97b501915d1660170dc /girepository
parent366a886bc63512db13571a6656c9744a79b4b56f (diff)
downloadgobject-introspection-56df7b0f007fe260b2bd26ef9cc331ad73022700.tar.gz
gitypelib.c: on macOS, treat @-prefixed shlib paths as absolute
On macOS, @-prefixed shlib paths (@rpath, @executable_path, and @loader_path) need to be treated as absolute. Trying to combine them with a configured library path produces a mangled path that is unresolvable and may cause unintended side effects (such as loading the library from a fall-back location on macOS 12.0.1).
Diffstat (limited to 'girepository')
-rw-r--r--girepository/gitypelib.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/girepository/gitypelib.c b/girepository/gitypelib.c
index 904dff45..d5ef4506 100644
--- a/girepository/gitypelib.c
+++ b/girepository/gitypelib.c
@@ -2262,7 +2262,17 @@ load_one_shared_library (const char *shlib)
GSList *p;
GModule *m;
+#ifdef __APPLE__
+ /* On macOS, @-prefixed shlib paths (@rpath, @executable_path, @loader_path)
+ need to be treated as absolute; trying to combine them with a
+ configured library path produces a mangled path that is unresolvable
+ and may cause unintended side effects (such as loading the library
+ from a fall-back location on macOS 12.0.1).
+ */
+ if (!g_path_is_absolute (shlib) && !g_str_has_prefix (shlib, "@"))
+#else
if (!g_path_is_absolute (shlib))
+#endif
{
/* First try in configured library paths */
for (p = library_paths; p; p = p->next)