-
When no plugins are installed, the plugin directory is not available because all plugins are split of in subpackages. However, fwupd daemon will access this directory to load any installed plugins. It aborts when the directory does not exist. Therefore, create an empty directory during build to handle the case when the user hasn't installed any plugins. Also add a merged patch to avoid an assert when no plugins are installed. This patch can be dropped when the next fwupd release is available.
When no plugins are installed, the plugin directory is not available because all plugins are split of in subpackages. However, fwupd daemon will access this directory to load any installed plugins. It aborts when the directory does not exist. Therefore, create an empty directory during build to handle the case when the user hasn't installed any plugins. Also add a merged patch to avoid an assert when no plugins are installed. This patch can be dropped when the next fwupd release is available.
0001-do-not-assert-when-running-with-no-plugins.patch 1.87 KiB
From e1e0fc309d82d56d0f180ac5e696f397dc16f96a Mon Sep 17 00:00:00 2001
Patch-Source: https://github.com/fwupd/fwupd/commit/2a5c27a094af236e94a214766520a9e6d56caae2
From: Richard Hughes <richard@hughsie.com>
Date: Mon, 22 Aug 2022 10:57:03 +0100
Subject: [PATCH] Do not assert when running with no plugins
Fixes https://github.com/fwupd/fwupd/issues/4932
---
src/fu-daemon.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/src/fu-daemon.c b/src/fu-daemon.c
index 69c9805a4b..f23f1815b9 100644
--- a/src/fu-daemon.c
+++ b/src/fu-daemon.c
@@ -317,10 +317,7 @@ static GVariant *
fu_daemon_plugin_array_to_variant(GPtrArray *plugins)
{
GVariantBuilder builder;
-
- g_return_val_if_fail(plugins->len > 0, NULL);
- g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY);
-
+ g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
for (guint i = 0; i < plugins->len; i++) {
FuDevice *plugin = g_ptr_array_index(plugins, i);
GVariant *tmp = fwupd_plugin_to_variant(FWUPD_PLUGIN(plugin));
@@ -333,8 +330,7 @@ static GVariant *
fu_daemon_release_array_to_variant(GPtrArray *results)
{
GVariantBuilder builder;
- g_return_val_if_fail(results->len > 0, NULL);
- g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY);
+ g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
for (guint i = 0; i < results->len; i++) {
FwupdRelease *rel = g_ptr_array_index(results, i);
GVariant *tmp = fwupd_release_to_variant(rel);
@@ -347,8 +343,7 @@ static GVariant *
fu_daemon_remote_array_to_variant(GPtrArray *remotes)
{
GVariantBuilder builder;
- g_return_val_if_fail(remotes->len > 0, NULL);
- g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY);
+ g_variant_builder_init(&builder, G_VARIANT_TYPE("aa{sv}"));
for (guint i = 0; i < remotes->len; i++) {
FwupdRemote *remote = g_ptr_array_index(remotes, i);
GVariant *tmp = fwupd_remote_to_variant(remote);