From 15e0bba3f879126b7313ad9eeb95c482109d95a6 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Fri, 6 Nov 2015 14:02:29 +0100 Subject: [PATCH 1/3] Fix bug unrefing connection too early in check_hello_message(). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721 Reviewed-by: Simon McVittie --- bus/dispatch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bus/dispatch.c b/bus/dispatch.c index 3ea944ab..ae7ac385 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -941,8 +941,6 @@ check_hello_message (BusContext *context, return TRUE; } - dbus_connection_unref (connection); - message = pop_message_waiting_for_memory (connection); if (message == NULL) { @@ -1090,6 +1088,8 @@ check_hello_message (BusContext *context, if (name_message) dbus_message_unref (name_message); + dbus_connection_unref (connection); + return retval; } From e48d40c582c49e1d613580de552a92ef4959c62c Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Fri, 6 Nov 2015 14:03:23 +0100 Subject: [PATCH 2/3] Fix test cases running client and server dispatch design issue. DBus test cases running the server *and* client loop in the same process assumed that all messages send from the server has to be received in one client dispatch, which is not the case in all environments. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=92721 Reviewed-by: Simon McVittie --- bus/dispatch.c | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/bus/dispatch.c b/bus/dispatch.c index ae7ac385..4d9ffa3f 100644 --- a/bus/dispatch.c +++ b/bus/dispatch.c @@ -653,6 +653,7 @@ typedef struct const char *expected_service_name; dbus_bool_t failed; DBusConnection *skip_connection; + BusContext *context; } CheckServiceOwnerChangedData; static dbus_bool_t @@ -674,9 +675,14 @@ check_service_owner_changed_foreach (DBusConnection *connection, message = pop_message_waiting_for_memory (connection); if (message == NULL) { - _dbus_warn ("Did not receive a message on %p, expecting %s\n", - connection, "NameOwnerChanged"); - goto out; + block_connection_until_message_from_bus (d->context, connection, "NameOwnerChanged"); + message = pop_message_waiting_for_memory (connection); + if (message == NULL) + { + _dbus_warn ("Did not receive a message on %p, expecting %s\n", + connection, "NameOwnerChanged"); + goto out; + } } else if (!dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, @@ -789,6 +795,7 @@ kill_client_connection (BusContext *context, socd.expected_service_name = base_service; socd.failed = FALSE; socd.skip_connection = NULL; + socd.context = context; bus_test_clients_foreach (check_service_owner_changed_foreach, &socd); @@ -1017,6 +1024,8 @@ check_hello_message (BusContext *context, socd.expected_service_name = name; socd.failed = FALSE; socd.skip_connection = connection; /* we haven't done AddMatch so won't get it ourselves */ + socd.context = context; + bus_test_clients_foreach (check_service_owner_changed_foreach, &socd); @@ -1029,9 +1038,14 @@ check_hello_message (BusContext *context, message = pop_message_waiting_for_memory (connection); if (message == NULL) { - _dbus_warn ("Expecting %s, got nothing\n", + block_connection_until_message_from_bus (context, connection, "signal NameAcquired"); + message = pop_message_waiting_for_memory (connection); + if (message == NULL) + { + _dbus_warn ("Expecting %s, got nothing\n", "NameAcquired"); - goto out; + goto out; + } } if (! dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameAcquired")) @@ -2086,6 +2100,8 @@ check_base_service_activated (BusContext *context, socd.expected_service_name = base_service; socd.failed = FALSE; socd.skip_connection = connection; + socd.context = context; + bus_test_clients_foreach (check_service_owner_changed_foreach, &socd); @@ -2190,6 +2206,8 @@ check_service_activated (BusContext *context, socd.skip_connection = connection; socd.failed = FALSE; socd.expected_service_name = service_name; + socd.context = context; + bus_test_clients_foreach (check_service_owner_changed_foreach, &socd); @@ -2327,6 +2345,8 @@ check_service_auto_activated (BusContext *context, socd.expected_service_name = service_name; socd.failed = FALSE; socd.skip_connection = connection; + socd.context = context; + bus_test_clients_foreach (check_service_owner_changed_foreach, &socd); @@ -2376,6 +2396,8 @@ check_service_deactivated (BusContext *context, socd.expected_service_name = activated_name; socd.failed = FALSE; socd.skip_connection = NULL; + socd.context = context; + bus_test_clients_foreach (check_service_owner_changed_foreach, &socd); @@ -2386,6 +2408,8 @@ check_service_deactivated (BusContext *context, socd.expected_service_name = base_service; socd.failed = FALSE; socd.skip_connection = NULL; + socd.context = context; + bus_test_clients_foreach (check_service_owner_changed_foreach, &socd); @@ -2833,6 +2857,7 @@ check_existent_service_no_auto_start (BusContext *context, socd.expected_service_name = base_service; socd.failed = FALSE; socd.skip_connection = NULL; + socd.context = context; bus_test_clients_foreach (check_service_owner_changed_foreach, &socd); @@ -3453,6 +3478,8 @@ check_existent_service_auto_start (BusContext *context, socd.expected_service_name = base_service; socd.failed = FALSE; socd.skip_connection = NULL; + socd.context = context; + bus_test_clients_foreach (check_service_owner_changed_foreach, &socd); @@ -4141,6 +4168,8 @@ check_shell_service_success_auto_start (BusContext *context, socd.expected_service_name = base_service; socd.failed = FALSE; socd.skip_connection = NULL; + socd.context = context; + bus_test_clients_foreach (check_service_owner_changed_foreach, &socd); From e2e31794924a15bfaeadf2867ea3dd174db2d31f Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 6 Nov 2015 18:26:40 +0100 Subject: [PATCH 3/3] update NEWS --- NEWS | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index bca8a9dd..e8bc33c1 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,20 @@ D-Bus 1.10.3 (UNRELEASED) == -... +• On Windows, don't crash if or --syslog is used + (fd.o #92538, Ralf Habacker) + +• On Windows, fix various failing tests: + · don't test system.conf features (users, groups) that only make sense + on the system bus, which is not supported on Windows + · don't call _dbus_warn() when we skip a test, since it is fatal + · fix computation of expected + · when running TAP tests, translate newlines to Unix format, fixing + cross-compiled tests under Wine on Linux + · don't stress-test refcounting under Wine, where it's really slow + · stop assuming that a message looped-back to the test will be received + immediately + (fd.o #92538, fd.o #92721; Ralf Habacker, Simon McVittie) D-Bus 1.10.2 (2015-10-26) ==