GNOME Bugzilla – Bug 732019
gtestdbus: Don’t close stdout for dbus-daemon
Last modified: 2014-06-22 12:52:35 UTC
Patch attached. See the commit message for rationale.
Created attachment 278908 [details] [review] gtestdbus: Don’t close stdout for dbus-daemon The stdout FD passed to dbus-daemon is propagated to all its child processes, such as service activated processes. If we close the FD after reading the bus address from the daemon, any child process which subsequently writes to stdout (e.g. for logging) will get a SIGPIPE and explode. Instead of closing the stdout FD immediately after dbus-daemon has spawned, keep it open until the daemon is killed.
Review of attachment 278908 [details] [review]: ::: gio/gtestdbus.c @@ +619,3 @@ + * and if we close it, they will get a SIGPIPE and die when they try to write + * to their stdout. */ + channel = g_io_channel_unix_new (dup (self->priv->bus_stdout_fd)); Any reason not to check for an error from dup() ?
Created attachment 278923 [details] [review] gtestdbus: Don’t close stdout for dbus-daemon The stdout FD passed to dbus-daemon is propagated to all its child processes, such as service activated processes. If we close the FD after reading the bus address from the daemon, any child process which subsequently writes to stdout (e.g. for logging) will get a SIGPIPE and explode. Instead of closing the stdout FD immediately after dbus-daemon has spawned, keep it open until the daemon is killed.
Comment on attachment 278908 [details] [review] gtestdbus: Don’t close stdout for dbus-daemon Added a g_assert_cmpint(), since the rest of the error handling in the file uses assertions rather than error messages.
Review of attachment 278923 [details] [review]: LGTM, thanks!
Comment on attachment 278923 [details] [review] gtestdbus: Don’t close stdout for dbus-daemon commit d80adeaa960ddfa13837900d0391f9bd9c239f78 Author: Philip Withnall <philip@tecnocode.co.uk> Date: Sat Jun 21 23:01:08 2014 +0100 gtestdbus: Don’t close stdout for dbus-daemon The stdout FD passed to dbus-daemon is propagated to all its child processes, such as service activated processes. If we close the FD after reading the bus address from the daemon, any child process which subsequently writes to stdout (e.g. for logging) will get a SIGPIPE and explode. Instead of closing the stdout FD immediately after dbus-daemon has spawned, keep it open until the daemon is killed. https://bugzilla.gnome.org/show_bug.cgi?id=732019 gio/gtestdbus.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)