[BTPARSER PATCH 1/4] Add btp_realloc to header file
by Martin Milata
Signed-off-by: Martin Milata <mmilata(a)redhat.com>
---
lib/utils.h | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/utils.h b/lib/utils.h
index 7c8d6a0..5c9b6a5 100644
--- a/lib/utils.h
+++ b/lib/utils.h
@@ -59,6 +59,12 @@ btp_mallocz(size_t size);
/**
* Never returns NULL.
*/
+void *
+btp_realloc(void *ptr, size_t size);
+
+/**
+ * Never returns NULL.
+ */
char *
btp_vasprintf(const char *format, va_list p);
--
1.7.11.7
11 years
[LIBREPORT PATCH v2] wizard: eliminate evd->success_msg member
by Denys Vlasenko
This also makes setup_and_start_event_run() wrapper
unnecessary, since start_event_run() now has only one parameter.
V2: rediffed
Signed-off-by: Denys Vlasenko <dvlasenk(a)redhat.com>
---
src/gui-wizard-gtk/wizard.c | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 53513b7..2f7f8f7 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -113,7 +113,7 @@ static GtkWidget *g_top_most_window;
static void add_workflow_buttons(GtkBox *box, GHashTable *workflows, GCallback func);
static void set_auto_event_chain(GtkButton *button, gpointer user_data);
-static void setup_and_start_event_run(const char *event_name);
+static void start_event_run(const char *event_name);
typedef struct
{
@@ -1348,7 +1348,6 @@ struct analyze_event_data
struct run_event_state *run_state;
char *event_name;
GList *env_list;
- const char *success_msg;
GIOChannel *channel;
struct strbuf *event_log;
int event_log_state;
@@ -1677,7 +1676,7 @@ static void on_btn_failed_cb(GtkButton *button)
clear_warnings();
update_ls_details_checkboxes(EMERGENCY_ANALYSIS_EVENT_NAME);
- setup_and_start_event_run(EMERGENCY_ANALYSIS_EVENT_NAME);
+ start_event_run(EMERGENCY_ANALYSIS_EVENT_NAME);
/* single shot button -> hide after click */
gtk_widget_hide(GTK_WIDGET(button));
@@ -1819,7 +1818,7 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
{
/* 256 means NOT_REPORTABLE */
if (retval == 256)
- cancel_processing(g_lbl_event_log, evd->success_msg);
+ cancel_processing(g_lbl_event_log, _("Processing finished."));
else
{
/* We use SIGTERM to stop event processing on user's request.
@@ -1835,7 +1834,12 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
}
}
else
- gtk_label_set_text(g_lbl_event_log, evd->success_msg);
+ {
+ gtk_label_set_text(g_lbl_event_log,
+ is_processing_finished() ? _("Processing finished.")
+ : _("Processing finished, please proceed to the next step.")
+ );
+ }
/*g_source_remove(evd->event_source_id);*/
close(evd->fd);
@@ -1870,9 +1874,8 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
return TRUE; /* "please don't remove this event (yet)" */
}
-static void start_event_run(const char *event_name,
- const char *success_msg
-) {
+static void start_event_run(const char *event_name)
+{
/* Start event asynchronously on the dump dir
* (synchronous run would freeze GUI until completion)
*/
@@ -1927,7 +1930,6 @@ static void start_event_run(const char *event_name,
evd->run_state = state;
evd->event_name = xstrdup(event_name);
evd->env_list = env_list;
- evd->success_msg = success_msg;
evd->event_log = strbuf_new();
evd->fd = state->command_out_fd;
@@ -2262,15 +2264,6 @@ static void highlight_forbidden(void)
static gint select_next_page_no(gint current_page_no, gpointer data);
-static void setup_and_start_event_run(const char *event_name)
-{
- start_event_run(event_name,
- /* this event is the last event from the chain */
- is_processing_finished() ? _("Processing finished.")
- : _("Processing finished, please proceed to the next step.")
- );
-}
-
static char *get_next_processed_event(GList **events_list)
{
if (!events_list || !*events_list)
@@ -2445,7 +2438,7 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us
&& g_event_selected[0]
) {
clear_warnings();
- setup_and_start_event_run(g_event_selected);
+ start_event_run(g_event_selected);
}
}
--
1.8.1.4
11 years
[LIBREPORT PATCH 1/2 v2] wizard: remove a bunch of evd->foo members
by Denys Vlasenko
No change in logic
v2: retain cancel_processing()'s "label" argument.
Signed-off-by: Denys Vlasenko <dvlasenk(a)redhat.com>
---
src/gui-wizard-gtk/wizard.c | 40 +++++++++++++---------------------------
1 file changed, 13 insertions(+), 27 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 00f1f20..7394b49 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -1348,9 +1348,6 @@ struct analyze_event_data
struct run_event_state *run_state;
const char *event_name;
GList *env_list;
- GtkWidget *page_widget;
- GtkLabel *status_label;
- GtkTextView *tv_log;
const char *success_msg;
const char *error_msg;
GIOChannel *channel;
@@ -1545,7 +1542,7 @@ static void update_command_run_log(const char* message, struct analyze_event_dat
/* Don't append new line behind single dot */
const char *log_msg = it_is_a_dot ? message : xasprintf("%s\n", message);
- append_to_textview(evd->tv_log, log_msg);
+ append_to_textview(g_tv_event_log, log_msg);
save_to_event_log(evd, log_msg);
/* Because of single dot, see lines above */
@@ -1759,7 +1756,7 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
evd->event_log_state = LOGSTATE_ERRLINE;
msg = xasprintf("(exited with %u)\n", retval);
}
- append_to_textview(evd->tv_log, msg);
+ append_to_textview(g_tv_event_log, msg);
save_to_event_log(evd, msg);
free(msg);
}
@@ -1804,7 +1801,7 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
|| spawn_next_command_in_evd(evd) < 0
) {
VERB1 log("done running event on '%s': %d", g_dump_dir_name, retval);
- append_to_textview(evd->tv_log, "\n");
+ append_to_textview(g_tv_event_log, "\n");
/* Free child output buffer */
strbuf_free(cmd_output);
@@ -1829,23 +1826,23 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
{
/* 256 means NOT_REPORTABLE */
if (retval == 256)
- cancel_processing(evd->status_label, evd->success_msg);
+ cancel_processing(g_lbl_event_log, evd->success_msg);
else
{
/* We use SIGTERM to stop event processing on user's request.
* So SIGTERM is not a failure.
*/
if (retval == EXIT_CANCEL_BY_USER || WTERMSIG(run_state->process_status) == SIGTERM)
- cancel_processing(evd->status_label, /* default message */ NULL);
+ cancel_processing(g_lbl_event_log, /* default message */ NULL);
else
{
- cancel_processing(evd->status_label, evd->error_msg);
+ cancel_processing(g_lbl_event_log, evd->error_msg);
on_failed_event(evd->event_name);
}
}
}
else
- gtk_label_set_text(evd->status_label, evd->success_msg);
+ gtk_label_set_text(g_lbl_event_log, evd->success_msg);
/*g_source_remove(evd->event_source_id);*/
close(evd->fd);
@@ -1880,10 +1877,6 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
}
static void start_event_run(const char *event_name,
- GtkWidget *page,
- GtkTextView *tv_log,
- GtkLabel *status_label,
- const char *start_msg,
const char *error_msg,
const char *success_msg
) {
@@ -1907,11 +1900,11 @@ static void start_event_run(const char *event_name,
//TODO: better msg?
char *msg = xasprintf(_("No processing for event '%s' is defined"), event_name);
if (g_expert_mode)
- gtk_label_set_text(status_label, msg);
+ gtk_label_set_text(g_lbl_event_log, msg);
else
{
- gtk_label_set_text(status_label, error_msg);
- append_to_textview(tv_log, msg);
+ gtk_label_set_text(g_lbl_event_log, error_msg);
+ append_to_textview(g_tv_event_log, msg);
terminate_event_chain();
}
free(msg);
@@ -1926,7 +1919,7 @@ static void start_event_run(const char *event_name,
if (!g_expert_mode)
{
char *msg = xasprintf(_("Processing interrupted: can't continue without writable directory."));
- cancel_processing(status_label, msg);
+ cancel_processing(g_lbl_event_log, msg);
free(msg);
}
return; /* user refused to steal, or write error, etc... */
@@ -1949,9 +1942,6 @@ static void start_event_run(const char *event_name,
evd->run_state = state;
evd->event_name = event_name;
evd->env_list = env_list;
- evd->page_widget = page;
- evd->status_label = status_label;
- evd->tv_log = tv_log;
evd->error_msg = error_msg;
evd->success_msg = success_msg;
evd->event_log = strbuf_new();
@@ -1969,10 +1959,10 @@ static void start_event_run(const char *event_name,
evd
);
- gtk_label_set_text(status_label, start_msg);
+ gtk_label_set_text(g_lbl_event_log, _("Processing..."));
VERB1 log("running event '%s' on '%s'", event_name, g_dump_dir_name);
char *msg = xasprintf("--- Running %s ---\n", event_name);
- append_to_textview(evd->tv_log, msg);
+ append_to_textview(g_tv_event_log, msg);
free(msg);
/* don't bother testing if they are visible, this is faster */
@@ -2291,10 +2281,6 @@ static gint select_next_page_no(gint current_page_no, gpointer data);
static void setup_and_start_event_run(const char *event_name)
{
start_event_run(event_name,
- pages[PAGENO_EVENT_PROGRESS].page_widget,
- g_tv_event_log,
- g_lbl_event_log,
- _("Processing..."),
g_expert_mode ? _("Processing failed. You can try another operation if available.")
: _("Processing failed."),
/* this event is the last event from the chain */
--
1.8.1.4
11 years
Kernel [faf] bugs
by Josh Boyer
Please stop filing faf bugs against the kernel component immediately.
We already get the bugs filed from ABRT, which are usually helpful, and
there is nothing helpful about the bugs being filed from the retrace
server.
We now have over 150 new kernel bugs against various old versions of the
kernel that are no longer relevant. Many of them are backtraces from
things containing virtual box modules, etc which ABRT already explicitly
screens. None of these bugs are helpful and it is going to cause us
extra work just to close them out.
josh
11 years
[ABRT PATCH] abrtd: mark unprocessed dump directories as not-reportable
by Jakub Filak
If count item is missing in dump directory at abrtd start, then abrtd
considers that dump directory as unprocessed.
Closes #562
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/daemon/abrtd.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 111 insertions(+), 14 deletions(-)
diff --git a/src/daemon/abrtd.c b/src/daemon/abrtd.c
index 7001079..044eb41 100644
--- a/src/daemon/abrtd.c
+++ b/src/daemon/abrtd.c
@@ -892,6 +892,98 @@ static void start_syslog_logging()
putenv((char*)"ABRT_SYSLOG=1");
}
+/* The function expects that FILENAME_COUNT dump dir element is created by
+ * abrtd after all post-create events are successfully done. Thus if
+ * FILENAME_COUNT element doesn't exist abrtd can consider the dump directory
+ * as unprocessed.
+ *
+ * Relying on content of dump directory has one problem. If a hook provides
+ * FILENAME_COUNT abrtd will consider the dump directory as processed.
+ */
+static void mark_unprocessed_dump_dirs_not_reportable(const char *path)
+{
+ log("Searching for unprocessed dump directories");
+
+ DIR *dp = opendir(path);
+ if (!dp)
+ {
+ perror_msg("Can't find unprocessed dump directories in directory '%s'", path);
+ return;
+ }
+
+ struct dirent *dent;
+ while ((dent = readdir(dp)) != NULL)
+ {
+ if (dot_or_dotdot(dent->d_name))
+ continue; /* skip "." and ".." */
+
+ char *full_name = concat_path_file(path, dent->d_name);
+
+ struct stat stat_buf;
+ if (stat(full_name, &stat_buf) != 0)
+ {
+ log("Can't access path '%s'", full_name);
+ goto next_dd;
+ }
+
+ if (S_ISDIR(stat_buf.st_mode) == 0)
+ /* This is expected. The dump location contains some aux files */
+ goto next_dd;
+
+ struct dump_dir *dd = dd_opendir(full_name, /*flags*/0);
+ if (dd)
+ {
+ if (!dd_exist(dd, FILENAME_COUNT))
+ {
+ log("Marking dump dir '%s' as not reportable because of missing '"FILENAME_COUNT"' item",
+ full_name);
+
+ const char *reason = _("The problem data are incomplete. This "
+ "usually happens when a problem is detected while "
+ "computer is shutting down or user is logging out. "
+ "In order to provide valuable problem reports, ABRT "
+ "will not allow you to submit this problem. If you "
+ "have time and want to help the developers in their "
+ "effort to sort out this problem, please contact "
+ "them directly.");
+
+ /* Add dummy count 0 (valid dump directories has count >= 1)
+ * Doing it before updating FILENAME_NOT_REPORTABLE item in
+ * order to avoid unexpected growing of FILENAME_NOT_REPORTABLE
+ * item. And if any of the following operation will cause a
+ * failure of abrtd, then abrtd will not go there again after
+ * restart.
+ */
+ VERB1 log("Adding dummy count '0' to '%s'", full_name);
+ dd_save_text(dd, FILENAME_COUNT, "0");
+
+ char *old_not_reportable = dd_load_text_ext(dd, FILENAME_NOT_REPORTABLE,
+ DD_FAIL_QUIETLY_ENOENT | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
+ if (old_not_reportable)
+ { /* Add the reason to the beginnig of
+ * FILENAME_NOT_REPORTABLE item because this has higher
+ * priority (two new lines because the reason doesn't
+ * have any)
+ */
+ char *message = xasprintf("%s\n\n%s", reason, old_not_reportable);
+ dd_save_text(dd, FILENAME_NOT_REPORTABLE, message);
+ free(message);
+ free(old_not_reportable);
+ }
+ else
+ dd_save_text(dd, FILENAME_NOT_REPORTABLE, reason);
+ }
+ dd_close(dd);
+ }
+ else
+ log("Found an invalid dump directory '%s'", full_name);
+
+ next_dd:
+ free(full_name);
+ }
+ closedir(dp);
+}
+
int main(int argc, char** argv)
{
/* I18n */
@@ -959,6 +1051,25 @@ int main(int argc, char** argv)
if (s_timeout != 0)
signal(SIGALRM, handle_signal);
+ /* Moved before daemonization because parent waits for signal from daemon
+ * only for short period and time consumed by
+ * mark_unprocessed_dump_dirs_not_reportable() is slightly unpredictable.
+ */
+ GMainLoop* pMainloop = NULL;
+ GIOChannel* channel_inotify = NULL;
+ guint channel_id_inotify_event = 0;
+ GIOChannel* channel_signal = NULL;
+ guint channel_id_signal_event = 0;
+ bool pidfile_created = false;
+
+ /* Initialization */
+ VERB1 log("Loading settings");
+ if (load_abrt_conf() != 0)
+ goto init_error;
+
+ sanitize_dump_dir_rights();
+ mark_unprocessed_dump_dirs_not_reportable(g_settings_dump_location);
+
/* Daemonize unless -d */
if (!(opts & OPT_d))
{
@@ -994,20 +1105,6 @@ int main(int argc, char** argv)
start_syslog_logging();
}
- GMainLoop* pMainloop = NULL;
- GIOChannel* channel_inotify = NULL;
- guint channel_id_inotify_event = 0;
- GIOChannel* channel_signal = NULL;
- guint channel_id_signal_event = 0;
- bool pidfile_created = false;
-
- /* Initialization */
- VERB1 log("Loading settings");
- if (load_abrt_conf() != 0)
- goto init_error;
-
- sanitize_dump_dir_rights();
-
VERB1 log("Creating glib main loop");
pMainloop = g_main_loop_new(NULL, FALSE);
--
1.8.1.4
11 years
[LIBREPORT PATCH] debuginfo downloader should enable repos matching *debug* closes #138
by Jiri Moskovcak
Signed-off-by: Jiri Moskovcak <jmoskovc(a)redhat.com>
---
src/client-python/debuginfo.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/client-python/debuginfo.py b/src/client-python/debuginfo.py
index 542175e..035d697 100644
--- a/src/client-python/debuginfo.py
+++ b/src/client-python/debuginfo.py
@@ -239,7 +239,7 @@ class DebugInfoDownload(YumBase):
# setting-up repos one-by-one, so we can skip the broken ones...
# this helps when users are using 3rd party repos like rpmfusion
# in rawhide it results in: Can't find valid base url...
- for r in self.repos.findRepos(pattern="*debuginfo*"):
+ for r in self.repos.findRepos(pattern="*debug*"):
try:
rid = self.repos.enableRepo(r.id)
self.repos.doSetup(thisrepo=str(r.id))
--
1.8.1.4
11 years
[LIBREPORT PATCH] wizard: eliminate evd->success_msg member
by Denys Vlasenko
This also makes setup_and_start_event_run() wrapper
unnecessary, since start_event_run() now has only one parameter.
Signed-off-by: Denys Vlasenko <dvlasenk(a)redhat.com>
---
src/gui-wizard-gtk/wizard.c | 31 ++++++++++++-------------------
1 file changed, 12 insertions(+), 19 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index ff35aab..96cc53e 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -113,7 +113,7 @@ static GtkWidget *g_top_most_window;
static void add_workflow_buttons(GtkBox *box, GHashTable *workflows, GCallback func);
static void set_auto_event_chain(GtkButton *button, gpointer user_data);
-static void setup_and_start_event_run(const char *event_name);
+static void start_event_run(const char *event_name);
typedef struct
{
@@ -1348,7 +1348,6 @@ struct analyze_event_data
struct run_event_state *run_state;
const char *event_name;
GList *env_list;
- const char *success_msg;
GIOChannel *channel;
struct strbuf *event_log;
int event_log_state;
@@ -1677,7 +1676,7 @@ static void on_btn_failed_cb(GtkButton *button)
clear_warnings();
update_ls_details_checkboxes(EMERGENCY_ANALYSIS_EVENT_NAME);
- setup_and_start_event_run(EMERGENCY_ANALYSIS_EVENT_NAME);
+ start_event_run(EMERGENCY_ANALYSIS_EVENT_NAME);
/* single shot button -> hide after click */
gtk_widget_hide(GTK_WIDGET(button));
@@ -1825,7 +1824,7 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
{
/* 256 means NOT_REPORTABLE */
if (retval == 256)
- cancel_processing(g_lbl_event_log, evd->success_msg);
+ cancel_processing(g_lbl_event_log, _("Processing finished."));
else
{
/* We use SIGTERM to stop event processing on user's request.
@@ -1841,7 +1840,12 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
}
}
else
- gtk_label_set_text(g_lbl_event_log, evd->success_msg);
+ {
+ gtk_label_set_text(g_lbl_event_log,
+ is_processing_finished() ? _("Processing finished.")
+ : _("Processing finished, please proceed to the next step.")
+ );
+ }
/*g_source_remove(evd->event_source_id);*/
close(evd->fd);
@@ -1875,9 +1879,8 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
return TRUE; /* "please don't remove this event (yet)" */
}
-static void start_event_run(const char *event_name,
- const char *success_msg
-) {
+static void start_event_run(const char *event_name)
+{
/* Start event asynchronously on the dump dir
* (synchronous run would freeze GUI until completion)
*/
@@ -1932,7 +1935,6 @@ static void start_event_run(const char *event_name,
evd->run_state = state;
evd->event_name = event_name;
evd->env_list = env_list;
- evd->success_msg = success_msg;
evd->event_log = strbuf_new();
evd->fd = state->command_out_fd;
@@ -2267,15 +2269,6 @@ static void highlight_forbidden(void)
static gint select_next_page_no(gint current_page_no, gpointer data);
-static void setup_and_start_event_run(const char *event_name)
-{
- start_event_run(event_name,
- /* this event is the last event from the chain */
- is_processing_finished() ? _("Processing finished.")
- : _("Processing finished, please proceed to the next step.")
- );
-}
-
static char *get_next_processed_event(GList **events_list)
{
if (!events_list || !*events_list)
@@ -2450,7 +2443,7 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us
&& g_event_selected[0]
) {
clear_warnings();
- setup_and_start_event_run(g_event_selected);
+ start_event_run(g_event_selected);
}
}
--
1.8.1.4
11 years
[LIBREPORT PATCH v2] Replace "THANKYOU" with EXIT_STOP_EVENT_RUN exit code (70)
by Denys Vlasenko
The wrong part of the message, "please proceed to the next step",
will be fixed by a separate "wizard: eliminate evd->success_msg member" change.
v2: call terminate_event_chain() to prevent chained events from running.
Signed-off-by: Denys Vlasenko <dvlasenk(a)redhat.com>
---
src/cli/cli-report.c | 11 +++--------
src/gui-wizard-gtk/wizard.c | 25 +++++++++++++------------
src/include/internal_libreport.h | 2 ++
src/plugins/ureport.c | 6 +++---
4 files changed, 21 insertions(+), 23 deletions(-)
diff --git a/src/cli/cli-report.c b/src/cli/cli-report.c
index 3923d60..c1d1401 100644
--- a/src/cli/cli-report.c
+++ b/src/cli/cli-report.c
@@ -466,7 +466,6 @@ static void ask_for_missing_settings(const char *event_name)
/*** Event running ***/
struct logging_state {
- bool saw_THANKYOU;
bool output_was_produced;
};
@@ -476,10 +475,9 @@ static char *do_log(char *log_line, void *param)
return log_line;
}
-static char *do_log_and_check_for_THANKYOU(char *log_line, void *param)
+static char *do_log2(char *log_line, void *param)
{
struct logging_state *l_state = param;
- l_state->saw_THANKYOU |= (strcmp("THANKYOU", log_line) == 0);
l_state->output_was_produced |= (log_line[0] != '\0');
return do_log(log_line, param);
}
@@ -754,7 +752,7 @@ int select_and_run_one_event(const char *dump_dir_name, const char *pfx, int int
* 3. Performs review of problem data if event requires review.
* 4. Runs events commands.
* 5. Terminates a chain run if any event from the chain requires termination
- * (prints THANKYOU to stdout in the current implementation)
+ * (i.e. if it existed with EXIT_STOP_EVENT_RUN).
* 6. Terminates a chain run if any error occurs.
* 7. Continues with processing of next event.
*/
@@ -763,13 +761,12 @@ int run_event_chain(const char *dump_dir_name, GList *chain, int interactive)
struct logging_state l_state;
struct run_event_state *run_state = new_run_event_state();
- run_state->logging_callback = do_log_and_check_for_THANKYOU;
+ run_state->logging_callback = do_log2;
run_state->logging_param = &l_state;
int retval = 0;
for (GList *eitem = chain; eitem; eitem = g_list_next(eitem))
{
- l_state.saw_THANKYOU = 0;
l_state.output_was_produced = 0;
const char *event_name = eitem->data;
retval = interactive
@@ -796,8 +793,6 @@ int run_event_chain(const char *dump_dir_name, GList *chain, int interactive)
}
if (retval != 0)
break;
- if (l_state.saw_THANKYOU)
- break;
}
free_run_event_state(run_state);
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index b9f69a4..1886bd7 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -1561,17 +1561,7 @@ static void run_event_gtk_error(const char *error_line, void *param)
static char *run_event_gtk_logging(char *log_line, void *param)
{
struct analyze_event_data *evd = (struct analyze_event_data *)param;
-
- if (strcmp(log_line, "THANKYOU") == 0)
- {
- VERB1 log("Received a request for termination of processing of event chain. (Request: '%s')", log_line);
- terminate_event_chain();
- if (!g_expert_mode)
- evd->success_msg = _("Processing finished.");
- }
- else
- update_command_run_log(log_line, evd);
-
+ update_command_run_log(log_line, evd);
return log_line;
}
@@ -1725,6 +1715,7 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
struct analyze_event_data *evd = data;
struct run_event_state *run_state = evd->run_state;
+ bool stop_requested = false;
int retval = consume_event_command_output(run_state, g_dump_dir_name);
if (retval < 0 && errno == EAGAIN)
@@ -1733,6 +1724,15 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
/* EOF/error */
+ if (WIFEXITED(run_state->process_status)
+ && WEXITSTATUS(run_state->process_status) == EXIT_STOP_EVENT_RUN
+ ) {
+ retval = 0;
+ run_state->process_status = 0;
+ stop_requested = true;
+ terminate_event_chain();
+ }
+
unexport_event_config(evd->env_list);
evd->env_list = NULL;
@@ -1800,7 +1800,8 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
dd_close(dd);
/* Stop if exit code is not 0, or no more commands */
- if (retval != 0
+ if (stop_requested
+ || retval != 0
|| spawn_next_command_in_evd(evd) < 0
) {
VERB1 log("done running event on '%s': %d", g_dump_dir_name, retval);
diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
index b7c354d..3135b4a 100644
--- a/src/include/internal_libreport.h
+++ b/src/include/internal_libreport.h
@@ -432,7 +432,9 @@ extern int logmode;
#define xfunc_error_retval libreport_xfunc_error_retval
extern int xfunc_error_retval;
+/* A few magic exit codes */
#define EXIT_CANCEL_BY_USER 69
+#define EXIT_STOP_EVENT_RUN 70
#define set_xfunc_error_retval libreport_set_xfunc_error_retval
void set_xfunc_error_retval(int retval);
diff --git a/src/plugins/ureport.c b/src/plugins/ureport.c
index e45e07a..764c7aa 100644
--- a/src/plugins/ureport.c
+++ b/src/plugins/ureport.c
@@ -351,7 +351,7 @@ int main(int argc, char **argv)
}
/* -b, -a nor -r were specified - upload uReport from dump_dir */
- int ret = 1; /* return 1 by default */
+ int ret = 1; /* "failure" (for now) */
char *dest_url = concat_path_file(config.ur_url, REPORT_URL_SFX);
config.ur_url = dest_url;
@@ -379,7 +379,7 @@ int main(int argc, char **argv)
if (!response->is_error)
{
VERB1 log("is known: %s", response->value);
- ret = 0;
+ ret = 0; /* "success" */
if (response->bthash)
{
@@ -403,7 +403,7 @@ int main(int argc, char **argv)
log(_("This problem has already been reported."));
if (response->message)
log(response->message);
- log("THANKYOU");
+ ret = EXIT_STOP_EVENT_RUN;
}
}
else
--
1.8.1.4
11 years
[ABRT PATCH] Replace "THANKYOU" with EXIT_STOP_EVENT_RUN exit code (70)
by Denys Vlasenko
Signed-off-by: Denys Vlasenko <dvlasenk(a)redhat.com>
---
src/applet/applet.c | 7 ++++++-
src/daemon/abrt.conf | 4 ++--
src/plugins/abrt-action-ureport | 3 +--
tests/runtests/ureport/runtest.sh | 8 ++++----
tests/runtests/ureport/ureport-valid.py | 2 +-
5 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/applet/applet.c b/src/applet/applet.c
index edc5ff7..4773d06 100644
--- a/src/applet/applet.c
+++ b/src/applet/applet.c
@@ -946,7 +946,6 @@ static gboolean handle_event_output_cb(GIOChannel *gio, GIOCondition condition,
char *msg = state->cmd_output->buf;
VERB3 log("%s", msg);
- pi->known |= (prefixcmp(msg, "THANKYOU") == 0);
strbuf_clear(state->cmd_output);
/* jump to next line */
@@ -964,6 +963,12 @@ static gboolean handle_event_output_cb(GIOChannel *gio, GIOCondition condition,
if (safe_waitpid(state->child_pid, &status, 0) <= 0)
perror_msg("waitpid(%d)", (int)state->child_pid);
+ if (WIFEXITED(status) && WEXITSTATUS(status) == EXIT_STOP_EVENT_RUN)
+ {
+ pi->known = 1;
+ status = 0;
+ }
+
if (status == 0)
{
VERB3 log("fast report finished successfully");
diff --git a/src/daemon/abrt.conf b/src/daemon/abrt.conf
index 6cc3376..7de4261 100644
--- a/src/daemon/abrt.conf
+++ b/src/daemon/abrt.conf
@@ -22,8 +22,8 @@ MaxCrashReportsSize = 1000
DeleteUploaded = no
# A name of event which is run automatically after problem's detection. The
-# event should perform some fast analysis and print out THANKYOU message if the
-# problem is konwn.
+# event should perform some fast analysis and exit with 70 if the
+# problem is known.
#
# In order to run this event automatically after detection, the
# AutoreportingEnabled option must be configured to 'yes'
diff --git a/src/plugins/abrt-action-ureport b/src/plugins/abrt-action-ureport
index b82d1ce..07686f4 100644
--- a/src/plugins/abrt-action-ureport
+++ b/src/plugins/abrt-action-ureport
@@ -40,8 +40,7 @@ if test 0 -ne "$UREPORTS" && test 0 -ne "$COUNT" && test "$UREPORTS" -ge "$COUNT
grep -e "^Bugzilla: " -e "^ABRT Server: " < reported_to | sort -u
if grep -q -e "^Bugzilla: " -e "^ABRT Server: " < reported_to; then
- echo "THANKYOU"
- exit 0
+ exit 70 # EXIT_STOP_EVENT_RUN
fi
log1 "Bug for '$PWD' not yet filed. Continuing."
diff --git a/tests/runtests/ureport/runtest.sh b/tests/runtests/ureport/runtest.sh
index 8bf7ea5..94a2e74 100755
--- a/tests/runtests/ureport/runtest.sh
+++ b/tests/runtests/ureport/runtest.sh
@@ -50,8 +50,8 @@ rlJournalStart
rlRun "reporter-ureport -v --insecure --url http://localhost:12345/faf -d $crash_PATH &> ccpp_reporter" 0 "Send uReport"
kill %1
- rlRun "./ureport-valid.py ccpp_ureport" 0 "Validate uReport contents"
- rlAssertGrep "THANKYOU" ccpp_reporter
+ # 70 is EXIT_STOP_EVENT_RUN
+ rlRun "./ureport-valid.py ccpp_ureport" 70 "Validate uReport contents"
cp $crash_PATH/reported_to ccpp_reported_to
rlAssertGrep "BTHASH=" ccpp_reported_to
@@ -71,8 +71,8 @@ rlJournalStart
rlRun "reporter-ureport -v --insecure --url http://localhost:12345/faf -d $crash_PATH &> python_reporter" 0 "Send uReport"
kill %1
- rlRun "./ureport-valid.py python_ureport" 0 "Validate uReport contents"
- rlAssertGrep "THANKYOU" python_reporter
+ # 70 is EXIT_STOP_EVENT_RUN
+ rlRun "./ureport-valid.py python_ureport" 70 "Validate uReport contents"
cp $crash_PATH/reported_to python_reported_to
rlAssertGrep "BTHASH=" python_reported_to
diff --git a/tests/runtests/ureport/ureport-valid.py b/tests/runtests/ureport/ureport-valid.py
index ff06a41..7eaba05 100755
--- a/tests/runtests/ureport/ureport-valid.py
+++ b/tests/runtests/ureport/ureport-valid.py
@@ -169,6 +169,6 @@ if __name__ == "__main__":
ureport = json.load(fh)
ureport = validate(ureport)
- print "THANKYOU"
+ sys.exit(70)
except Exception as ex:
sys.exit("ERROR {0}".format(str(ex)))
--
1.8.1.4
11 years
[GNOME-ABRT PATCH] Introduce expert mode and show 'Analyze' button in that mode
by Jakub Filak
The button is visible only in expert mode but keyboard shortcut is
enabled all the time. (Ctrl+Alt+Return)
Closes abrt/abrt#634
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/gnome-abrt | 3 +++
src/gnome_abrt/oops.glade | 33 ++++++++++++++++++++++++++++++---
src/gnome_abrt/views.py | 5 ++++-
3 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/src/gnome-abrt b/src/gnome-abrt
index e1fed11..633eb3a 100755
--- a/src/gnome-abrt
+++ b/src/gnome-abrt
@@ -284,6 +284,8 @@ if __name__ == "__main__":
help=_('Be verbose'))
CMDARGS.add_argument('-p', '--problem',
help=_('Selected problem ID'))
+ CMDARGS.add_argument('-x', '--expert', action='store_true',
+ help=_('Expert mode'))
OPTIONS = CMDARGS.parse_args()
@@ -295,6 +297,7 @@ if __name__ == "__main__":
CONF = get_configuration()
# TODO : mark this option as hidden or something like that
CONF.add_option('problemid', default_value=None)
+ CONF.add_option('expert', default_value=(OPTIONS.expert))
APP_CMDLINE = []
if 'problem' in VARS:
diff --git a/src/gnome_abrt/oops.glade b/src/gnome_abrt/oops.glade
index 7cf5da3..1a075f1 100644
--- a/src/gnome_abrt/oops.glade
+++ b/src/gnome_abrt/oops.glade
@@ -24,10 +24,12 @@
</child>
<child>
<object class="GtkAction" id="gac_detail">
- <property name="label" translatable="yes">Detail</property>
+ <property name="label" translatable="yes">Anly_ze</property>
+ <property name="tooltip" translatable="yes">Open selected problem for analysis</property>
<property name="stock_id">gtk-zoom-in</property>
<signal name="activate" handler="on_gac_detail_activate" swapped="no"/>
</object>
+ <accelerator key="Return" modifiers="GDK_CONTROL_MASK | GDK_MOD1_MASK"/>
</child>
<child>
<object class="GtkAction" id="gac_opt_all_problems">
@@ -84,6 +86,13 @@
</object>
</child>
<child>
+ <object class="GtkMenuItem" id="mi_detail">
+ <property name="related_action">gac_detail</property>
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ </child>
+ <child>
<object class="GtkMenuItem" id="mi_open_directory">
<property name="related_action">gac_open_directory</property>
<property name="visible">True</property>
@@ -631,7 +640,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -647,7 +656,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">2</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -658,6 +667,24 @@
<property name="receives_default">True</property>
<property name="halign">end</property>
<property name="margin_left">5</property>
+ <property name="margin_right">5</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="btn_detail">
+ <property name="related_action">gac_detail</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="no_show_all">True</property>
+ <property name="halign">end</property>
+ <property name="margin_left">5</property>
+ <property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/gnome_abrt/views.py b/src/gnome_abrt/views.py
index 336ee95..6bd4723 100644
--- a/src/gnome_abrt/views.py
+++ b/src/gnome_abrt/views.py
@@ -122,6 +122,7 @@ class OopsWindow(Gtk.ApplicationWindow):
self.nb_problem_layout = builder.get_object('nb_problem_layout')
self.btn_delete = builder.get_object('btn_delete')
self.btn_report = builder.get_object('btn_report')
+ self.btn_detail = builder.get_object('btn_detail')
self.te_search = builder.get_object('te_search')
self.chb_all_problems = builder.get_object('chb_all_problems')
self.vbx_links = builder.get_object('vbx_links')
@@ -211,7 +212,8 @@ class OopsWindow(Gtk.ApplicationWindow):
conf = config.get_configuration()
conf.set_watch('problemid', self._options_observer)
self._options_observer.option_updated(conf, 'problemid')
-
+ self._builder.btn_detail.set_visible(conf['expert'])
+ self._builder.mi_detail.set_visible(conf['expert'])
def _find_problem_iter(self, problem, model):
pit = model.get_iter_first()
@@ -351,6 +353,7 @@ class OopsWindow(Gtk.ApplicationWindow):
self._builder.btn_delete.set_sensitive(sensitive_btn)
self._builder.btn_report.set_sensitive(
sensitive_btn and not problem['not-reportable'] )
+ self._builder.btn_detail.set_sensitive(sensitive_btn)
self._builder.vbx_links.foreach(
lambda w, u: w.destroy(), None)
self._builder.vbx_problem_messages.foreach(
--
1.8.1.4
11 years