Bug 11665

Summary: spawn test hangs forever on AIX
Product: dbus Reporter: Peter O'Gorman, The Written Word, Inc. <pogma>
Component: coreAssignee: Havoc Pennington <hp>
Status: RESOLVED FIXED QA Contact: John (J5) Palmieri <johnp>
Severity: major    
Priority: high Keywords: patch
Version: unspecified   
Hardware: PowerPC   
OS: AIX   
Whiteboard:
i915 platform: i915 features:

Description Peter O'Gorman, The Written Word, Inc. 2007-07-20 08:10:23 UTC
When running the testsuite for dbus-1.0.2 on aix (4.3.3, 5.1, 5.2, 5.3) it hangs forever in the spawn test. This is due to a bug in the signal handler.
This patch fixes it:

Index: dbus/dbus-spawn.c
===================================================================
--- dbus/dbus-spawn.c.orig      2006-12-11 19:21:09.000000000 +0000
+++ dbus/dbus-spawn.c   2007-07-20 01:36:22.941412699 +0000
@@ -942,10 +942,14 @@
 babysit_signal_handler (int signo)
 { 
   char b = '\0';
+/* Set errno to zero and/or test that the write() fails, otherwise we
+ * can hang here forever. */
+  errno = 0;
  again:
-  write (babysit_sigchld_pipe, &b, 1);
-  if (errno == EINTR)
-    goto again;
+  if (write (babysit_sigchld_pipe, &b, 1) <= 0) {
+    if (errno == EINTR)
+      goto again;
+  }
 }
Comment 1 Simon McVittie 2007-10-09 05:26:51 UTC
[Please note that I am not a dbus-core developer or reviewer, I'm just trying to clean up the bugzilla a bit...]

Either of those patch bands would be sufficient; if we only keep one, I'd go for the second, but IMO applying both would be fine too.

Since you filed this bug, the process of relicensing D-Bus to the MIT/X11 license quoted here has been started. Would you be willing for your patch to be relicensed as follows?

        Permission is hereby granted, free of charge, to any person
        obtaining a copy of this software and associated documentation
        files (the "Software"), to deal in the Software without
        restriction, including without limitation the rights to use, copy,
        modify, merge, publish, distribute, sublicense, and/or sell copies
        of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:

        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
        NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
        HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
        WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
        DEALINGS IN THE SOFTWARE.
Comment 2 Peter O'Gorman, The Written Word, Inc. 2007-10-09 05:47:56 UTC
(In reply to comment #1)
> Since you filed this bug, the process of relicensing D-Bus to the MIT/X11
> license quoted here has been started. Would you be willing for your patch to be
> relicensed as follows?

Yes, any patches from us may be relicensed under the MIT/X11 license.
Comment 3 John (J5) Palmieri 2008-01-15 13:53:46 UTC
committed with some cleanups.  We don't set errno since we only need the write check and the brackets are removed in keeping with D-Bus' style (otherwise brackets on a newline are the correct format for multi-line blocks)

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.