summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2007-07-26 23:01:14 +0000
committerHavoc Pennington <hp@redhat.com>2007-07-26 23:01:14 +0000
commitbdbab1212390d85a82d4195fa67a5c63ac0678cb (patch)
tree25f905d227f1a703bec0d64dcb6c8916cfed5f8b
parentba38a9b12ffee5d07f1e4a2a9585805695795219 (diff)
2007-07-26 Havoc Pennington <hp@redhat.com>
* bus/config-parser-trivial.c (check_return_values): disable a test that hardcoded the bus user's name * bus/dispatch.c (bus_dispatch_test_conf): remove the "if (!use_launcher)" around the tests, they were only failing because we didn't pass through all the expected errors from the helper. * bus/activation-exit-codes.h (BUS_SPAWN_EXIT_CODE_CHILD_SIGNALED): add a code for child segfaulting (BUS_SPAWN_EXIT_CODE_GENERIC_FAILURE): make "1" be a generic failure code, so if a third party launch helper were written it could just always return 1 on failure.
-rw-r--r--ChangeLog15
-rw-r--r--bus/activation-exit-codes.h26
-rw-r--r--bus/activation-helper-bin.c3
-rw-r--r--bus/activation.c4
-rw-r--r--bus/config-parser-trivial.c7
-rw-r--r--bus/dbus-daemon.1.in7
-rw-r--r--bus/dispatch.c29
-rw-r--r--test/name-test/test-names.c10
8 files changed, 65 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index ce7ca335..8c13945a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2007-07-26 Havoc Pennington <hp@redhat.com>
+
+ * bus/config-parser-trivial.c (check_return_values): disable a
+ test that hardcoded the bus user's name
+
+ * bus/dispatch.c (bus_dispatch_test_conf): remove the "if
+ (!use_launcher)" around the tests, they were only failing because
+ we didn't pass through all the expected errors from the helper.
+
+ * bus/activation-exit-codes.h
+ (BUS_SPAWN_EXIT_CODE_CHILD_SIGNALED): add a code for child segfaulting
+ (BUS_SPAWN_EXIT_CODE_GENERIC_FAILURE): make "1" be a generic
+ failure code, so if a third party launch helper were written it
+ could just always return 1 on failure.
+
2007-07-24 Daniel P. Berrange <dan@berrange.com>
* bus/dbus-daemon.1: Add docs on new syntax options for the bus
diff --git a/bus/activation-exit-codes.h b/bus/activation-exit-codes.h
index 86a005ce..af6952e9 100644
--- a/bus/activation-exit-codes.h
+++ b/bus/activation-exit-codes.h
@@ -25,15 +25,21 @@
#ifndef BUS_ACTIVATION_EXIT_CODES_H
#define BUS_ACTIVATION_EXIT_CODES_H
-/** Return codes from the launch helper - not public API */
-#define BUS_SPAWN_EXIT_CODE_NO_MEMORY 1
-#define BUS_SPAWN_EXIT_CODE_CONFIG_INVALID 2
-#define BUS_SPAWN_EXIT_CODE_SETUP_FAILED 3
-#define BUS_SPAWN_EXIT_CODE_NAME_INVALID 4
-#define BUS_SPAWN_EXIT_CODE_SERVICE_NOT_FOUND 5
-#define BUS_SPAWN_EXIT_CODE_PERMISSIONS_INVALID 6
-#define BUS_SPAWN_EXIT_CODE_FILE_INVALID 7
-#define BUS_SPAWN_EXIT_CODE_EXEC_FAILED 8
-#define BUS_SPAWN_EXIT_CODE_INVALID_ARGS 9
+/** Return codes from the launch helper - not public API. However,
+ * presumably if some third party did write their own launch helper,
+ * they would have to rely on these, or at least always return
+ * 1 for GENERIC_FAILURE.
+ */
+#define BUS_SPAWN_EXIT_CODE_GENERIC_FAILURE 1
+#define BUS_SPAWN_EXIT_CODE_NO_MEMORY 2
+#define BUS_SPAWN_EXIT_CODE_CONFIG_INVALID 3
+#define BUS_SPAWN_EXIT_CODE_SETUP_FAILED 4
+#define BUS_SPAWN_EXIT_CODE_NAME_INVALID 5
+#define BUS_SPAWN_EXIT_CODE_SERVICE_NOT_FOUND 6
+#define BUS_SPAWN_EXIT_CODE_PERMISSIONS_INVALID 7
+#define BUS_SPAWN_EXIT_CODE_FILE_INVALID 8
+#define BUS_SPAWN_EXIT_CODE_EXEC_FAILED 9
+#define BUS_SPAWN_EXIT_CODE_INVALID_ARGS 10
+#define BUS_SPAWN_EXIT_CODE_CHILD_SIGNALED 11
#endif /* BUS_ACTIVATION_EXIT_CODES_H */
diff --git a/bus/activation-helper-bin.c b/bus/activation-helper-bin.c
index 248a86f7..4a359726 100644
--- a/bus/activation-helper-bin.c
+++ b/bus/activation-helper-bin.c
@@ -58,6 +58,9 @@ convert_error_to_exit_code (DBusError *error)
if (dbus_error_has_name (error, DBUS_ERROR_INVALID_ARGS))
return BUS_SPAWN_EXIT_CODE_INVALID_ARGS;
+
+ if (dbus_error_has_name (error, DBUS_ERROR_SPAWN_CHILD_SIGNALED))
+ return BUS_SPAWN_EXIT_CODE_CHILD_SIGNALED;
/* should we assert? */
fprintf(stderr, "%s: %s\n", error->name, error->message);
diff --git a/bus/activation.c b/bus/activation.c
index d5162ec2..d087d6bd 100644
--- a/bus/activation.c
+++ b/bus/activation.c
@@ -1159,6 +1159,10 @@ handle_activation_exit_error (int exit_code,
dbus_set_error (error, DBUS_ERROR_INVALID_ARGS,
"Invalid arguments to command line");
break;
+ case BUS_SPAWN_EXIT_CODE_CHILD_SIGNALED:
+ dbus_set_error (error, DBUS_ERROR_SPAWN_CHILD_SIGNALED,
+ "Launched child was signaled, it probably crashed");
+ break;
default:
dbus_set_error (error, DBUS_ERROR_SPAWN_CHILD_EXITED,
"Launch helper exited with unknown return code %i", exit_code);
diff --git a/bus/config-parser-trivial.c b/bus/config-parser-trivial.c
index b825047a..98d554e8 100644
--- a/bus/config-parser-trivial.c
+++ b/bus/config-parser-trivial.c
@@ -353,13 +353,16 @@ check_return_values (const DBusString *full_path)
_dbus_warn ("User was NULL!\n");
goto finish;
}
+#if 0
+ /* the username can be configured in configure.in so this test doesn't work */
if (strcmp (user, "dbus") != 0)
{
_dbus_warn ("User was invalid; '%s'!\n", user);
goto finish;
}
- printf (" <user>dbus</user> OKAY!\n");
-
+ printf (" <user>dbus</user> OKAY!\n");
+#endif
+
/* check type return value is okay */
type = bus_config_parser_get_type (parser);
if (type == NULL)
diff --git a/bus/dbus-daemon.1.in b/bus/dbus-daemon.1.in
index 63d97183..e230e513 100644
--- a/bus/dbus-daemon.1.in
+++ b/bus/dbus-daemon.1.in
@@ -232,9 +232,10 @@ Example: <listen>tcp:host=localhost,port=0,family=ipv4</listen>
.PP
A special case is using a port number of zero (or omitting the port),
which means to choose an available port selected by the operating
-system. The port number chosen can be with the --print-address command
-line parameter and will be present in other cases where the server
-reports its own address, such as when DBUS_SESSION_BUS_ADDRESS is set.
+system. The port number chosen can be obtained with the
+--print-address command line parameter and will be present in other
+cases where the server reports its own address, such as when
+DBUS_SESSION_BUS_ADDRESS is set.
.PP
Example: <listen>tcp:host=localhost,port=0</listen>
diff --git a/bus/dispatch.c b/bus/dispatch.c
index d434e808..209bde3e 100644
--- a/bus/dispatch.c
+++ b/bus/dispatch.c
@@ -4516,10 +4516,8 @@ bus_dispatch_test_conf (const DBusString *test_data_dir,
if (!check_get_connection_unix_process_id (context, baz))
_dbus_assert_not_reached ("GetConnectionUnixProcessID message failed");
- /* Do not do the ListServices test - FIXME: the launcher does not work in this instance */
- if (!use_launcher)
- if (!check_list_services (context, baz))
- _dbus_assert_not_reached ("ListActivatableNames message failed");
+ if (!check_list_services (context, baz))
+ _dbus_assert_not_reached ("ListActivatableNames message failed");
if (!check_no_leftovers (context))
{
@@ -4536,10 +4534,8 @@ bus_dispatch_test_conf (const DBusString *test_data_dir,
#ifdef DBUS_WIN_FIXME
_dbus_warn("TODO: dispatch.c segfault_service_no_auto_start test\n");
#else
- /* only do the segfault test if we are not using the launcher */
- if (!use_launcher)
- check2_try_iterations (context, foo, "segfault_service_no_auto_start",
- check_segfault_service_no_auto_start);
+ check2_try_iterations (context, foo, "segfault_service_no_auto_start",
+ check_segfault_service_no_auto_start);
#endif
check2_try_iterations (context, foo, "existent_service_no_auto_start",
@@ -4553,9 +4549,8 @@ bus_dispatch_test_conf (const DBusString *test_data_dir,
_dbus_warn("TODO: dispatch.c segfault_service_auto_start test\n");
#else
/* only do the segfault test if we are not using the launcher */
- if (!use_launcher)
- check2_try_iterations (context, foo, "segfault_service_auto_start",
- check_segfault_service_auto_start);
+ check2_try_iterations (context, foo, "segfault_service_auto_start",
+ check_segfault_service_auto_start);
#endif
/* only do the shell fail test if we are not using the launcher */
@@ -4576,15 +4571,11 @@ bus_dispatch_test_conf (const DBusString *test_data_dir,
check_existent_service_auto_start);
#endif
- /* only valid for non-launcher */
- if (!use_launcher)
- if (!check_existent_service_auto_start (context, foo))
- _dbus_assert_not_reached ("existent service auto start failed");
+ if (!check_existent_service_auto_start (context, foo))
+ _dbus_assert_not_reached ("existent service auto start failed");
- /* only valid for non-launcher */
- if (!use_launcher)
- if (!check_shell_service_success_auto_start (context, foo))
- _dbus_assert_not_reached ("shell success service auto start failed");
+ if (!check_shell_service_success_auto_start (context, foo))
+ _dbus_assert_not_reached ("shell success service auto start failed");
_dbus_verbose ("Disconnecting foo, bar, and baz\n");
diff --git a/test/name-test/test-names.c b/test/name-test/test-names.c
index 48dfe747..f4b0ba08 100644
--- a/test/name-test/test-names.c
+++ b/test/name-test/test-names.c
@@ -252,7 +252,10 @@ match_acquired_or_lost_signal (DBusConnection *conn, const char *member, const c
}
static dbus_bool_t
-match_name_owner_changed_signal (DBusConnection *conn, const char *bus_name, const char *lost_name, const char *acquired_name)
+match_name_owner_changed_signal (DBusConnection *conn,
+ const char *bus_name,
+ const char *lost_name,
+ const char *acquired_name)
{
int tries;
DBusMessage *msg;
@@ -322,7 +325,10 @@ match_name_owner_changed_signal (DBusConnection *conn, const char *bus_name, con
if (tries == NUM_TRIES_TIL_FAIL)
{
- fprintf (stderr, "Did not recive the expected NameOwnerChanged signal!!!\n");
+ fprintf (stderr, "Did not receive the expected NameOwnerChanged signal, bus_name %s lost_name %s acquired_name %s\n",
+ bus_name ? bus_name : "(null)",
+ lost_name ? lost_name : "(null)",
+ acquired_name ? acquired_name : "(null)");
return FALSE;
}