Convert the logical for the native load to bind symbols locally first. Fixes GPLUGIN-119
Testing Done:
Built and ran the tests locally.
Reviewed at https://reviews.imfreedom.org/r/108/
--- a/gplugin-query/gplugin-query.c Sun Sep 06 01:35:55 2020 -0500
+++ b/gplugin-query/gplugin-query.c Sun Sep 06 01:36:08 2020 -0500
@@ -118,7 +118,7 @@
for(l = plugins; l; l = l->next) {
GPluginPlugin *plugin = GPLUGIN_PLUGIN(l->data);
GPluginPluginInfo *info = gplugin_plugin_get_info(plugin);
- gboolean internal, loq;
+ gboolean internal, loq, bind_global; gchar *license_id, *license_text, *license_url;
@@ -153,6 +153,7 @@
"dependencies", &dependencies,
+ "bind-global", &bind_global, @@ -193,6 +194,7 @@
printf(MAIN_FORMAT_NEL "%08x\n", "abi version", abi_version);
printf(MAIN_FORMAT, "internal", (internal) ? "yes" : "no");
printf(MAIN_FORMAT, "load on query", (loq) ? "yes" : "no");
+ printf(MAIN_FORMAT, "bind globally", (bind_global) ? "yes" : "no"); printf(MAIN_FORMAT, "loader", G_OBJECT_TYPE_NAME(loader));
g_object_unref(G_OBJECT(loader));
--- a/gplugin/gplugin-native-loader.c Sun Sep 06 01:35:55 2020 -0500
+++ b/gplugin/gplugin-native-loader.c Sun Sep 06 01:36:08 2020 -0500
@@ -181,7 +181,7 @@
info = gplugin_native_loader_open_and_query(
if(!GPLUGIN_IS_PLUGIN_INFO(info)) {
@@ -197,14 +197,14 @@
- if(gplugin_plugin_info_get_bind_local(info)) {
+ if(gplugin_plugin_info_get_bind_global(info)) { g_object_unref(G_OBJECT(info));
info = gplugin_native_loader_open_and_query(
if(!GPLUGIN_IS_PLUGIN_INFO(info)) {
--- a/gplugin/gplugin-plugin-info.c Sun Sep 06 01:35:55 2020 -0500
+++ b/gplugin/gplugin-plugin-info.c Sun Sep 06 01:36:08 2020 -0500
@@ -75,7 +75,7 @@
} GPluginPluginInfoPrivate;
/******************************************************************************
@@ -87,7 +87,7 @@
@@ -154,12 +154,14 @@
-gplugin_plugin_info_set_bind_local(GPluginPluginInfo *info, gboolean bind_local)
+gplugin_plugin_info_set_bind_global( + GPluginPluginInfo *info, GPluginPluginInfoPrivate *priv =
gplugin_plugin_info_get_instance_private(info);
- priv->bind_local = bind_local;
+ priv->bind_global = bind_global; @@ -325,10 +327,10 @@
gplugin_plugin_info_get_load_on_query(info));
- gplugin_plugin_info_get_bind_local(info));
+ gplugin_plugin_info_get_bind_global(info)); g_value_set_string(value, gplugin_plugin_info_get_name(info));
@@ -404,8 +406,8 @@
g_value_get_boolean(value));
- gplugin_plugin_info_set_bind_local(
+ gplugin_plugin_info_set_bind_global( g_value_get_boolean(value));
@@ -575,16 +577,16 @@
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
- * GPluginPluginInfo:bind-local:
+ * GPluginPluginInfo:bind-global: - * Determines whether the plugin should be have its symbols bound locally.
+ * Determines whether the plugin should be have its symbols bound globally. * Note: This should only be used by the native plugin loader.
- properties[PROP_BIND_LOCAL] = g_param_spec_boolean(
- "Whether symbols should be bound locally",
+ properties[PROP_BIND_GLOBAL] = g_param_spec_boolean( + "Whether symbols should be bound globally", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
@@ -1099,16 +1101,17 @@
- * gplugin_plugin_info_get_bind_local:
+ * gplugin_plugin_info_get_bind_global: * @info: The #GPluginPluginInfo instance.
- * This function is only used by the native plugin loader.
+ * This propoerty and therefore function is only used by the native plugin * Returns: %TRUE if the plugin has requested to be loaded with its symbols
- * bound locally, %FALSE if they should be bound globally.
+ * bound global, %FALSE if they should be bound locally. -gplugin_plugin_info_get_bind_local(GPluginPluginInfo *info)
+gplugin_plugin_info_get_bind_global(GPluginPluginInfo *info) GPluginPluginInfoPrivate *priv = NULL;
@@ -1116,5 +1119,5 @@
priv = gplugin_plugin_info_get_instance_private(info);
- return priv->bind_local;
+ return priv->bind_global; --- a/gplugin/gplugin-plugin-info.h Sun Sep 06 01:35:55 2020 -0500
+++ b/gplugin/gplugin-plugin-info.h Sun Sep 06 01:36:08 2020 -0500
@@ -71,6 +71,7 @@
const gchar *gplugin_plugin_info_get_website(GPluginPluginInfo *info);
const gchar *const *gplugin_plugin_info_get_dependencies(
GPluginPluginInfo *info);
+gboolean gplugin_plugin_info_get_bind_global(GPluginPluginInfo *info); --- a/gplugin/gplugin-private.h Sun Sep 06 01:35:55 2020 -0500
+++ b/gplugin/gplugin-private.h Sun Sep 06 01:36:08 2020 -0500
@@ -39,8 +39,6 @@
const GValue *handler_return,
-gboolean gplugin_plugin_info_get_bind_local(GPluginPluginInfo *info);
#endif /* GPLUGIN_PRIVATE_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/tests/bind-global/bind-global.c Sun Sep 06 01:36:08 2020 -0500
@@ -0,0 +1,47 @@
+ * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +#include <gplugin-native.h> +G_MODULE_EXPORT GPluginPluginInfo * +gplugin_query(G_GNUC_UNUSED GError **error) + return gplugin_plugin_info_new( +G_MODULE_EXPORT gboolean + G_GNUC_UNUSED GPluginNativePlugin *plugin, + G_GNUC_UNUSED GError **error) +G_MODULE_EXPORT gboolean + G_GNUC_UNUSED GPluginNativePlugin *plugin, + G_GNUC_UNUSED GError **error) --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/tests/bind-global/meson.build Sun Sep 06 01:36:08 2020 -0500
@@ -0,0 +1,3 @@
+shared_library('bind-global', 'bind-global.c', + dependencies : [gplugin_dep, GLIB]) --- a/gplugin/tests/bind-local/bind-local.c Sun Sep 06 01:35:55 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
- * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
-#include <gplugin-native.h>
-G_MODULE_EXPORT GPluginPluginInfo *
-gplugin_query(G_GNUC_UNUSED GError **error)
- return gplugin_plugin_info_new(
-G_MODULE_EXPORT gboolean
- G_GNUC_UNUSED GPluginNativePlugin *plugin,
- G_GNUC_UNUSED GError **error)
-G_MODULE_EXPORT gboolean
- G_GNUC_UNUSED GPluginNativePlugin *plugin,
- G_GNUC_UNUSED GError **error)
--- a/gplugin/tests/bind-local/meson.build Sun Sep 06 01:35:55 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-shared_library('bind-local', 'bind-local.c',
- dependencies : [gplugin_dep, GLIB])
--- a/gplugin/tests/dynamic-type/dynamic-type-provider.c Sun Sep 06 01:35:55 2020 -0500
+++ b/gplugin/tests/dynamic-type/dynamic-type-provider.c Sun Sep 06 01:36:08 2020 -0500
@@ -44,6 +44,8 @@
return gplugin_plugin_info_new(
"gplugin/dynamic-type-provider",
GPLUGIN_NATIVE_PLUGIN_ABI_VERSION,
--- a/gplugin/tests/meson.build Sun Sep 06 01:35:55 2020 -0500
+++ b/gplugin/tests/meson.build Sun Sep 06 01:36:08 2020 -0500
@@ -2,7 +2,7 @@
###############################################################################
subdir('load-on-query-fail')
@@ -131,9 +131,9 @@
###############################################################################
###############################################################################
-e = executable('test-bind-local', 'test-bind-local.c',
+e = executable('test-bind-global', 'test-bind-global.c', - '-DTEST_BIND_LOCAL_DIR="@0@/bind-local/"'.format(
+ '-DTEST_BIND_GLOBAL_DIR="@0@/bind-global/"'.format( meson.current_build_dir()),
'-DTEST_BAD_DIR="@0@/bad-plugins/"'.format(
meson.current_build_dir()),
@@ -141,7 +141,7 @@
meson.current_build_dir()),
dependencies : [gplugin_dep, GLIB, GOBJECT])
###############################################################################
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/gplugin/tests/test-bind-global.c Sun Sep 06 01:36:08 2020 -0500
@@ -0,0 +1,63 @@
+ * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com> + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see <http://www.gnu.org/licenses/>. +#include <gplugin-native.h> +/****************************************************************************** + *****************************************************************************/ +/* This test kind of sucks because theres no way for us to lookup whether or + * not a module handle has had its symbols bound globally. Therefore, right + * now we have to settle to see if it was loaded correctly. + GPluginPlugin *plugin = NULL; + gplugin_manager_remove_paths(); + gplugin_manager_append_path(TEST_BIND_GLOBAL_DIR); + gplugin_manager_refresh(); + plugin = gplugin_manager_find_plugin("gplugin/bind-global"); + g_assert_nonnull(plugin); + g_assert_true(GPLUGIN_IS_PLUGIN(plugin)); + g_assert_true(GPLUGIN_IS_NATIVE_PLUGIN(plugin)); +/****************************************************************************** + *****************************************************************************/ +main(gint argc, gchar **argv) + g_test_init(&argc, &argv, NULL); + /* test the load on query flag */ + g_test_add_func("/loaders/native/bind-global", test_bind_global); --- a/gplugin/tests/test-bind-local.c Sun Sep 06 01:35:55 2020 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,63 +0,0 @@
- * Copyright (C) 2011-2014 Gary Kramlich <grim@reaperworld.com>
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
-#include <gplugin-native.h>
-/******************************************************************************
- *****************************************************************************/
-/* This test kind of sucks because theres no way for us to lookup whether or
- * not a module handle has had its symbols bound locally. Therefore, right
- * now we have to settle to see if it was loaded correctly.
- GPluginPlugin *plugin = NULL;
- gplugin_manager_remove_paths();
- gplugin_manager_append_path(TEST_BIND_LOCAL_DIR);
- gplugin_manager_refresh();
- plugin = gplugin_manager_find_plugin("gplugin/bind-local");
- g_assert_nonnull(plugin);
- g_assert_true(GPLUGIN_IS_PLUGIN(plugin));
- g_assert_true(GPLUGIN_IS_NATIVE_PLUGIN(plugin));
-/******************************************************************************
- *****************************************************************************/
-main(gint argc, gchar **argv)
- g_test_init(&argc, &argv, NULL);
- /* test the load on query flag */
- g_test_add_func("/loaders/native/bind-local", test_bind_local);
--- a/lua/gplugin-lua-core.c Sun Sep 06 01:35:55 2020 -0500
+++ b/lua/gplugin-lua-core.c Sun Sep 06 01:36:08 2020 -0500
@@ -48,6 +48,7 @@
"website", GPLUGIN_WEBSITE,
--- a/perl5/gplugin-perl5-core.c Sun Sep 06 01:35:55 2020 -0500
+++ b/perl5/gplugin-perl5-core.c Sun Sep 06 01:36:08 2020 -0500
@@ -47,6 +47,7 @@
"website", GPLUGIN_WEBSITE,
--- a/python3/gplugin-python3-core.c Sun Sep 06 01:35:55 2020 -0500
+++ b/python3/gplugin-python3-core.c Sun Sep 06 01:36:08 2020 -0500
@@ -48,6 +48,7 @@
"website", GPLUGIN_WEBSITE,