This makes sure we exec immediately after fork and thus eliminate threading-related problems.
Run-tested. Stops https://bugzilla.redhat.com/show_bug.cgi?id=835112 from happening. -- vda diff -x '*.po' -d -urpN abrt.8/abrt.spec.in abrt.9/abrt.spec.in --- abrt.8/abrt.spec.in 2012-06-25 08:40:35.000000000 +0200 +++ abrt.9/abrt.spec.in 2012-06-26 12:38:20.789106812 +0200 @@ -462,7 +462,7 @@ gtk-update-icon-cache %{_datadir}/icons/ %endif %{_sbindir}/abrtd %{_sbindir}/abrt-server -%{_libexecdir}/abrt-handle-event +%{_bindir}/abrt-handle-event %{_bindir}/abrt-handle-upload %{_bindir}/abrt-action-save-package-data %{_bindir}/abrt-watch-log diff -x '*.po' -d -urpN abrt.8/src/daemon/abrtd.c abrt.9/src/daemon/abrtd.c --- abrt.8/src/daemon/abrtd.c 2012-06-08 14:49:19.000000000 +0200 +++ abrt.9/src/daemon/abrtd.c 2012-06-26 12:39:23.054114293 +0200 @@ -64,7 +64,7 @@ static int socket_client_count = 0; static pid_t spawn_event_handler_child(const char *dump_dir_name, const char *event_name, FILE **fpp) { char *args[6]; - args[0] = (char *) "/usr/libexec/abrt-handle-event"; + args[0] = (char *) "abrt-handle-event"; args[1] = (char *) "-e"; args[2] = (char *) event_name; args[3] = (char *) "--"; diff -x '*.po' -d -urpN abrt.8/src/daemon/abrt-handle-event.c abrt.9/src/daemon/abrt-handle-event.c --- abrt.8/src/daemon/abrt-handle-event.c 2012-06-08 14:49:19.000000000 +0200 +++ abrt.9/src/daemon/abrt-handle-event.c 2012-06-26 13:02:03.338169218 +0200 @@ -276,7 +276,6 @@ int main(int argc, char **argv) char *event_name = NULL; struct options program_options[] = { OPT__VERBOSE(&g_verbose), - OPT_GROUP(""), OPT_STRING('e', "event" , &event_name, "EVENT", _("Run EVENT on DIR")), OPT_END() }; diff -x '*.po' -d -urpN abrt.8/src/daemon/Makefile.am abrt.9/src/daemon/Makefile.am --- abrt.8/src/daemon/Makefile.am 2012-06-08 14:49:19.000000000 +0200 +++ abrt.9/src/daemon/Makefile.am 2012-06-26 12:38:04.866097539 +0200 @@ -7,14 +7,13 @@ bin_SCRIPTS = \ abrt-handle-upload bin_PROGRAMS = \ - abrt-action-save-package-data + abrt-action-save-package-data \ + abrt-handle-event sbin_PROGRAMS = \ abrtd \ abrt-server -libexec_PROGRAMS = abrt-handle-event - abrtd_SOURCES = \ abrtd.c abrtd_CPPFLAGS = \ diff -x '*.po' -d -urpN abrt.8/src/gui-gtk/main.c abrt.9/src/gui-gtk/main.c --- abrt.8/src/gui-gtk/main.c 2012-06-14 15:49:24.000000000 +0200 +++ abrt.9/src/gui-gtk/main.c 2012-06-26 13:02:23.858892449 +0200 @@ -643,11 +643,19 @@ static void on_row_activated_cb(GtkTreeV { if (!is_dbus || chown_dir_over_dbus(dirname) == 0) { - report_problem_in_dir(dirname, - LIBREPORT_ANALYZE | LIBREPORT_NOWAIT | LIBREPORT_GETPID); + pid_t pid = fork(); + if (pid < 0) /* error */ + perror_msg_and_die("fork"); + if (pid == 0) /* child */ + { + execl(BIN_DIR"/abrt-handle-event", "abrt-handle-event", "-e", "report-gui", "--", (char *)dirname, NULL); + execlp("abrt-handle-event", "abrt-handle-event", "-e", "report-gui", "--", (char *)dirname, NULL); + /* Child can't use GUI error reporting, we need to clear g_custom_logger */ + g_custom_logger = NULL; + perror_msg_and_die("Can't execute '%s'", "abrt-handle-event"); + } } - //else - // TODO: show a warning dialog + /* else: chown_dir_over_dbus already complained */ } } @@ -668,18 +676,11 @@ static void open_problem_data_cb(GtkMenu perror_msg_and_die("fork"); if (pid == 0) /* child */ { - struct run_event_state *run_state = new_run_event_state(); - int r = run_event_on_dir_name(run_state, dirname, "open-gui"); - int no_such_event = (r == 0 && run_state->children_count == 0); - free_run_event_state(run_state); - if (!no_such_event) - { - exit(r); - } - /* Default: launch graphical tool */ - execl(BIN_DIR"/report-gtk", "report-gtk", "--", (char *)dirname, NULL); - execlp("report-gtk", "report-gtk", "--", (char *)dirname, NULL); - perror_msg_and_die("Can't execute %s", "report-gtk"); + execl(BIN_DIR"/abrt-handle-event", "abrt-handle-event", "-e", "open-gui", "--", (char *)dirname, NULL); + execlp("abrt-handle-event", "abrt-handle-event", "-e", "open-gui", "--", (char *)dirname, NULL); + /* Child can't use GUI error reporting, we need to clear g_custom_logger */ + g_custom_logger = NULL; + perror_msg_and_die("Can't execute '%s'", "abrt-handle-event"); } } }
