All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ] client: Handle system bus setup failure
@ 2026-08-28 20:52 ` Tim Sweetman
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Sweetman via B4 Relay @ 2026-08-28 20:52 UTC (permalink / raw)
  To: Linux Bluetooth

From: Tim Sweetman <agenttimblog@gmail.com>

g_dbus_setup_bus() returns NULL when it cannot connect to the system
bus. bluetoothctl currently passes that NULL connection to
g_dbus_attach_object_manager(), causing libdbus to abort on its
connection assertion.

Initialize a DBusError, report the connection failure, and exit cleanly
before using the connection.

Fixes: https://github.com/bluez/bluez/issues/2446
---
Tested with make check (34 tests).
---
 client/main.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/client/main.c b/client/main.c
index 069e20485..d7cecb118 100644
--- a/client/main.c
+++ b/client/main.c
@@ -4017,6 +4017,7 @@ static bool timeout_quit(void *user_data)
 int main(int argc, char *argv[])
 {
 	GDBusClient *client;
+	DBusError error;
 	int status;
 	int timeout;
 	unsigned int timeout_id;
@@ -4048,7 +4049,21 @@ int main(int argc, char *argv[])
 	else
 		auto_register_agent = g_strdup("");
 
-	dbus_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL);
+	dbus_error_init(&error);
+	dbus_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, &error);
+	if (dbus_conn == NULL) {
+		if (dbus_error_is_set(&error)) {
+			fprintf(stderr, "Failed to connect to system bus: %s\n",
+							error.message);
+			dbus_error_free(&error);
+		} else {
+			fprintf(stderr, "Failed to connect to system bus\n");
+		}
+
+		g_free(auto_register_agent);
+		return EXIT_FAILURE;
+	}
+
 	g_dbus_attach_object_manager(dbus_conn);
 
 	bt_shell_set_env("DBUS_CONNECTION", dbus_conn);

---
base-commit: e8141342284be2a52e16565b96b513ebe1297d84
change-id: 20260828-master-e87099ea4429

Best regards,
--  
Tim Sweetman <agenttimblog@gmail.com>



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH BlueZ] client: Handle system bus setup failure
@ 2026-08-28 20:52 ` Tim Sweetman
  0 siblings, 0 replies; 4+ messages in thread
From: Tim Sweetman @ 2026-08-28 20:52 UTC (permalink / raw)
  To: Linux Bluetooth

g_dbus_setup_bus() returns NULL when it cannot connect to the system
bus. bluetoothctl currently passes that NULL connection to
g_dbus_attach_object_manager(), causing libdbus to abort on its
connection assertion.

Initialize a DBusError, report the connection failure, and exit cleanly
before using the connection.

Fixes: https://github.com/bluez/bluez/issues/2446
---
Tested with make check (34 tests).
---
 client/main.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/client/main.c b/client/main.c
index 069e20485..d7cecb118 100644
--- a/client/main.c
+++ b/client/main.c
@@ -4017,6 +4017,7 @@ static bool timeout_quit(void *user_data)
 int main(int argc, char *argv[])
 {
 	GDBusClient *client;
+	DBusError error;
 	int status;
 	int timeout;
 	unsigned int timeout_id;
@@ -4048,7 +4049,21 @@ int main(int argc, char *argv[])
 	else
 		auto_register_agent = g_strdup("");
 
-	dbus_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, NULL);
+	dbus_error_init(&error);
+	dbus_conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, NULL, &error);
+	if (dbus_conn == NULL) {
+		if (dbus_error_is_set(&error)) {
+			fprintf(stderr, "Failed to connect to system bus: %s\n",
+							error.message);
+			dbus_error_free(&error);
+		} else {
+			fprintf(stderr, "Failed to connect to system bus\n");
+		}
+
+		g_free(auto_register_agent);
+		return EXIT_FAILURE;
+	}
+
 	g_dbus_attach_object_manager(dbus_conn);
 
 	bt_shell_set_env("DBUS_CONNECTION", dbus_conn);

---
base-commit: e8141342284be2a52e16565b96b513ebe1297d84
change-id: 20260828-master-e87099ea4429

Best regards,
--  
Tim Sweetman <agenttimblog@gmail.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [BlueZ] client: Handle system bus setup failure
  2026-08-28 20:52 ` Tim Sweetman
  (?)
@ 2026-08-28 22:16 ` bluez.test.bot
  -1 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-08-28 22:16 UTC (permalink / raw)
  To: linux-bluetooth, agenttimblog

[-- Attachment #1: Type: text/plain, Size: 1005 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1153435

---Test result---

Test Summary:
CheckPatch                    PASS      0.31 seconds
GitLint                       FAIL      0.22 seconds
BuildEll                      PASS      20.71 seconds
BluezMake                     PASS      616.75 seconds
CheckSmatch                   PASS      319.17 seconds
bluezmakeextell               PASS      104.25 seconds
IncrementalBuild              PASS      608.04 seconds
ScanBuild                     PASS      1007.90 seconds

Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[BlueZ] client: Handle system bus setup failure

25: B2 Line has trailing whitespace: "--  "


https://github.com/bluez/bluez/pull/2449

---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [BlueZ] client: Handle system bus setup failure
  2026-08-28 20:52 ` Tim Sweetman
  (?)
  (?)
@ 2026-09-12 22:42 ` bluez.test.bot
  -1 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-09-12 22:42 UTC (permalink / raw)
  To: linux-bluetooth, agenttimblog

[-- Attachment #1: Type: text/plain, Size: 687 bytes --]

This is an automated email and please do not reply to this email.

Dear Submitter,

This series was picked up by the CI more than 2 weeks ago and the pull
request created for it is still open, which means the series was never
applied to the tree.

   Series:       [BlueZ] client: Handle system bus setup failure
   Pull Request: https://github.com/bluez/bluez/pull/2449
   Created:      2026-08-28 21:30:31+00:00

The pull request has been closed and no further action is taken on this
series.

If the change should still be considered, it must be resent to the Linux
Bluetooth mailing list (linux-bluetooth@vger.kernel.org) so that it is
picked up again.

---
Regards,
Linux Bluetooth

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-09-12 22:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-28 20:52 [PATCH BlueZ] client: Handle system bus setup failure Tim Sweetman via B4 Relay
2026-08-28 20:52 ` Tim Sweetman
2026-08-28 22:16 ` [BlueZ] " bluez.test.bot
2026-09-12 22:42 ` bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.