update to 2.0.6 - bugfixes only

This commit is contained in:
Jiri Moskovcak 2011-10-03 10:22:02 +02:00
parent 0cbbc3a58c
commit cb5f51508b
21 changed files with 271 additions and 1916 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/libreport-2.0.3.tar.gz
/libreport-2.0.4.tar.gz
/libreport-2.0.5.tar.gz
/libreport-2.0.6.tar.gz

View File

@ -1,25 +0,0 @@
From e8408578b1d0b320e8abf27f96186e8fa1f5e4dd Mon Sep 17 00:00:00 2001
From: Michal Toman <mtoman@redhat.com>
Date: Mon, 18 Jul 2011 16:38:02 +0200
Subject: [PATCH 01/12] fix el6 keyring
---
src/gtk-helpers/event_config_dialog.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/gtk-helpers/event_config_dialog.c b/src/gtk-helpers/event_config_dialog.c
index 219f841..c06ba4b 100644
--- a/src/gtk-helpers/event_config_dialog.c
+++ b/src/gtk-helpers/event_config_dialog.c
@@ -318,7 +318,7 @@ static void save_settings_to_keyring(const char *event_name)
GNOME_KEYRING_ITEM_GENERIC_SECRET, /* type */
event_name, /* display name */
attrs, /* attributes */
- NULL, /* secret - no special handling for password it's stored in attrs */
+ "", /* secret - no special handling for password it's stored in attrs */
1, /* update if exist */
&item_id);
VERB2 log("created new item with id: %i", item_id);
--
1.7.6

View File

@ -0,0 +1,47 @@
From 6b8ba25bd3caf0065805197a3b10e2697164ae3b Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Thu, 29 Sep 2011 17:51:20 +0200
Subject: [PATCH 1/4] report-newt: add option to display version (rhbz#741590)
---
src/report-newt/report-newt.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/src/report-newt/report-newt.c b/src/report-newt/report-newt.c
index b8cc020..b8dddbc 100644
--- a/src/report-newt/report-newt.c
+++ b/src/report-newt/report-newt.c
@@ -357,18 +357,29 @@ int main(int argc, char **argv)
enum {
OPT_o = 1 << 0, // report only
OPT_r = 1 << 1,
+ OPT_V = 1 << 2,
};
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
OPT_BOOL('o', "report-only", NULL, _("Skip analyze steps, go through report steps only")),
OPT_BOOL('d', "delete", NULL, _("Remove DIR after reporting")),
+ OPT_BOOL('V', "version", NULL, _("Display version and exit")),
OPT_END()
};
unsigned opts = parse_opts(argc, argv, program_options, program_usage_string);
argv += optind;
- if (!argv[0] || argv[1] || !(opts & OPT_o)) /* zero or >1 arguments */
+ /* zero or >1 arguments with -o, or >0 arguments with -V */
+ if (!(opts & (OPT_o | OPT_V)) ||
+ ((opts & OPT_o) && (!argv[0] || argv[1])) ||
+ ((opts & OPT_V) && argv[0]))
show_usage_and_die(program_usage_string, program_options);
+ if (opts & OPT_V)
+ {
+ printf("%s "VERSION"\n", g_progname);
+ return 0;
+ }
+
dump_dir_name = argv[0];
/* Get settings */
--
1.7.6.4

View File

@ -1,134 +0,0 @@
From 431cad6bc413aaf296b49a510bf5e37aaffc2263 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Tue, 19 Jul 2011 10:04:35 +0200
Subject: [PATCH 02/12] Add a button to add more files to dump dir. Closes #17
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 49 ++++++++++++++++++++++++++++++++++++++-
src/gui-wizard-gtk/wizard.glade | 28 ++++++++++++++++++++++
2 files changed, 76 insertions(+), 1 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index ada9823..cdc4a5c 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -63,6 +63,7 @@ static GtkWidget *g_widget_warnings_area;
static GtkBox *g_box_warning_labels;
static GtkToggleButton *g_tb_approve_bt;
static GtkButton *g_btn_refresh;
+static GtkButton *g_btn_add_file;
static GtkLabel *g_lbl_reporters;
static GtkLabel *g_lbl_size;
@@ -1752,6 +1753,7 @@ static void add_pages()
g_search_entry_bt = GTK_ENTRY( gtk_builder_get_object(builder, "entry_search_bt"));
g_container_details1 = GTK_CONTAINER( gtk_builder_get_object(builder, "container_details1"));
g_container_details2 = GTK_CONTAINER( gtk_builder_get_object(builder, "container_details2"));
+ g_btn_add_file = GTK_BUTTON( gtk_builder_get_object(builder, "btn_add_file"));
g_lbl_reporters = GTK_LABEL( gtk_builder_get_object(builder, "lbl_reporters"));
g_lbl_size = GTK_LABEL( gtk_builder_get_object(builder, "lbl_size"));
@@ -1861,7 +1863,50 @@ static void save_edited_one_liner(GtkCellRendererText *renderer,
}
}
-static void create_details_treeview()
+static void on_btn_add_file(GtkButton *button)
+{
+ GtkWidget *dialog = gtk_file_chooser_dialog_new(
+ "Attach File",
+ GTK_WINDOW(g_assistant),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL
+ );
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
+ {
+ char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+
+ char *basename = strrchr(filename, '/');
+ if (!basename) /* wtf? */
+ goto free_and_ret;
+ basename++;
+
+ struct stat statbuf;
+ if (stat(filename, &statbuf) != 0 || !S_ISREG(statbuf.st_mode))
+ goto free_and_ret;
+
+ struct problem_item *item = get_problem_data_item_or_NULL(g_cd, basename);
+ if (!item || (item->flags & CD_FLAG_ISEDITABLE))
+ {
+ char *new_name = concat_path_file(g_dump_dir_name, basename);
+ /* TODO: error check */
+ copy_file(filename, new_name, 0666);
+ free(new_name);
+ reload_problem_data_from_dump_dir();
+ update_gui_state_from_problem_data();
+ }
+ else
+ {
+ /* TODO: error dialog */
+ }
+ free_and_ret:
+ g_free(filename);
+ }
+ gtk_widget_destroy(dialog);
+}
+
+static void create_details_treeview(void)
{
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
@@ -1944,6 +1989,8 @@ void create_assistant(void)
g_signal_connect(g_btn_refresh, "clicked", G_CALLBACK(on_btn_refresh_clicked), NULL);
g_signal_connect(gtk_text_view_get_buffer(g_tv_comment), "changed", G_CALLBACK(on_comment_changed), NULL);
+ g_signal_connect(g_btn_add_file, "clicked", G_CALLBACK(on_btn_add_file), NULL);
+
/* init searching */
GtkTextBuffer *backtrace_buf = gtk_text_view_get_buffer(g_tv_backtrace);
/* found items background */
diff --git a/src/gui-wizard-gtk/wizard.glade b/src/gui-wizard-gtk/wizard.glade
index 49acd67..ba8b09a 100644
--- a/src/gui-wizard-gtk/wizard.glade
+++ b/src/gui-wizard-gtk/wizard.glade
@@ -685,6 +685,34 @@
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkBox" id="box1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkButton" id="btn_add_file">
+ <property name="label" translatable="yes">Attach a file</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
</child>
</object>
--
1.7.6

View File

@ -0,0 +1,57 @@
From 123741b4e05a23fda1767b5f78a5f1022877d6c7 Mon Sep 17 00:00:00 2001
From: Jiri Moskovcak <jmoskovc@redhat.com>
Date: Fri, 30 Sep 2011 09:31:27 +0200
Subject: [PATCH 2/4] free the string not the strbuf
---
src/gui-wizard-gtk/wizard.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 3b06425..0279f83 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -691,8 +691,9 @@ static void analyze_rb_was_toggled(GtkButton *button, gpointer user_data)
static void report_tb_was_toggled(GtkButton *button, gpointer user_data)
{
char *event_name = (char *)user_data;
- struct strbuf *reporters_string = strbuf_new();
- struct strbuf *reporters_event_string = strbuf_new();
+ struct strbuf *reporters_strbuf = strbuf_new();
+ struct strbuf *reporters_event_strbuf = strbuf_new();
+ char * reporters_string;
/* if ((button && user_data)
* prevents sigsegv which would happen when call from
@@ -735,21 +736,22 @@ static void report_tb_was_toggled(GtkButton *button, gpointer user_data)
while (li != NULL)
{
event_config_t *cfg = get_event_config(li->data);
- strbuf_append_strf(reporters_event_string,
+ strbuf_append_strf(reporters_event_strbuf,
"%s%s",
- (reporters_event_string->len != 0 ? ", " : ""),
+ (reporters_event_strbuf->len != 0 ? ", " : ""),
(li->data ? li->data : "")
);
- strbuf_append_strf(reporters_string,
+ strbuf_append_strf(reporters_strbuf,
"%s%s",
- (reporters_string->len != 0 ? ", " : ""),
+ (reporters_strbuf->len != 0 ? ", " : ""),
(cfg->screen_name ? cfg->screen_name : li->data)
);
li = g_list_next(li);
}
- g_reporter_events_selected = strbuf_free_nobuf(reporters_event_string);
- gtk_label_set_text(g_lbl_reporters, strbuf_free_nobuf(reporters_string));
+ g_reporter_events_selected = strbuf_free_nobuf(reporters_event_strbuf);
+ reporters_string = strbuf_free_nobuf(reporters_strbuf);
+ gtk_label_set_text(g_lbl_reporters, reporters_string);
free(reporters_string); //we can, gtk copies the string
}
--
1.7.6.4

View File

@ -1,32 +0,0 @@
From e4cc4a2a0dfdf644613861e6bd922152a67bf3b8 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Tue, 19 Jul 2011 10:21:49 +0200
Subject: [PATCH 03/12] Ignore files which seem to be editor backups. Closes
bz#707959
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
src/lib/problem_data.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/lib/problem_data.c b/src/lib/problem_data.c
index fcaf8fa..0878b88 100644
--- a/src/lib/problem_data.c
+++ b/src/lib/problem_data.c
@@ -309,6 +309,13 @@ void load_problem_data_from_dump_dir(problem_data_t *problem_data, struct dump_d
goto next;
}
+ if (short_name[0] == '#'
+ || (short_name[0] && short_name[strlen(short_name) - 1] == '~')
+ ) {
+ //log("Excluded (editor backup file):'%s'", short_name);
+ goto next;
+ }
+
ssize_t sz = 4*1024;
char *text = NULL;
bool editable = is_editable_file(short_name);
--
1.7.6

View File

@ -0,0 +1,33 @@
From fff24fb47435200ce6b51de9c43fe0c6d61c93d0 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Fri, 30 Sep 2011 19:13:48 +0200
Subject: [PATCH 3/4] reporter-mailx: set sendwait=1 in environment.
This might improve error detection in sending emails
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
src/plugins/reporter-mailx.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/plugins/reporter-mailx.c b/src/plugins/reporter-mailx.c
index 8e5ff41..ae7f774 100644
--- a/src/plugins/reporter-mailx.c
+++ b/src/plugins/reporter-mailx.c
@@ -99,6 +99,13 @@ static void create_and_send_email(
args = append_str_to_vector(args, &arg_size, email_from);
args = append_str_to_vector(args, &arg_size, email_to);
+ /* This makes (some versions of) mailx to wait for child process to finish,
+ * and to report its exit code, not useless "always 0" exit code.
+ * Sadly, usually this still doesn't help. See:
+ * https://bugzilla.redhat.com/show_bug.cgi?id=740895
+ */
+ putenv((char*)"sendwait=1");
+
log(_("Sending an email..."));
exec_and_feed_input(dsc, args);
--
1.7.6.4

View File

@ -0,0 +1,66 @@
From 57eb0c7c569ef06831ea90777f89920c96ee33b9 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Fri, 30 Sep 2011 19:15:10 +0200
Subject: [PATCH 4/4] reporter-mailx: use Bugzilla's output format. Closes
rhbz#717321.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
src/include/internal_libreport.h | 5 +++--
src/lib/make_descr.c | 2 ++
src/plugins/reporter-mailx.c | 3 ++-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
index afaf911..67a7ea3 100644
--- a/src/include/internal_libreport.h
+++ b/src/include/internal_libreport.h
@@ -548,8 +548,9 @@ char *make_description(problem_data_t *problem_data, char **names_to_skip, unsig
char* make_description_bz(problem_data_t *problem_data);
#define make_description_logger libreport_make_description_logger
char* make_description_logger(problem_data_t *problem_data);
-#define make_description_mailx libreport_make_description_mailx
-char* make_description_mailx(problem_data_t *problem_data);
+//UNUSED
+//#define make_description_mailx libreport_make_description_mailx
+//char* make_description_mailx(problem_data_t *problem_data);
#define parse_release_for_bz libreport_parse_release_for_bz
void parse_release_for_bz(const char *pRelease, char **product, char **version);
diff --git a/src/lib/make_descr.c b/src/lib/make_descr.c
index 7034526..2a6a973 100644
--- a/src/lib/make_descr.c
+++ b/src/lib/make_descr.c
@@ -184,6 +184,7 @@ char *make_description(problem_data_t *problem_data, char **names_to_skip, unsig
return strbuf_free_nobuf(buf_dsc);
}
+#ifdef UNUSED
char* make_description_mailx(problem_data_t *problem_data)
{
struct strbuf *buf_dsc = strbuf_new();
@@ -227,6 +228,7 @@ char* make_description_mailx(problem_data_t *problem_data)
return strbuf_free_nobuf(buf_dsc);
}
+#endif
/* Items we don't want to include to bz / logger */
static const char *const blacklisted_items[] = {
diff --git a/src/plugins/reporter-mailx.c b/src/plugins/reporter-mailx.c
index ae7f774..f7d9cde 100644
--- a/src/plugins/reporter-mailx.c
+++ b/src/plugins/reporter-mailx.c
@@ -75,7 +75,8 @@ static void create_and_send_email(
unsigned arg_size = 0;
args = append_str_to_vector(args, &arg_size, "/bin/mailx");
- char *dsc = make_description_mailx(problem_data);
+ //char *dsc = make_description_mailx(problem_data);
+ char *dsc = make_description_bz(problem_data);
if (send_binary_data)
{
--
1.7.6.4

View File

@ -1,195 +0,0 @@
From 9e36fa04511b245ae904d67cbb9cd803d3a7e7c6 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Tue, 19 Jul 2011 12:06:01 +0200
Subject: [PATCH 04/12] wizard: steal directory before copying added files to
it
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 163 +++++++++++++++++++++++--------------------
1 files changed, 86 insertions(+), 77 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index cdc4a5c..847e84c 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -1675,6 +1675,92 @@ static void search_timeout(GtkEntry *entry)
g_timeout = g_timeout_add(500, &highlight_search, (gpointer)entry);
}
+static void save_edited_one_liner(GtkCellRendererText *renderer,
+ gchar *tree_path,
+ gchar *new_text,
+ gpointer user_data)
+{
+ //log("path:'%s' new_text:'%s'", tree_path, new_text);
+
+ GtkTreeIter iter;
+ if (!gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(g_ls_details), &iter, tree_path))
+ return;
+ gchar *item_name = NULL;
+ gtk_tree_model_get(GTK_TREE_MODEL(g_ls_details), &iter,
+ DETAIL_COLUMN_NAME, &item_name,
+ -1);
+ if (!item_name) /* paranoia, should never happen */
+ return;
+ struct problem_item *item = get_problem_data_item_or_NULL(g_cd, item_name);
+ if (item && (item->flags & CD_FLAG_ISEDITABLE))
+ {
+ struct dump_dir *dd = dd_opendir(g_dump_dir_name, DD_OPEN_READONLY);
+ dd = steal_if_needed(dd);
+ if (dd && dd->locked)
+ {
+ dd_save_text(dd, item_name, new_text);
+ free(item->content);
+ item->content = xstrdup(new_text);
+ gtk_list_store_set(g_ls_details, &iter,
+ DETAIL_COLUMN_VALUE, new_text,
+ -1);
+ }
+ dd_close(dd);
+ }
+}
+
+static void on_btn_add_file(GtkButton *button)
+{
+ GtkWidget *dialog = gtk_file_chooser_dialog_new(
+ "Attach File",
+ GTK_WINDOW(g_assistant),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL
+ );
+ char *filename = NULL;
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
+ filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+ gtk_widget_destroy(dialog);
+
+ if (filename)
+ {
+ char *basename = strrchr(filename, '/');
+ if (!basename) /* wtf? */
+ goto free_and_ret;
+ basename++;
+
+ struct stat statbuf;
+ if (stat(filename, &statbuf) != 0 || !S_ISREG(statbuf.st_mode))
+ goto free_and_ret;
+
+ struct problem_item *item = get_problem_data_item_or_NULL(g_cd, basename);
+ if (!item || (item->flags & CD_FLAG_ISEDITABLE))
+ {
+ struct dump_dir *dd = dd_opendir(g_dump_dir_name, DD_OPEN_READONLY);
+ dd = steal_if_needed(dd);
+ bool writable = (dd && dd->locked);
+ dd_close(dd);
+ if (writable)
+ {
+ char *new_name = concat_path_file(g_dump_dir_name, basename);
+ /* TODO: error check */
+ copy_file(filename, new_name, 0666);
+ free(new_name);
+ reload_problem_data_from_dump_dir();
+ update_gui_state_from_problem_data();
+ }
+ }
+ else
+ {
+ /* TODO: show error dialog */
+ }
+ free_and_ret:
+ g_free(filename);
+ }
+}
+
/* Initialization */
@@ -1829,83 +1915,6 @@ static void add_pages()
// g_signal_connect(g_tv_details, "key-press-event", G_CALLBACK(on_key_press_event_cb), NULL);
}
-static void save_edited_one_liner(GtkCellRendererText *renderer,
- gchar *tree_path,
- gchar *new_text,
- gpointer user_data)
-{
- //log("path:'%s' new_text:'%s'", tree_path, new_text);
-
- GtkTreeIter iter;
- if (!gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(g_ls_details), &iter, tree_path))
- return;
- gchar *item_name = NULL;
- gtk_tree_model_get(GTK_TREE_MODEL(g_ls_details), &iter,
- DETAIL_COLUMN_NAME, &item_name,
- -1);
- if (!item_name) /* paranoia, should never happen */
- return;
- struct problem_item *item = get_problem_data_item_or_NULL(g_cd, item_name);
- if (item && (item->flags & CD_FLAG_ISEDITABLE))
- {
- struct dump_dir *dd = dd_opendir(g_dump_dir_name, DD_OPEN_READONLY);
- dd = steal_if_needed(dd);
- if (dd && dd->locked)
- {
- dd_save_text(dd, item_name, new_text);
- free(item->content);
- item->content = xstrdup(new_text);
- gtk_list_store_set(g_ls_details, &iter,
- DETAIL_COLUMN_VALUE, new_text,
- -1);
- }
- dd_close(dd);
- }
-}
-
-static void on_btn_add_file(GtkButton *button)
-{
- GtkWidget *dialog = gtk_file_chooser_dialog_new(
- "Attach File",
- GTK_WINDOW(g_assistant),
- GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
- NULL
- );
- if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT)
- {
- char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
-
- char *basename = strrchr(filename, '/');
- if (!basename) /* wtf? */
- goto free_and_ret;
- basename++;
-
- struct stat statbuf;
- if (stat(filename, &statbuf) != 0 || !S_ISREG(statbuf.st_mode))
- goto free_and_ret;
-
- struct problem_item *item = get_problem_data_item_or_NULL(g_cd, basename);
- if (!item || (item->flags & CD_FLAG_ISEDITABLE))
- {
- char *new_name = concat_path_file(g_dump_dir_name, basename);
- /* TODO: error check */
- copy_file(filename, new_name, 0666);
- free(new_name);
- reload_problem_data_from_dump_dir();
- update_gui_state_from_problem_data();
- }
- else
- {
- /* TODO: error dialog */
- }
- free_and_ret:
- g_free(filename);
- }
- gtk_widget_destroy(dialog);
-}
-
static void create_details_treeview(void)
{
GtkCellRenderer *renderer;
--
1.7.6

View File

@ -1,27 +0,0 @@
From 94660528f9423f7ef1cfd158627ce4208b01cf59 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Tue, 19 Jul 2011 13:24:57 +0200
Subject: [PATCH 05/12] wizard.glade: glade generates class="GtkBox" which
doesn't work, -> GtkHBox
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
src/gui-wizard-gtk/wizard.glade | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.glade b/src/gui-wizard-gtk/wizard.glade
index ba8b09a..787b7f8 100644
--- a/src/gui-wizard-gtk/wizard.glade
+++ b/src/gui-wizard-gtk/wizard.glade
@@ -686,7 +686,7 @@
</packing>
</child>
<child>
- <object class="GtkBox" id="box1">
+ <object class="GtkHBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
--
1.7.6

View File

@ -1,496 +0,0 @@
From da506c2b0f396ccb5a3f7c83b8fd976a763dd1ed Mon Sep 17 00:00:00 2001
From: Michal Toman <mtoman@redhat.com>
Date: Tue, 19 Jul 2011 13:43:15 +0200
Subject: [PATCH 06/12] support interactive plugins in GUI and CLI
---
src/cli/cli-report.c | 19 +-----
src/gui-wizard-gtk/wizard.c | 179 ++++++++++++++++++++++++++++++++++++++++++-
src/include/client.h | 7 ++
src/include/run_event.h | 1 +
src/lib/client.c | 43 +++++++++--
src/lib/run_event.c | 72 ++++++++++++++++-
6 files changed, 288 insertions(+), 33 deletions(-)
diff --git a/src/cli/cli-report.c b/src/cli/cli-report.c
index 2598a7a..784b37e 100644
--- a/src/cli/cli-report.c
+++ b/src/cli/cli-report.c
@@ -18,6 +18,7 @@
#include "internal_libreport.h"
#include "run-command.h"
#include "cli-report.h"
+#include "client.h"
/* Field separator for the crash report file that is edited by user. */
#define FIELD_SEP "%----"
@@ -404,24 +405,6 @@ static bool ask_yesno(const char *question)
return 0 == strncmp(answer, yes, strlen(yes));
}
-/* Returns true if echo has been changed from another state. */
-static bool set_echo(bool enable)
-{
- struct termios t;
- if (tcgetattr(STDIN_FILENO, &t) < 0)
- return false;
-
- /* No change needed? */
- if ((bool)(t.c_lflag & ECHO) == enable)
- return false;
-
- t.c_lflag ^= ECHO;
- if (tcsetattr(STDIN_FILENO, TCSANOW, &t) < 0)
- perror_msg_and_die("tcsetattr");
-
- return true;
-}
-
/* Returns true if the string contains the specified number. */
static bool is_number_in_string(unsigned number, const char *str)
{
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 847e84c..b100c13 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -17,6 +17,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <gtk/gtk.h>
+#include "client.h"
#include "internal_libreport_gtk.h"
#include "wizard.h"
@@ -1051,14 +1052,186 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
/* Read and insert the output into the log pane */
char buf[257]; /* usually we get one line, no need to have big buf */
+ char *msg; /* one line */
+ char *newline;
+ char *raw;
int r;
- while ((r = read(evd->fd, buf, sizeof(buf)-1)) > 0)
+ struct strbuf *line = strbuf_new();
+
+ int alert_prefix_len = strlen(REPORT_PREFIX_ALERT);
+ int ask_prefix_len = strlen(REPORT_PREFIX_ASK);
+ int ask_yes_no_prefix_len = strlen(REPORT_PREFIX_ASK_YES_NO);
+ int ask_password_prefix_len = strlen(REPORT_PREFIX_ASK_PASSWORD);
+
+ /* read buffered and split lines */
+ while ((r = read(evd->fd, buf, sizeof(buf) - 1)) > 0)
{
buf[r] = '\0';
- append_to_textview(evd->tv_log, buf);
- save_to_event_log(evd, buf);
+ raw = buf;
+
+ /* split lines in the current buffer */
+ while ((newline = strchr(raw, '\n')) != NULL)
+ {
+ *newline = '\0';
+ /* finish line */
+ strbuf_append_str(line, raw);
+ strbuf_append_char(line, '\n');
+
+ msg = line->buf;
+
+ /* alert dialog */
+ if (strncmp(REPORT_PREFIX_ALERT, msg, alert_prefix_len) == 0)
+ {
+ msg += alert_prefix_len;
+
+ GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_assistant),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_CLOSE,
+ msg);
+
+ gtk_dialog_run(GTK_DIALOG(dialog));
+ gtk_widget_destroy(dialog);
+ }
+ /* ask dialog with textbox */
+ else if (strncmp(REPORT_PREFIX_ASK, msg, ask_prefix_len) == 0)
+ {
+ msg += ask_prefix_len;
+
+ GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_assistant),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_OK_CANCEL,
+ msg);
+
+ GtkWidget *vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+ GtkWidget *textbox = gtk_entry_new();
+ gtk_entry_set_editable(GTK_ENTRY(textbox), TRUE);
+ gtk_box_pack_start(GTK_BOX(vbox), textbox, TRUE, TRUE, 0);
+ gtk_widget_show(textbox);
+
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
+ {
+ const char *text = gtk_entry_get_text(GTK_ENTRY(textbox));
+ char *response = xasprintf("%s\n", text);
+ if (write(evd->run_state->command_in_fd, response, strlen(response)) < 0)
+ {
+ free(response);
+ VERB1 perror_msg("Unable to write %s\\n to child's stdin", text);
+ return FALSE;
+ }
+
+ free(response);
+ }
+ else
+ {
+ if (write(evd->run_state->command_in_fd, "\n", strlen("\n")) < 0)
+ {
+ VERB1 perror_msg("Unable to write \\n to child's stdin");
+ return FALSE;
+ }
+ }
+
+ gtk_widget_destroy(textbox);
+ gtk_widget_destroy(dialog);
+ }
+ /* ask dialog with passwordbox */
+ else if (strncmp(REPORT_PREFIX_ASK_PASSWORD, msg, ask_password_prefix_len) == 0)
+ {
+ msg += ask_password_prefix_len;
+
+ GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_assistant),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_OK_CANCEL,
+ msg);
+
+ GtkWidget *vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
+ GtkWidget *textbox = gtk_entry_new();
+ gtk_entry_set_editable(GTK_ENTRY(textbox), TRUE);
+ gtk_entry_set_visibility(GTK_ENTRY(textbox), FALSE);
+ gtk_box_pack_start(GTK_BOX(vbox), textbox, TRUE, TRUE, 0);
+ gtk_widget_show(textbox);
+
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
+ {
+ const char *text = gtk_entry_get_text(GTK_ENTRY(textbox));
+ char *response = xasprintf("%s\n", text);
+ if (write(evd->run_state->command_in_fd, response, strlen(response)) < 0)
+ {
+ free(response);
+ VERB1 perror_msg("Unable to write %s\\n to child's stdin", text);
+ return FALSE;
+ }
+
+ free(response);
+ }
+ else
+ {
+ if (write(evd->run_state->command_in_fd, "\n", strlen("\n")) < 0)
+ {
+ VERB1 perror_msg("Unable to write \\n to child's stdin");
+ return FALSE;
+ }
+ }
+
+ gtk_widget_destroy(textbox);
+ gtk_widget_destroy(dialog);
+ }
+ /* yes/no dialog */
+ else if (strncmp(REPORT_PREFIX_ASK_YES_NO, msg, ask_yes_no_prefix_len) == 0)
+ {
+ msg += ask_yes_no_prefix_len;
+
+ GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_assistant),
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ msg);
+
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES)
+ {
+ char *yes = _("y");
+ char *response = xasprintf("%s\n", yes);
+ if (write(evd->run_state->command_in_fd, response, strlen(response)) < 0)
+ {
+ free(response);
+ VERB1 perror_msg("Unable to write %s\\n to child's stdin", yes);
+ return FALSE;
+ }
+
+ free(response);
+ }
+ else
+ {
+ if (write(evd->run_state->command_in_fd, "\n", strlen("\n")) < 0)
+ {
+ VERB1 perror_msg("Unable to write \\n to child's stdin");
+ return FALSE;
+ }
+ }
+
+ gtk_widget_destroy(dialog);
+ }
+ /* no special prefix - forward to log */
+ else
+ {
+ append_to_textview(evd->tv_log, msg);
+ save_to_event_log(evd, msg);
+ }
+
+ strbuf_clear(line);
+
+ /* jump to next line */
+ raw = newline + 1;
+ }
+
+ /* beginning of next line. the line continues by next read() */
+ strbuf_append_str(line, raw);
}
+ strbuf_free(line);
+
if (r < 0 && errno == EAGAIN)
/* We got all buffered data, but fd is still open. Done for now */
return TRUE; /* "please don't remove this event (yet)" */
diff --git a/src/include/client.h b/src/include/client.h
index bbd2f10..8074145 100644
--- a/src/include/client.h
+++ b/src/include/client.h
@@ -22,18 +22,25 @@
#define REPORT_PREFIX_ASK_YES_NO "ASK_YES_NO "
#define REPORT_PREFIX_ASK "ASK "
+#define REPORT_PREFIX_ASK_PASSWORD "ASK_PASSWORD "
#define REPORT_PREFIX_ALERT "ALERT "
#ifdef __cplusplus
extern "C" {
#endif
+#define set_echo libreport_set_echo
+int set_echo(int enable);
+
#define ask_yes_no libreport_ask_yes_no
int ask_yes_no(const char *question);
#define ask libreport_ask
char *ask(const char *question, char *response, int response_len);
+#define ask_password libreport_ask_password
+char *ask_password(const char *question, char *response, int response_len);
+
#define alert libreport_alert
void alert(const char *message);
diff --git a/src/include/run_event.h b/src/include/run_event.h
index f7ae9ed..43730ce 100644
--- a/src/include/run_event.h
+++ b/src/include/run_event.h
@@ -44,6 +44,7 @@ struct run_event_state {
GList *rule_list;
pid_t command_pid;
int command_out_fd;
+ int command_in_fd;
};
struct run_event_state *new_run_event_state(void);
void free_run_event_state(struct run_event_state *state);
diff --git a/src/lib/client.c b/src/lib/client.c
index 88a995b..103828b 100644
--- a/src/lib/client.c
+++ b/src/lib/client.c
@@ -25,6 +25,24 @@ static int is_slave_mode()
return getenv("REPORT_CLIENT_SLAVE") != NULL;
}
+/* Returns 1 if echo has been changed from another state. */
+int set_echo(int enable)
+{
+ struct termios t;
+ if (tcgetattr(STDIN_FILENO, &t) < 0)
+ return 0;
+
+ /* No change needed? */
+ if ((t.c_lflag & ECHO) == enable)
+ return 0;
+
+ t.c_lflag ^= ECHO;
+ if (tcsetattr(STDIN_FILENO, TCSANOW, &t) < 0)
+ perror_msg_and_die("tcsetattr");
+
+ return 1;
+}
+
int ask_yes_no(const char *question)
{
const char *yes = _("y");
@@ -32,12 +50,7 @@ int ask_yes_no(const char *question)
char *env_response = getenv("REPORT_CLIENT_RESPONSE");
if (env_response)
- {
- if (strncasecmp(yes, env_response, strlen(yes)) == 0)
- return true;
- if (strncasecmp(no, env_response, strlen(no)) == 0)
- return false;
- }
+ return strncasecmp(yes, env_response, strlen(yes)) == 0;
if (is_slave_mode())
printf(REPORT_PREFIX_ASK_YES_NO "%s\n", question);
@@ -48,7 +61,7 @@ int ask_yes_no(const char *question)
char response[16];
if (NULL == fgets(response, sizeof(response), stdin))
- return false;
+ return 0;
return strncasecmp(yes, response, strlen(yes)) == 0;
}
@@ -65,6 +78,22 @@ char *ask(const char *question, char *response, int response_len)
return fgets(response, response_len, stdin);
}
+char *ask_password(const char *question, char *response, int response_len)
+{
+ if (is_slave_mode())
+ printf(REPORT_PREFIX_ASK_PASSWORD "%s\n", question);
+ else
+ printf("%s ", question);
+
+ fflush(stdout);
+
+ set_echo(false);
+ char *result = fgets(response, response_len, stdin);
+ set_echo(true);
+
+ return result;
+}
+
void alert(const char *message)
{
if (is_slave_mode())
diff --git a/src/lib/run_event.c b/src/lib/run_event.c
index 0594bde..ba9920c 100644
--- a/src/lib/run_event.c
+++ b/src/lib/run_event.c
@@ -18,6 +18,7 @@
*/
#include <glob.h>
#include <regex.h>
+#include "client.h"
#include "internal_libreport.h"
struct run_event_state *new_run_event_state()
@@ -393,7 +394,7 @@ int spawn_next_command(struct run_event_state *state,
VERB1 log("Executing '%s'", cmd);
/* Export some useful environment variables for children */
- char *env_vec[3];
+ char *env_vec[4];
/* Just exporting dump_dir_name isn't always ok: it can be "."
* and some children want to cd to other directory but still
* be able to find dump directory by using $DUMP_DIR...
@@ -402,7 +403,8 @@ int spawn_next_command(struct run_event_state *state,
env_vec[0] = xasprintf("DUMP_DIR=%s", (full_name ? full_name : dump_dir_name));
free(full_name);
env_vec[1] = xasprintf("EVENT=%s", event);
- env_vec[2] = NULL;
+ env_vec[2] = xasprintf("REPORT_CLIENT_SLAVE=1");
+ env_vec[3] = NULL;
char *argv[4];
argv[0] = (char*)"/bin/sh"; // TODO: honor $SHELL?
@@ -412,7 +414,7 @@ int spawn_next_command(struct run_event_state *state,
int pipefds[2];
state->command_pid = fork_execv_on_steroids(
- EXECFLG_INPUT_NUL + EXECFLG_OUTPUT + EXECFLG_ERR2OUT,
+ EXECFLG_INPUT + EXECFLG_OUTPUT + EXECFLG_ERR2OUT,
argv,
pipefds,
/* env_vec: */ env_vec,
@@ -420,9 +422,11 @@ int spawn_next_command(struct run_event_state *state,
/* uid(unused): */ 0
);
state->command_out_fd = pipefds[0];
+ state->command_in_fd = pipefds[1];
free(env_vec[0]);
free(env_vec[1]);
+ free(env_vec[2]);
free(cmd);
return 0;
@@ -447,10 +451,68 @@ int run_event_on_dir_name(struct run_event_state *state,
if (!fp)
die_out_of_memory();
char *buf;
+ char *msg;
+
+ int alert_prefix_len = strlen(REPORT_PREFIX_ALERT);
+ int ask_prefix_len = strlen(REPORT_PREFIX_ASK);
+ int ask_yes_no_prefix_len = strlen(REPORT_PREFIX_ASK_YES_NO);
+ int ask_password_prefix_len = strlen(REPORT_PREFIX_ASK_PASSWORD);
+
while ((buf = xmalloc_fgetline(fp)) != NULL)
{
- if (state->logging_callback)
- buf = state->logging_callback(buf, state->logging_param);
+ msg = buf;
+
+ /* just cut off prefix, no waiting */
+ if (strncmp(REPORT_PREFIX_ALERT, msg, alert_prefix_len) == 0)
+ {
+ msg += alert_prefix_len;
+ printf("%s\n", msg);
+ fflush(stdout);
+ }
+ /* wait for y/N response on the same line */
+ else if (strncmp(REPORT_PREFIX_ASK_YES_NO, msg, ask_yes_no_prefix_len) == 0)
+ {
+ msg += ask_yes_no_prefix_len;
+ printf("%s [%s/%s] ", msg, _("y"), _("N"));
+ fflush(stdout);
+ char buf[16];
+ if (!fgets(buf, sizeof(buf), stdin))
+ buf[0] = '\0';
+
+ if (write(state->command_in_fd, buf, strlen(buf)) < 0)
+ perror_msg_and_die("write");
+ }
+ /* wait for the string on the same line */
+ else if (strncmp(REPORT_PREFIX_ASK, msg, ask_prefix_len) == 0)
+ {
+ msg += ask_prefix_len;
+ printf("%s ", msg);
+ fflush(stdout);
+ char buf[256];
+ if (!fgets(buf, sizeof(buf), stdin))
+ buf[0] = '\0';
+
+ if (write(state->command_in_fd, buf, strlen(buf)) < 0)
+ perror_msg_and_die("write");
+ }
+ /* set echo off and wait for password on the same line */
+ else if (strncmp(REPORT_PREFIX_ASK_PASSWORD, msg, ask_password_prefix_len) == 0)
+ {
+ msg += ask_password_prefix_len;
+ printf("%s ", msg);
+ fflush(stdout);
+ char buf[256];
+ set_echo(false);
+ if (!fgets(buf, sizeof(buf), stdin))
+ buf[0] = '\0';
+ set_echo(true);
+
+ if (write(state->command_in_fd, buf, strlen(buf)) < 0)
+ perror_msg_and_die("write");
+ }
+ /* no special prefix -> forward to log if applicable */
+ else if (state->logging_callback)
+ msg = state->logging_callback(msg, state->logging_param);
free(buf);
}
fclose(fp); /* Got EOF, close. This also closes state->command_out_fd */
--
1.7.6

View File

@ -1,150 +0,0 @@
From 929176564c779031bec181474364923d6869e30e Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Tue, 19 Jul 2011 14:37:41 +0200
Subject: [PATCH 07/12] wizard: if more than one reporter is chosen, select
all items. Helps with bz#723021
Before this change, in such case all items were unselected.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
src/gui-wizard-gtk/wizard.c | 100 +++++++++++++++++++++++-------------------
1 files changed, 55 insertions(+), 45 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index b100c13..3eea380 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -1655,74 +1655,84 @@ static void on_page_prepare(GtkAssistant *assistant, GtkWidget *page, gpointer u
/* Based on selected reporter, update item checkboxes */
event_config_t *cfg = get_event_config(g_reporter_events_selected ? g_reporter_events_selected : "");
//log("%s: event:'%s', cfg:'%p'", __func__, g_reporter_events_selected, cfg);
+ int allowed_by_reporter = 1;
+ int default_by_reporter = 1;
if (cfg)
{
/* Default settings are... */
- int allowed_by_reporter = 1;
if (cfg->ec_exclude_items_always && strcmp(cfg->ec_exclude_items_always, "*") == 0)
allowed_by_reporter = 0;
- int default_by_reporter = allowed_by_reporter;
+ default_by_reporter = allowed_by_reporter;
if (cfg->ec_exclude_items_by_default && strcmp(cfg->ec_exclude_items_by_default, "*") == 0)
default_by_reporter = 0;
+ }
- GHashTableIter iter;
- char *name;
- struct problem_item *item;
- g_hash_table_iter_init(&iter, g_cd);
- while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&item))
+ GHashTableIter iter;
+ char *name;
+ struct problem_item *item;
+ g_hash_table_iter_init(&iter, g_cd);
+ while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&item))
+ {
+ /* Decide whether item is allowed, required, and what's the default */
+ item->allowed_by_reporter = allowed_by_reporter;
+ if (cfg)
{
- /* Decide whether item is allowed, required, and what's the default */
- item->allowed_by_reporter = allowed_by_reporter;
if (is_in_comma_separated_list(name, cfg->ec_exclude_items_always))
item->allowed_by_reporter = 0;
if ((item->flags & CD_FLAG_BIN) && cfg->ec_exclude_binary_items)
item->allowed_by_reporter = 0;
+ }
- item->default_by_reporter = item->allowed_by_reporter ? default_by_reporter : 0;
+ item->default_by_reporter = item->allowed_by_reporter ? default_by_reporter : 0;
+ if (cfg)
+ {
if (is_in_comma_separated_list(name, cfg->ec_exclude_items_by_default))
item->default_by_reporter = 0;
if (is_in_comma_separated_list(name, cfg->ec_include_items_by_default))
item->allowed_by_reporter = item->default_by_reporter = 1;
+ }
- item->required_by_reporter = 0;
+ item->required_by_reporter = 0;
+ if (cfg)
+ {
if (is_in_comma_separated_list(name, cfg->ec_requires_items))
item->default_by_reporter = item->allowed_by_reporter = item->required_by_reporter = 1;
+ }
- int cur_value;
- if (item->selected_by_user == 0)
- cur_value = item->default_by_reporter;
- else
- cur_value = !!(item->selected_by_user + 1); /* map -1,1 to 0,1 */
-
- //log("%s: '%s' allowed:%d reqd:%d def:%d user:%d", __func__, name,
- // item->allowed_by_reporter,
- // item->required_by_reporter,
- // item->default_by_reporter,
- // item->selected_by_user
- //);
-
- /* Find corresponding line and update checkbox */
- GtkTreeIter iter;
- if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(g_ls_details), &iter))
- {
- do {
- gchar *item_name = NULL;
- gtk_tree_model_get(GTK_TREE_MODEL(g_ls_details), &iter,
- DETAIL_COLUMN_NAME, &item_name,
- -1);
- if (!item_name) /* paranoia, should never happen */
- continue;
- int differ = strcmp(name, item_name);
- g_free(item_name);
- if (differ)
- continue;
- gtk_list_store_set(g_ls_details, &iter,
- DETAIL_COLUMN_CHECKBOX, cur_value,
+ int cur_value;
+ if (item->selected_by_user == 0)
+ cur_value = item->default_by_reporter;
+ else
+ cur_value = !!(item->selected_by_user + 1); /* map -1,1 to 0,1 */
+
+ //log("%s: '%s' allowed:%d reqd:%d def:%d user:%d", __func__, name,
+ // item->allowed_by_reporter,
+ // item->required_by_reporter,
+ // item->default_by_reporter,
+ // item->selected_by_user
+ //);
+
+ /* Find corresponding line and update checkbox */
+ GtkTreeIter iter;
+ if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(g_ls_details), &iter))
+ {
+ do {
+ gchar *item_name = NULL;
+ gtk_tree_model_get(GTK_TREE_MODEL(g_ls_details), &iter,
+ DETAIL_COLUMN_NAME, &item_name,
-1);
- //log("%s: changed gtk_list_store_set to %d", __func__, (item->allowed_by_reporter && item->selected_by_user >= 0));
- break;
- } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(g_ls_details), &iter));
- }
+ if (!item_name) /* paranoia, should never happen */
+ continue;
+ int differ = strcmp(name, item_name);
+ g_free(item_name);
+ if (differ)
+ continue;
+ gtk_list_store_set(g_ls_details, &iter,
+ DETAIL_COLUMN_CHECKBOX, cur_value,
+ -1);
+ //log("%s: changed gtk_list_store_set to %d", __func__, (item->allowed_by_reporter && item->selected_by_user >= 0));
+ break;
+ } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(g_ls_details), &iter));
}
}
}
--
1.7.6

View File

@ -1,84 +0,0 @@
From ddbdc3f2451e061f57b350379d2daecb65bcd7fc Mon Sep 17 00:00:00 2001
From: Jiri Moskovcak <jmoskovc@redhat.com>
Date: Wed, 20 Jul 2011 14:25:34 +0200
Subject: [PATCH 08/12] added xml file for Logger event
---
src/plugins/Makefile.am | 2 ++
src/plugins/print_event.conf | 2 +-
src/plugins/report_Logger.conf | 4 ++--
src/plugins/report_Logger.xml.in | 25 +++++++++++++++++++++++++
5 files changed, 31 insertions(+), 3 deletions(-)
create mode 100644 src/plugins/report_Logger.xml.in
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 4435357..d616ee5 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -23,6 +23,7 @@ dist_events_DATA = \
report_Bugzilla.xml \
report_Bugzilla.conf \
report_Logger.conf \
+ report_Logger.xml \
report_Mailx.xml \
report_RHTSupport.xml \
report_Kerneloops.xml
@@ -62,6 +63,7 @@ EXTRA_DIST = \
report_Bugzilla.xml.in \
report_Bugzilla.conf \
report_Logger.conf \
+ report_Logger.xml.in \
report_Mailx.xml.in \
report_RHTSupport.xml.in \
report_Kerneloops.xml.in
diff --git a/src/plugins/print_event.conf b/src/plugins/print_event.conf
index 7b94aba..6e6e38e 100644
--- a/src/plugins/print_event.conf
+++ b/src/plugins/print_event.conf
@@ -1,2 +1,2 @@
EVENT=report_Logger
- reporter-print -o "${Log_File:-/tmp/abrt.log}" -a "${Append:-no}" -r
+ reporter-print -o "${Logger_Log_File:-/tmp/abrt.log}" -a "${Logger_Append:-no}" -r
diff --git a/src/plugins/report_Logger.conf b/src/plugins/report_Logger.conf
index d885ce5..45f6b5d 100644
--- a/src/plugins/report_Logger.conf
+++ b/src/plugins/report_Logger.conf
@@ -1,2 +1,2 @@
-Log_File=/tmp/abrt.log
-Append=yes
+Logger_Log_File=/tmp/abrt.log
+Logger_Append=yes
diff --git a/src/plugins/report_Logger.xml.in b/src/plugins/report_Logger.xml.in
new file mode 100644
index 0000000..f7230e0
--- /dev/null
+++ b/src/plugins/report_Logger.xml.in
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<event>
+ <_name>Logger</_name>
+ <_description>Save the report locally</_description>
+
+ <requires-items></requires-items>
+ <exclude-items-by-default>coredump</exclude-items-by-default>
+ <exclude-items-always></exclude-items-always>
+ <exclude-binary-items>no</exclude-binary-items>
+ <include-items-by-default></include-items-by-default>
+
+ <options>
+ <option type="text" name="Logger_Log_File">
+ <_label>Log File</_label>
+ <allow-empty>no</allow-empty>
+ <_description>Name of the logfile</_description>
+ <default-value>/tmp/abrt.log</default-value>
+ </option>
+ <option type="bool" name="Logger_Append">
+ <_label>Append</_label>
+ <_description>Append new reports or overwrite the old one.</_description>
+ <default-value>yes</default-value>
+ </option>
+ </options>
+</event>
--
1.7.6

View File

@ -1,26 +0,0 @@
From 68b8aaa4f2c54fbdf9fa3bacfe93c8fcefa35067 Mon Sep 17 00:00:00 2001
From: Miroslav Lichvar <mlichvar@redhat.com>
Date: Wed, 20 Jul 2011 15:53:32 +0200
Subject: [PATCH 09/12] report-cli: don't crash when invalid analyzer is
selected (trac#294)
---
src/cli/cli-report.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/cli/cli-report.c b/src/cli/cli-report.c
index 784b37e..6ec7f96 100644
--- a/src/cli/cli-report.c
+++ b/src/cli/cli-report.c
@@ -620,7 +620,7 @@ char *select_event_option(GList *list_options)
continue;
picked = xatou(answer);
- if (picked > count)
+ if (picked > count || picked < 1)
{
fprintf(stdout, _("You have chosen number out of range"));
fprintf(stdout, "\n");
--
1.7.6

View File

@ -1,94 +0,0 @@
From 6a69e7ad5186709bd3dbaa8e843a1e16b39bb501 Mon Sep 17 00:00:00 2001
From: Denys Vlasenko <dvlasenk@redhat.com>
Date: Thu, 21 Jul 2011 09:51:57 +0200
Subject: [PATCH 10/12] Add another reporting flag, LIBREPORT_GETPID.
This flag means "return the pid of reporting process".
IOW: LIBREPORT_NOWAIT will reparent reporter to init
and return 0, LIBREPORT_NOWAIT | LIBREPORT_GETPID will not,
and will return pid.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
---
src/include/report.h | 9 ++++++---
src/lib/report.c | 14 +++++++++++---
src/report-python/reportmodule.c | 1 +
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/include/report.h b/src/include/report.h
index 18bb20b..410a24d 100644
--- a/src/include/report.h
+++ b/src/include/report.h
@@ -28,10 +28,13 @@ extern "C" {
enum {
LIBREPORT_NOWAIT = 0,
LIBREPORT_WAIT = (1 << 0), /* wait for report to finish and reload the problem data */
- LIBREPORT_ANALYZE = (1 << 1), /* run analyzers? */
+ LIBREPORT_GETPID = (1 << 1), /* return pid of child. Use with LIBREPORT_NOWAIT. */
+ /* Note: without LIBREPORT_GETPID, child will be detached */
+ /* (reparented to init) */
+ LIBREPORT_ANALYZE = (1 << 2), /* run analyzers? */
/* ("run reporters" is always on, has no flag (for now?)) */
- LIBREPORT_RELOAD_DATA = (1 << 3), /* reload problem data after run (needs WAIT) */
- LIBREPORT_DEL_DIR = (1 << 4), /* delete directory after reporting */
+ LIBREPORT_RELOAD_DATA = (1 << 5), /* reload problem data after run (needs WAIT) */
+ LIBREPORT_DEL_DIR = (1 << 6), /* delete directory after reporting */
};
int report_problem_in_dir(const char *dirname, int flags);
diff --git a/src/lib/report.c b/src/lib/report.c
index aaf5326..3c365ae 100644
--- a/src/lib/report.c
+++ b/src/lib/report.c
@@ -74,9 +74,10 @@ int report_problem_in_dir(const char *dirname, int flags)
*/
signal(SIGCHLD, SIG_DFL);
- if (!(flags & LIBREPORT_WAIT))
+ if (!(flags & (LIBREPORT_WAIT | LIBREPORT_GETPID)))
{
- /* Caller doesn't want to wait for completion.
+ /* Caller doesn't want to wait for completion (!LIBREPORT_WAIT),
+ * and doesn't want to have pid returned (!LIBREPORT_GETPID).
* Create a grandchild, and then exit.
* This reparents grandchild to init, and makes waitpid
* in parent detect our exit and return almost immediately.
@@ -120,6 +121,13 @@ int report_problem_in_dir(const char *dirname, int flags)
}
/* parent */
+ if (!(flags & LIBREPORT_WAIT) && (flags & LIBREPORT_GETPID))
+ return pid;
+
+ /* we are here either if LIBREPORT_WAIT (caller wants exitcode)
+ * or !LIBREPORT_GETPID (caller doesn't want to have a child).
+ * In both cases, we need to wait for child:
+ */
int status;
do
pid = waitpid(pid, &status, 0);
@@ -150,7 +158,7 @@ int report_problem_in_memory(problem_data_t *pd, int flags)
dd_close(dd);
VERB2 log("Temp problem dir: '%s'", dir_name);
- if (!(flags & LIBREPORT_WAIT))
+ if (flags & LIBREPORT_NOWAIT)
flags |= LIBREPORT_DEL_DIR;
result = report_problem_in_dir(dir_name, flags);
diff --git a/src/report-python/reportmodule.c b/src/report-python/reportmodule.c
index 3d802f9..b99ed49 100644
--- a/src/report-python/reportmodule.c
+++ b/src/report-python/reportmodule.c
@@ -90,6 +90,7 @@ init_pyreport(void)
/* for include/report/report.h */
PyModule_AddObject(m, "LIBREPORT_NOWAIT" , Py_BuildValue("i", LIBREPORT_NOWAIT ));
PyModule_AddObject(m, "LIBREPORT_WAIT" , Py_BuildValue("i", LIBREPORT_WAIT ));
+ PyModule_AddObject(m, "LIBREPORT_GETPID" , Py_BuildValue("i", LIBREPORT_GETPID ));
PyModule_AddObject(m, "LIBREPORT_ANALYZE" , Py_BuildValue("i", LIBREPORT_ANALYZE ));
PyModule_AddObject(m, "LIBREPORT_RELOAD_DATA", Py_BuildValue("i", LIBREPORT_RELOAD_DATA));
PyModule_AddObject(m, "LIBREPORT_DEL_DIR" , Py_BuildValue("i", LIBREPORT_DEL_DIR ));
--
1.7.6

View File

@ -1,268 +0,0 @@
From 02e0e56b5903f5f0e905f20be8413914ab6aa529 Mon Sep 17 00:00:00 2001
From: Michal Toman <mtoman@redhat.com>
Date: Thu, 21 Jul 2011 14:25:32 +0200
Subject: [PATCH 11/12] add python bindings for interactive plugins
---
configure.ac | 1 +
src/Makefile.am | 2 +-
src/client-python/Makefile.am | 29 +++++++++++++
src/client-python/__init__.py | 15 +++++++
src/client-python/client.c | 83 ++++++++++++++++++++++++++++++++++++++
src/client-python/clientmodule.c | 42 +++++++++++++++++++
src/client-python/common.h | 27 ++++++++++++
8 files changed, 199 insertions(+), 1 deletions(-)
create mode 100644 src/client-python/Makefile.am
create mode 100644 src/client-python/__init__.py
create mode 100644 src/client-python/client.c
create mode 100644 src/client-python/clientmodule.c
create mode 100644 src/client-python/common.h
diff --git a/configure.ac b/configure.ac
index 61f16ae..4b01af6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -126,6 +126,7 @@ AC_CONFIG_FILES([
src/cli/Makefile
src/report-newt/Makefile
src/plugins/Makefile
+ src/client-python/Makefile
po/Makefile.in
])
diff --git a/src/Makefile.am b/src/Makefile.am
index 24dfeb2..3a6da3f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1 +1 @@
-SUBDIRS = include lib plugins report-python gtk-helpers gui-wizard-gtk cli report-newt
+SUBDIRS = include lib plugins report-python gtk-helpers gui-wizard-gtk cli report-newt client-python
diff --git a/src/client-python/Makefile.am b/src/client-python/Makefile.am
new file mode 100644
index 0000000..5a2a58f
--- /dev/null
+++ b/src/client-python/Makefile.am
@@ -0,0 +1,29 @@
+clientexecdir = $(pyexecdir)/reportclient
+
+clientexec_PYTHON = \
+ __init__.py
+
+clientexec_LTLIBRARIES = _reportclient.la
+
+_reportclient_la_SOURCES = \
+ clientmodule.c \
+ client.c \
+ common.h
+_reportclient_la_CPPFLAGS = \
+ -I$(srcdir)/../include/report -I$(srcdir)/../include \
+ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
+ -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \
+ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
+ -DLOCALSTATEDIR='"$(localstatedir)"' \
+ -DCONF_DIR=\"$(CONF_DIR)\" \
+ -DVAR_RUN=\"$(VAR_RUN)\" \
+ $(GLIB_CFLAGS) \
+ $(PYTHON_CFLAGS) \
+ -D_GNU_SOURCE \
+ -Wall -Wwrite-strings -Werror
+_reportclient_la_LDFLAGS = \
+ -module \
+ -avoid-version \
+ -export-symbols-regex init_reportclient
+_reportclient_la_LIBADD = \
+ ../lib/libreport.la
diff --git a/src/client-python/__init__.py b/src/client-python/__init__.py
new file mode 100644
index 0000000..6114b5a
--- /dev/null
+++ b/src/client-python/__init__.py
@@ -0,0 +1,15 @@
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+from _reportclient import *
diff --git a/src/client-python/client.c b/src/client-python/client.c
new file mode 100644
index 0000000..7177ae3
--- /dev/null
+++ b/src/client-python/client.c
@@ -0,0 +1,83 @@
+/*
+ Copyright (C) 2010 Abrt team.
+ Copyright (C) 2010 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include <Python.h>
+
+#include "common.h"
+
+/* C: void alert(const char *message); */
+PyObject *p_alert(PyObject *pself, PyObject *args)
+{
+ const char *message;
+ if (!PyArg_ParseTuple(args, "s", &message))
+ {
+ return NULL;
+ }
+ alert(message);
+ Py_RETURN_NONE;
+}
+
+/* C: char *ask(const char *question, char *response, int response_len); */
+PyObject *p_ask(PyObject *pself, PyObject *args)
+{
+ const char *question;
+ if (!PyArg_ParseTuple(args, "s", &question))
+ {
+ return NULL;
+ }
+
+ char response[256];
+ if (!ask(question, response, sizeof(response)))
+ {
+ Py_RETURN_NONE;
+ }
+
+ return Py_BuildValue("s", response);
+}
+
+/* C: char *ask_password(const char *question, char *response, int response_len); */
+PyObject *p_ask_password(PyObject *pself, PyObject *args)
+{
+ const char *question;
+ if (!PyArg_ParseTuple(args, "s", &question))
+ {
+ return NULL;
+ }
+
+ char response[256];
+ if (!ask_password(question, response, sizeof(response)))
+ {
+ Py_RETURN_NONE;
+ }
+
+ return Py_BuildValue("s", response);
+}
+
+/* C: int ask_yes_no(const char *question); */
+PyObject *p_ask_yes_no(PyObject *pself, PyObject *args)
+{
+ const char *question;
+ if (!PyArg_ParseTuple(args, "s", &question))
+ {
+ return NULL;
+ }
+
+ int response = ask_yes_no(question);
+
+ return Py_BuildValue("i", response);
+}
diff --git a/src/client-python/clientmodule.c b/src/client-python/clientmodule.c
new file mode 100644
index 0000000..e4584dd
--- /dev/null
+++ b/src/client-python/clientmodule.c
@@ -0,0 +1,42 @@
+/*
+ Copyright (C) 2010 Abrt team.
+ Copyright (C) 2010 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include <Python.h>
+
+#include "common.h"
+
+static PyMethodDef module_methods[] = {
+ /* method_name, func, flags, doc_string */
+ /* for include/client.h */
+ { "alert" , p_alert , METH_VARARGS },
+ { "ask" , p_ask , METH_VARARGS },
+ { "ask_password" , p_ask_password , METH_VARARGS },
+ { "ask_yes_no" , p_ask_yes_no , METH_VARARGS },
+ { NULL }
+};
+
+#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */
+#define PyMODINIT_FUNC void
+#endif
+PyMODINIT_FUNC
+init_reportclient(void)
+{
+ PyObject *m = Py_InitModule("_reportclient", module_methods);
+ if (!m)
+ printf("m == NULL\n");
+}
diff --git a/src/client-python/common.h b/src/client-python/common.h
new file mode 100644
index 0000000..02f685f
--- /dev/null
+++ b/src/client-python/common.h
@@ -0,0 +1,27 @@
+/*
+ Copyright (C) 2009 Abrt team.
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include <Python.h>
+
+#include "client.h"
+/* module-level functions */
+/* for include/client.h */
+PyObject *p_alert(PyObject *pself, PyObject *args);
+PyObject *p_ask(PyObject *pself, PyObject *args);
+PyObject *p_ask_password(PyObject *pself, PyObject *args);
+PyObject *p_ask_yes_no(PyObject *pself, PyObject *args);
--
1.7.6

View File

@ -1,32 +0,0 @@
From 3ad62d790e546d18d6970e8b49f6f7e0d689c01d Mon Sep 17 00:00:00 2001
From: Martin Milata <mmilata@redhat.com>
Date: Thu, 21 Jul 2011 15:01:07 +0200
Subject: [PATCH 12/12] run_event_on_dir: fix double free
Run_event_on_dir freed the message buffer even if the logging callback
took ownership (like do_log_and_save_line does). Fix that.
---
src/lib/run_event.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/lib/run_event.c b/src/lib/run_event.c
index ba9920c..77d2819 100644
--- a/src/lib/run_event.c
+++ b/src/lib/run_event.c
@@ -510,9 +510,11 @@ int run_event_on_dir_name(struct run_event_state *state,
if (write(state->command_in_fd, buf, strlen(buf)) < 0)
perror_msg_and_die("write");
}
- /* no special prefix -> forward to log if applicable */
+ /* no special prefix -> forward to log if applicable
+ * note that callback may take ownership of buf by returning NULL */
else if (state->logging_callback)
- msg = state->logging_callback(msg, state->logging_param);
+ buf = state->logging_callback(buf, state->logging_param);
+
free(buf);
}
fclose(fp); /* Got EOF, close. This also closes state->command_out_fd */
--
1.7.6

View File

@ -1,35 +0,0 @@
From 973be6c9f86e6966985984fc647be1156605ff58 Mon Sep 17 00:00:00 2001
From: Jiri Moskovcak <jmoskovc@redhat.com>
Date: Wed, 27 Jul 2011 19:57:00 +0200
Subject: [PATCH 31/32] added bugzilla_event.conf to enable Bugzilla for all
problems not coming from ABRT rhbz#725970
---
src/plugins/Makefile.am | 1 +
src/plugins/bugzilla_event.conf | 1 +
3 files changed, 3 insertions(+), 0 deletions(-)
create mode 100644 src/plugins/bugzilla_event.conf
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index d616ee5..02e0647 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -35,6 +35,7 @@ eventsconfdir = $(EVENTS_CONF_DIR)
dist_eventsconf_DATA = \
mailx_event.conf \
print_event.conf \
+ bugzilla_event.conf \
rhtsupport_event.conf
MAN_TXT = \
diff --git a/src/plugins/bugzilla_event.conf b/src/plugins/bugzilla_event.conf
new file mode 100644
index 0000000..3fb604d
--- /dev/null
+++ b/src/plugins/bugzilla_event.conf
@@ -0,0 +1 @@
+EVENT=report_Bugzilla analyzer=libreport reporter-bugzilla
\ No newline at end of file
--
1.7.6

View File

@ -1,288 +0,0 @@
From 43d9b58ca0ef0242a3905253120c6dbc82c8bc0d Mon Sep 17 00:00:00 2001
From: Jiri Moskovcak <jmoskovc@redhat.com>
Date: Thu, 28 Jul 2011 14:44:43 +0200
Subject: [PATCH 32/32] improved compatibility with anaconda rhbz#725857
- + thoughts from the review
---
src/lib/create_dump_dir.c | 9 ++-
src/lib/dump_dir.c | 15 ++++-
src/lib/parse_release.c | 6 ++
src/report-python/__init__.py | 144 +++++++++++++++++++++++------------------
4 files changed, 107 insertions(+), 67 deletions(-)
diff --git a/src/lib/create_dump_dir.c b/src/lib/create_dump_dir.c
index 13c42e4..27e3761 100644
--- a/src/lib/create_dump_dir.c
+++ b/src/lib/create_dump_dir.c
@@ -23,8 +23,6 @@ static struct dump_dir *try_dd_create(const char *base_dir_name, const char *dir
{
char *path = concat_path_file(base_dir_name, dir_name);
struct dump_dir *dd = dd_create(path, (uid_t)-1L, 0640);
- if (dd)
- dd_create_basic_files(dd, (uid_t)-1L);
free(path);
return dd;
}
@@ -81,5 +79,12 @@ struct dump_dir *create_dump_dir_from_problem_data(problem_data_t *problem_data,
next: ;
}
+ /* need to create basic files AFTER we save the pd to dump_dir
+ * otherwise we can't skip already created files like in case when
+ * reporting from anaconda where we can't read /etc/{system,redhat}-release
+ * and os_release is taken from anaconda
+ */
+ dd_create_basic_files(dd, (uid_t)-1L);
+
return dd;
}
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c
index e4e7fad..d11eeb7 100644
--- a/src/lib/dump_dir.c
+++ b/src/lib/dump_dir.c
@@ -492,8 +492,19 @@ void dd_create_basic_files(struct dump_dir *dd, uid_t uid)
dd_save_text(dd, FILENAME_ARCHITECTURE, buf.machine);
dd_save_text(dd, FILENAME_HOSTNAME, buf.nodename);
- char *release = load_text_file("/etc/system-release",
- DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
+ /* if release exists in dumpdir don't create it, but don't warn
+ * if it doesn't
+ * i.e: anaconda doesn't have /etc/{fedora,redhat}-release and trying to load it
+ * results in errors: rhbz#725857
+ */
+ char *release = dd_load_text_ext(dd, FILENAME_OS_RELEASE,
+ DD_FAIL_QUIETLY_ENOENT | DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
+
+ if (release)
+ return;
+
+ release = load_text_file("/etc/system-release",
+ DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE);
if (!release)
release = load_text_file("/etc/redhat-release", /*flags:*/ 0);
dd_save_text(dd, FILENAME_OS_RELEASE, release);
diff --git a/src/lib/parse_release.c b/src/lib/parse_release.c
index 2cc11ba..889f539 100644
--- a/src/lib/parse_release.c
+++ b/src/lib/parse_release.c
@@ -40,6 +40,12 @@ static void parse_release(const char *release, char** product, char** version, b
strbuf_append_str(buf_product, release);
}
+ /* examples of release strings:
+ * installed system: Red Hat Enterprise Linux Server release 6.2 Beta (Santiago)
+ * anaconda: Red Hat Enterprise Linux 6.2
+ * ^ note missing "release"
+ * so the following parsing would fail, workaround is in python bindings
+ */
const char *r = strstr(release, "release");
const char *space = r ? strchr(r, ' ') : NULL;
diff --git a/src/report-python/__init__.py b/src/report-python/__init__.py
index 796d469..fbbc158 100644
--- a/src/report-python/__init__.py
+++ b/src/report-python/__init__.py
@@ -16,108 +16,118 @@ from _pyreport import *
#Compatibility with report package:
+# Author(s): Gavin Romig-Koch <gavin@redhat.com>
+# ABRT Team
import os
SYSTEM_RELEASE_PATHS = ["/etc/system-release","/etc/redhat-release"]
-####SYSTEM_RELEASE_DEPS = ["system-release", "redhat-release"]
+SYSTEM_RELEASE_DEPS = ["system-release", "redhat-release"]
_hardcoded_default_product = ""
_hardcoded_default_version = ""
-####def getProduct_fromPRODUCT():
-#### try:
-#### import product
-#### return product.productName
-#### except:
-#### return ""
-
-####def getVersion_fromPRODUCT():
-#### try:
-#### import product
-#### return product.productVersion
-#### except:
-#### return ""
-
-####def getProduct_fromRPM():
-#### try:
-#### import rpm
-#### ts = rpm.TransactionSet()
-#### for each_dep in SYSTEM_RELEASE_DEPS:
-#### mi = ts.dbMatch('provides', each_dep)
-#### for h in mi:
-#### if h['name']:
-#### return h['name'].split("-")[0].capitalize()
-####
-#### return ""
-#### except:
-#### return ""
-
-####def getVersion_fromRPM():
-#### try:
-#### import rpm
-#### ts = rpm.TransactionSet()
-#### for each_dep in SYSTEM_RELEASE_DEPS:
-#### mi = ts.dbMatch('provides', each_dep)
-#### for h in mi:
-#### if h['version']:
-#### return str(h['version'])
-#### return ""
-#### except:
-#### return ""
+"""
+def getProduct_fromRPM():
+ try:
+ import rpm
+ ts = rpm.TransactionSet()
+ for each_dep in SYSTEM_RELEASE_DEPS:
+ mi = ts.dbMatch('provides', each_dep)
+ for h in mi:
+ if h['name']:
+ return h['name'].split("-")[0].capitalize()
+
+ return ""
+ except:
+ return ""
def getProduct_fromFILE():
for each_path in SYSTEM_RELEASE_PATHS:
- try:
+ if os.path.exists(each_path):
file = open(each_path, "r")
content = file.read()
if content.startswith("Red Hat Enterprise Linux"):
return "Red Hat Enterprise Linux"
+
if content.startswith("Fedora"):
return "Fedora"
+
i = content.find(" release")
if i > -1:
return content[0:i]
- except:
- pass
+
return ""
+def getVersion_fromRPM():
+ try:
+ import rpm
+ ts = rpm.TransactionSet()
+ for each_dep in SYSTEM_RELEASE_DEPS:
+ mi = ts.dbMatch('provides', each_dep)
+ for h in mi:
+ if h['version']:
+ return str(h['version'])
+
+ return ""
+ except:
+ return ""
+
def getVersion_fromFILE():
for each_path in SYSTEM_RELEASE_PATHS:
- try:
+ if os.path.exists(each_path):
file = open(each_path, "r")
content = file.read()
if content.find("Rawhide") > -1:
return "rawhide"
+
clist = content.split(" ")
i = clist.index("release")
return clist[i+1]
+ else:
+ return ""
+"""
+
+def getProduct_fromPRODUCT():
+ try:
+ from pyanaconda import product
+ return product.productName
+ except:
+ try:
+ import product
+ return product.productName
except:
- pass
- return ""
+ return ""
+
+def getVersion_fromPRODUCT():
+ try:
+ from pyanaconda import product
+ return product.productVersion
+ except:
+ try:
+ import product
+ return product.productVersion
+ except:
+ return ""
+
def getProduct():
- ####product = getProduct_fromPRODUCT()
- ####if product:
- #### return product
- product = getProduct_fromFILE()
+ """Attempt to determine the product of the running system by asking anaconda
+ """
+ product = getProduct_fromPRODUCT()
if product:
return product
- ####product = getProduct_fromRPM()
- ####if product:
- #### return product
+
return _hardcoded_default_product
def getVersion():
- ####version = getVersion_fromPRODUCT()
- ####if version:
- #### return version
- version = getVersion_fromFILE()
+ """Attempt to determine the version of the running system by asking anaconda
+ Always return as a string.
+ """
+ version = getVersion_fromPRODUCT()
if version:
return version
- ####version = getVersion_fromRPM()
- ####if version:
- #### return version
+
return _hardcoded_default_version
def createAlertSignature(component, hashmarkername, hashvalue, summary, alertSignature):
@@ -140,8 +150,16 @@ def createPythonUnhandledExceptionSignature(component, hashmarkername, hashvalue
pd.add("duphash", hashvalue)
pd.add("reason", summary)
pd.add("description", description)
- #pd.add("product", getProduct())
- #pd.add("version", getVersion())
+ product = getProduct()
+ if product:
+ pd.add("product", product)
+ version = getVersion()
+ if version:
+ pd.add("version", version)
+ #libreport expect the os_release as in /etc/redhat-release
+ if (version and product):
+ # need to add "release", parse_release() expects format "<product> release <version>"
+ pd.add("os_release", product +" release "+ version)
pd.add_basics() # adds product and version + some other required field
# FIXME: how to handle files out of dump dir??
#1 = flag BIN
--
1.7.6

View File

@ -4,26 +4,16 @@
Summary: Generic library for reporting various problems
Name: libreport
Version: 2.0.5
Release: 3%{?dist}
Version: 2.0.6
Release: 1%{?dist}
License: GPLv2+
Group: System Environment/Libraries
URL: https://fedorahosted.org/abrt/
Source: https://fedorahosted.org/released/abrt/%{name}-%{version}.tar.gz
Patch0: 0001-fix-el6-keyring.patch
Patch1: 0002-Add-a-button-to-add-more-files-to-dump-dir.-Closes-1.patch
Patch2: 0003-Ignore-files-which-seem-to-be-editor-backups.-Closes.patch
Patch3: 0004-wizard-steal-directory-before-copying-added-files-to.patch
Patch4: 0005-wizard.glade-glade-generates-class-GtkBox-which-does.patch
Patch5: 0006-support-interactive-plugins-in-GUI-and-CLI.patch
Patch6: 0007-wizard-if-more-than-one-reporter-is-chosen-select-al.patch
Patch7: 0008-added-xml-file-for-Logger-event.patch
Patch8: 0009-report-cli-don-t-crash-when-invalid-analyzer-is-sele.patch
Patch9: 0010-Add-another-reporting-flag-LIBREPORT_GETPID.patch
Patch10: 0011-add-python-bindings-for-interactive-plugins.patch
Patch11: 0012-run_event_on_dir-fix-double-free.patch
Patch12: 0031-added-bugzilla_event.conf-to-enable-Bugzilla-for-all.patch
PAtch13: 0032-improved-compatibility-with-anaconda-rhbz-725857.patch
Patch0: 0001-report-newt-add-option-to-display-version-rhbz-74159.patch
Patch1: 0002-free-the-string-not-the-strbuf.patch
Patch2: 0003-reporter-mailx-set-sendwait-1-in-environment.patch
Patch3: 0004-reporter-mailx-use-Bugzilla-s-output-format.-Closes-.patch
BuildRequires: dbus-devel
BuildRequires: gtk2-devel
BuildRequires: curl-devel
@ -44,7 +34,7 @@ BuildRequires: newt-devel
# and all it's plugins, but don't provide the python bindings and the sealert
# end-up with: can't import report.GtkIO
# FIXME: can be removed when F15 will EOLed, needs to stay in rhel6!
Requires: libreport-python
Requires: libreport-python = %{version}-%{release}
# for rhel6
%if 0%{?rhel} >= 6
@ -176,6 +166,15 @@ Obsoletes: abrt-plugin-rhtsupport < 2.0.4
%description plugin-rhtsupport
Plugin to report bugs into RH support system.
%package compat
Summary: %{name}'s compat layer for obsoleted 'report' package
Group: System Environment/Libraries
Requires: %{name}-plugin-bugzilla
Requires: %{name}-plugin-rhtsupport
%description compat
Provides 'report' command-line tool.
%package plugin-reportuploader
Summary: %{name}'s reportuploader plugin
Group: System Environment/Libraries
@ -199,16 +198,6 @@ Plugin to report bugs into anonymous FTP site associated with ticketing system.
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
%build
mkdir -p m4
@ -268,6 +257,8 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_libdir}/libabrt_dbus.so.*
%{_libdir}/libabrt_web.so.*
%exclude %{_libdir}/libabrt_web.so
%{_bindir}/report
%{_mandir}/man5/report_event.conf.5*
%files devel
%defattr(-,root,root,-)
@ -334,7 +325,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%files plugin-bugzilla
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/libreport/plugins/Bugzilla.conf
%config(noreplace) %{_sysconfdir}/libreport/plugins/bugzilla.conf
%{_sysconfdir}/libreport/events/report_Bugzilla.xml
%config(noreplace) %{_sysconfdir}/libreport/events/report_Bugzilla.conf
%config(noreplace) %{_sysconfdir}/libreport/events.d/bugzilla_event.conf
@ -344,17 +335,63 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%files plugin-rhtsupport
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/libreport/plugins/rhtsupport.conf
%{_sysconfdir}/libreport/events/report_RHTSupport.xml
%config(noreplace) %{_sysconfdir}/libreport/events.d/rhtsupport_event.conf
# {_mandir}/man7/abrt-RHTSupport.7.gz
%{_mandir}/man1/reporter-rhtsupport.1.gz
%{_bindir}/reporter-rhtsupport
%files compat
%defattr(-,root,root,-)
%{_bindir}/report
%{_mandir}/man1/report.1.gz
%files plugin-reportuploader
%defattr(-,root,root,-)
%{_mandir}/man*/reporter-upload.*
%{_bindir}/reporter-upload
%{_sysconfdir}/libreport/events/report_Uploader.xml
%config(noreplace) %{_sysconfdir}/libreport/events.d/uploader_event.conf
%changelog
* Mon Oct 03 2011 Jiri Moskovcak <jmoskovc@redhat.com> 2.0.6-1
- updated to the latest upstrem
- just a bug fixing release
* Mon Sep 26 2011 Jiri Moskovcak <jmoskovc@redhat.com> 2.0.5.982-1
- re-fix rhbz#730887
- re-ffixed prgname (nice icons in gnome3) rhbz#741231
- Resolves: #741231 #730887
* Thu Sep 22 2011 Jiri Moskovcak <jmoskovc@redhat.com> 2.0.5-9
- don't allow sending reports with bad rating rhbz#672023
- don't allow reporting without duphash rhbz#739182
- tell users to fill out reports in English rhbz#734037
- fixed config for kerneloops reporter rhbz#731189
- Resolves: #672023 #739182 #734037 #731189
* Fri Sep 09 2011 Jiri Moskovcak <jmoskovc@redhat.com> 2.0.5-8
- allow bugzilla to send binary files
- Related: #733448
* Tue Aug 30 2011 Jiri Moskovcak <jmoskovc@redhat.com> 2.0.5-7
- added glob support to event xml files
- changed handling of long text files
- added a simple editor as a fallback when no editor is installed (i.e in anaconda) rhbz#728479
- Resolves: #733448 #728479
* Tue Aug 16 2011 Jiri Moskovcak <jmoskovc@redhat.com> 2.0.5-6
- improved release parsing rhbz#730887
- Resolves: #730887
* Fri Aug 12 2011 Jiri Moskovcak <jmoskovc@redhat.com> 2.0.5-5
- more anaconda fixes
- Resolves: #729537
* Tue Aug 02 2011 Jiri Moskovcak <jmoskovc@redhat.com> 2.0.5-4
- silent keyring warning rhbz#692433
- further improvements to Anaconda compatibility
* Fri Jul 29 2011 Jiri Moskovcak <jmoskovc@redhat.com> 2.0.5-3
- enable bugzilla reporter for analyzer=libreport rhbz#725970
- improved compatibility with anaconda

View File

@ -1 +1 @@
9d7a8328d891148a4d7b55df18b3603f libreport-2.0.5.tar.gz
177d401ae2a78cc983fb1a930254564f libreport-2.0.6.tar.gz