2007-07-26 Havoc Pennington <hp@redhat.com>
authorHavoc Pennington <hp@redhat.com>
Thu, 26 Jul 2007 23:01:14 +0000 (23:01 +0000)
committerHavoc Pennington <hp@redhat.com>
Thu, 26 Jul 2007 23:01:14 +0000 (23:01 +0000)
* 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.

ChangeLog
bus/activation-exit-codes.h
bus/activation-helper-bin.c
bus/activation.c
bus/config-parser-trivial.c
bus/dbus-daemon.1.in
bus/dispatch.c
test/name-test/test-names.c

index ce7ca33..8c13945 100644 (file)
--- 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
index 86a005c..af6952e 100644 (file)
 #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 */
index 248a86f..4a35972 100644 (file)
@@ -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);
index d5162ec..d087d6b 100644 (file)
@@ -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);
index b825047..98d554e 100644 (file)
@@ -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)
index 63d9718..e230e51 100644 (file)
@@ -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>
index d434e80..209bde3 100644 (file)
@@ -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");
 
index 48dfe74..f4b0ba0 100644 (file)
@@ -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;
     }