[Crash-catcher] [PATCH 0/7] CLI short options
by Karel Klic
The patches add short options to CLI. The bash completion no longer offer to report crashes that were already reported. The man page is updated.
I also renamed --get-list to --list, splitted --get-list-full to --list --full, splitted --report-always to --report --always.
You can also place the argument wherever you want:
abrt-cli --report @1 --always
abrt-cli --report --always @1
Also with short options:
abrt-cli -ra @1
Karel Klic (7):
Split print_crash_infos to two functions, add some comments.
Indentation only
Options overhaul
Update man page
Rename --get-list to --list
Remove dead socket code.
Bash completion update
src/CLI/CLI.cpp | 240 ++++++++++++++++++++++++++++--------------------
src/CLI/abrt-cli.1 | 23 +++--
src/CLI/abrt-cli.bash | 26 +++++-
3 files changed, 176 insertions(+), 113 deletions(-)
13 years, 10 months
[Crash-catcher] [PATCH] unlimited MaxCrashReportsSize
by Nikola Pajkovsky
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/Daemon/Daemon.cpp | 25 +++++++++++++++----------
src/Daemon/abrt.conf | 2 +-
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp
index 6c61d4d..9667238 100644
--- a/src/Daemon/Daemon.cpp
+++ b/src/Daemon/Daemon.cpp
@@ -506,17 +506,22 @@ static gboolean handle_inotify_cb(GIOChannel *gio, GIOCondition condition, gpoin
}
log("Directory '%s' creation detected", name);
- std::string worst_dir;
- while (g_settings_nMaxCrashReportsSize > 0
- && get_dirsize_find_largest_dir(DEBUG_DUMPS_DIR, &worst_dir, name) / (1024*1024) >= g_settings_nMaxCrashReportsSize
- && worst_dir != ""
- ) {
- log("Size of '%s' >= %u MB, deleting '%s'", DEBUG_DUMPS_DIR, g_settings_nMaxCrashReportsSize, worst_dir.c_str());
- g_pCommLayer->QuotaExceed(_("Report size exceeded the quota. Please check system's MaxCrashReportsSize value in abrt.conf."));
- /* deletes both directory and DB record */
- DeleteDebugDump_by_dir(concat_path_file(DEBUG_DUMPS_DIR, worst_dir.c_str()).c_str());
- worst_dir = "";
+ if (g_settings_nMaxCrashReportsSize > 0)
+ {
+ std::string worst_dir;
+ while (g_settings_nMaxCrashReportsSize > 0
+ && get_dirsize_find_largest_dir(DEBUG_DUMPS_DIR, &worst_dir, name) / (1024*1024) >= g_settings_nMaxCrashReportsSize
+ && worst_dir != ""
+ ) {
+ log("Size of '%s' >= %u MB, deleting '%s'", DEBUG_DUMPS_DIR, g_settings_nMaxCrashReportsSize, worst_dir.c_str());
+ g_pCommLayer->QuotaExceed(_("Report size exceeded the quota. Please check system's MaxCrashReportsSize value in abrt.conf."));
+ /* deletes both directory and DB record */
+ DeleteDebugDump_by_dir(concat_path_file(DEBUG_DUMPS_DIR, worst_dir.c_str()).c_str());
+ worst_dir = "";
+ }
}
+ else
+ log("MaxReportsSize is unlimited");
try
{
diff --git a/src/Daemon/abrt.conf b/src/Daemon/abrt.conf
index 6a70b82..dcbdba9 100644
--- a/src/Daemon/abrt.conf
+++ b/src/Daemon/abrt.conf
@@ -17,7 +17,7 @@ Database = SQLite3
# Note: you must ensure that whatever directory you specify here exists
# and is writable for abrtd. abrtd will not create it automatically.
#WatchCrashdumpArchiveDir = /var/spool/abrt-upload
-# Max size for crash storage [MiB]
+# Max size for crash storage [MiB] or 0 for unlimited
MaxCrashReportsSize = 1000
# Vector of actions and reporters which are activated immediately
# after a crash occurs, comma separated.
--
1.7.1
13 years, 10 months
[Crash-catcher] [PATCH] Show comment and how to reproduce fields when reporing crashes in abrt-cli
by Karel Klic
---
src/CLI/report.cpp | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/src/CLI/report.cpp b/src/CLI/report.cpp
index e3ecb0e..ebaeafa 100644
--- a/src/CLI/report.cpp
+++ b/src/CLI/report.cpp
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2009 RedHat inc.
+ Copyright (C) 2009, 2010 Red Hat, 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
@@ -302,6 +302,19 @@ static int read_crash_report(map_crash_data_t &report, const char *text)
}
/**
+ * Ensures that the fields needed for editor are present in the crash data.
+ * Fields: comments, how to reproduce.
+ */
+static void create_fields_for_editor(map_crash_data_t &crash_data)
+{
+ if (crash_data.find(FILENAME_COMMENT) == crash_data.end())
+ add_to_crash_data_ext(crash_data, FILENAME_COMMENT, CD_TXT, CD_ISEDITABLE, "");
+
+ if (crash_data.find(FILENAME_REPRODUCE) == crash_data.end())
+ add_to_crash_data_ext(crash_data, FILENAME_REPRODUCE, CD_TXT, CD_ISEDITABLE, "1. \n2. \n3. \n");
+}
+
+/**
* Runs external editor.
* Returns:
* 0 if the launch was successful
@@ -663,6 +676,7 @@ int report(const char *crash_id, int flags)
/* Open text editor and give a chance to review the backtrace etc. */
if (!(flags & CLI_REPORT_BATCH))
{
+ create_fields_for_editor(cr);
int result = run_report_editor(cr);
if (result != 0)
return result;
--
1.7.1
13 years, 10 months
[Crash-catcher] [PATCH] rhel bug points to correct place
by Nikola Pajkovsky
rhbz578397 - abrt should not point to Fedora bugs but
create new RHEL bug instead
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
lib/Plugins/Bugzilla.cpp | 169 +++++++++++++++++++++++++++++++++++++---------
1 files changed, 138 insertions(+), 31 deletions(-)
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp
index b14c28f..aca2665 100644
--- a/lib/Plugins/Bugzilla.cpp
+++ b/lib/Plugins/Bugzilla.cpp
@@ -44,6 +44,7 @@ struct bug_info {
const char* bug_status;
const char* bug_resolution;
const char* bug_reporter;
+ const char* bug_product;
xmlrpc_int32 bug_dup_id;
std::vector<const char*> bug_cc;
};
@@ -53,6 +54,7 @@ static void bug_info_init(struct bug_info* bz)
bz->bug_status = NULL;
bz->bug_resolution = NULL;
bz->bug_reporter = NULL;
+ bz->bug_product = NULL;
bz->bug_dup_id = -1;
}
@@ -61,6 +63,7 @@ static void bug_info_destroy(struct bug_info* bz)
free((void*)bz->bug_status);
free((void*)bz->bug_resolution);
free((void*)bz->bug_reporter);
+ free((void*)bz->bug_product);
if (!bz->bug_cc.empty())
{
@@ -105,8 +108,9 @@ struct ctx: public abrt_xmlrpc_conn {
const char* get_bug_status(xmlrpc_value* result_xml);
const char* get_bug_resolution(xmlrpc_value* result_xml);
const char* get_bug_reporter(xmlrpc_value* result_xml);
+ const char* get_bug_product(xmlrpc_value* relult_xml);
- xmlrpc_value* call_quicksearch_duphash(const char* component, const char* duphash);
+ xmlrpc_value* call_quicksearch_duphash(const char* component, const char* release, const char* duphash);
xmlrpc_value* get_cc_member(xmlrpc_value* result_xml);
xmlrpc_value* get_member(const char* member, xmlrpc_value* result_xml);
@@ -115,7 +119,7 @@ struct ctx: public abrt_xmlrpc_conn {
xmlrpc_int32 get_bug_dup_id(xmlrpc_value* result_xml);
void get_bug_cc(xmlrpc_value* result_xml, struct bug_info* bz);
int add_plus_one_cc(xmlrpc_int32 bug_id, const char* login);
- xmlrpc_int32 new_bug(const map_crash_data_t& pCrashData);
+ xmlrpc_int32 new_bug(const map_crash_data_t& pCrashData, int depend_on_bugno);
int add_attachments(const char* bug_id_str, const map_crash_data_t& pCrashData);
int get_bug_info(struct bug_info* bz, xmlrpc_int32 bug_id);
int add_comment(xmlrpc_int32 bug_id, const char* comment, bool is_private);
@@ -192,6 +196,28 @@ xmlrpc_int32 ctx::get_bug_dup_id(xmlrpc_value* result_xml)
return dup_id_int;
}
+const char* ctx::get_bug_product(xmlrpc_value* result_xml)
+{
+ xmlrpc_value* product_member = get_member("product", result_xml);
+ if (!product_member) //should never happend. Each bug has to set up product
+ return NULL;
+
+ const char* product = NULL;
+ xmlrpc_read_string(&env, product_member, &product);
+ xmlrpc_DECREF(product_member);
+ if (env.fault_occurred)
+ return NULL;
+
+ if (*product != '\0')
+ {
+ VERB3 log("got bug product: %s", product);
+ return product;
+ }
+
+ free((void*)product);
+ return NULL;
+}
+
const char* ctx::get_bug_reporter(xmlrpc_value* result_xml)
{
xmlrpc_value* reporter_member = get_member("reporter", result_xml);
@@ -298,9 +324,24 @@ void ctx::get_bug_cc(xmlrpc_value* result_xml, struct bug_info* bz)
return;
}
-xmlrpc_value* ctx::call_quicksearch_duphash(const char* component, const char* duphash)
+xmlrpc_value* ctx::call_quicksearch_duphash(const char* component, const char* release, const char* duphash)
{
- char *query = xasprintf("ALL component:\"%s\" statuswhiteboard:\"%s\"", component, duphash);
+ char *query = NULL;
+ if (!release)
+ query = xasprintf("ALL component:\"%s\" whiteboard:\"%s\"", component, duphash);
+ else
+ {
+ char *product = NULL;
+ char *version = NULL;
+ parse_release(release, &product, &version);
+ query = xasprintf("ALL component:\"%s\" whiteboard:\"%s\" product:\"%s\"",
+ component, duphash, product
+ );
+ free(product);
+ free(version);
+ }
+
+ VERB3 log("quicksearch for `%s'", query);
xmlrpc_value *ret = call("Bug.search", "({s:s})", "quicksearch", query);
free(query);
return ret;
@@ -324,9 +365,7 @@ xmlrpc_int32 ctx::get_bug_id(xmlrpc_value* result_xml)
if (env.fault_occurred)
return -1;
- log("Bug is already reported: %i", bug_id);
- update_client(_("Bug is already reported: %i"), bug_id);
-
+ VERB3 log("got bug_id %d", (int)bug_id);
return bug_id;
}
@@ -348,7 +387,7 @@ int ctx::add_comment(xmlrpc_int32 bug_id, const char* comment, bool is_private)
return result ? 0 : -1;
}
-xmlrpc_int32 ctx::new_bug(const map_crash_data_t& pCrashData)
+xmlrpc_int32 ctx::new_bug(const map_crash_data_t& pCrashData, int depend_on_bugno)
{
const std::string& package = get_crash_data_item_content(pCrashData, FILENAME_PACKAGE);
const std::string& component = get_crash_data_item_content(pCrashData, FILENAME_COMPONENT);
@@ -379,7 +418,23 @@ xmlrpc_int32 ctx::new_bug(const map_crash_data_t& pCrashData)
char *version = NULL;
parse_release(release.c_str(), &product, &version);
- xmlrpc_value* result = call("Bug.create", "({s:s,s:s,s:s,s:s,s:s,s:s,s:s})",
+ xmlrpc_value* result = NULL;
+ if (depend_on_bugno > -1)
+ {
+ result = call("Bug.create", "({s:s,s:s,s:s,s:s,s:s,s:s,s:s,s:i})",
+ "product", product,
+ "component", component.c_str(),
+ "version", version,
+ "summary", summary.c_str(),
+ "description", description.c_str(),
+ "status_whiteboard", status_whiteboard.c_str(),
+ "platform", arch.c_str(),
+ "dependson", depend_on_bugno
+ );
+ }
+ else
+ {
+ result = call("Bug.create", "({s:s,s:s,s:s,s:s,s:s,s:s,s:s})",
"product", product,
"component", component.c_str(),
"version", version,
@@ -388,6 +443,8 @@ xmlrpc_int32 ctx::new_bug(const map_crash_data_t& pCrashData)
"status_whiteboard", status_whiteboard.c_str(),
"platform", arch.c_str()
);
+
+ }
free(product);
free(version);
@@ -448,12 +505,14 @@ int ctx::get_bug_info(struct bug_info* bz, xmlrpc_int32 bug_id)
if (result)
{
- // mandatory
+ bz->bug_product = get_bug_product(result);
+ if (bz->bug_product == NULL)
+ return -1;
+
bz->bug_status = get_bug_status(result);
if (bz->bug_status == NULL)
return -1;
- // mandatory
bz->bug_reporter = get_bug_reporter(result);
if (bz->bug_reporter == NULL)
return -1;
@@ -624,6 +683,7 @@ std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData,
const std::string& component = get_crash_data_item_content(pCrashData, FILENAME_COMPONENT);
const std::string& duphash = get_crash_data_item_content(pCrashData, CD_DUPHASH);
+ const char *release = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_RELEASE);
ctx bz_server(BugzillaXMLRPC.c_str(), NoSSLVerify);
@@ -631,13 +691,12 @@ std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData,
bz_server.login(Login.c_str(), Password.c_str());
update_client(_("Checking for duplicates..."));
- xmlrpc_value* result = bz_server.call_quicksearch_duphash(component.c_str(), duphash.c_str());
+
+ xmlrpc_value *result = bz_server.call_quicksearch_duphash(component.c_str(), NULL, duphash.c_str());
if (!result)
- {
throw_if_xml_fault_occurred(&bz_server.env);
- }
- xmlrpc_value* all_bugs = bz_server.get_member("bugs", result);
+ xmlrpc_value *all_bugs = bz_server.get_member("bugs", result);
xmlrpc_DECREF(result);
if (!all_bugs)
@@ -647,6 +706,66 @@ std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData,
}
int all_bugs_size = bz_server.get_array_size(all_bugs);
+ struct bug_info bz;
+ int depend_on_bugno = -1;
+ char *product = NULL;
+ char *version = NULL;
+ if (all_bugs_size > 0)
+ {
+ bug_id = bz_server.get_bug_id(all_bugs);
+ xmlrpc_DECREF(all_bugs);
+ if (bug_id == -1)
+ throw_if_xml_fault_occurred(&bz_server.env);
+
+ bug_info_init(&bz);
+ if (bz_server.get_bug_info(&bz, bug_id) == -1)
+ {
+ bug_info_destroy(&bz);
+ throw_if_xml_fault_occurred(&bz_server.env);
+ throw CABRTException(EXCEP_PLUGIN, _("get_bug_info() failed. Could not collect all mandatory information"));
+ }
+
+ parse_release(release, &product, &version);
+ if (strcmp(bz.bug_product, product) != 0)
+ {
+ depend_on_bugno = bug_id;
+ bug_info_destroy(&bz);
+ result = bz_server.call_quicksearch_duphash(component.c_str(), release, duphash.c_str());
+ if (!result)
+ throw_if_xml_fault_occurred(&bz_server.env);
+
+ all_bugs = bz_server.get_member("bugs", result);
+ xmlrpc_DECREF(result);
+
+ if (!all_bugs)
+ {
+ throw_if_xml_fault_occurred(&bz_server.env);
+ throw CABRTException(EXCEP_PLUGIN, _("Missing mandatory member 'bugs'"));
+ }
+
+ all_bugs_size = bz_server.get_array_size(all_bugs);
+ if (all_bugs_size > 0)
+ {
+ bug_id = bz_server.get_bug_id(all_bugs);
+ xmlrpc_DECREF(all_bugs);
+ if (bug_id == -1)
+ throw_if_xml_fault_occurred(&bz_server.env);
+
+ bug_info_init(&bz);
+ if (bz_server.get_bug_info(&bz, bug_id) == -1)
+ {
+ bug_info_destroy(&bz);
+ throw_if_xml_fault_occurred(&bz_server.env);
+ throw CABRTException(EXCEP_PLUGIN, _("get_bug_info() failed. Could not collect all mandatory information"));
+ }
+ }
+ else
+ xmlrpc_DECREF(all_bugs);
+ }
+ }
+ free(product);
+ free(version);
+
if (all_bugs_size < 0)
{
throw_if_xml_fault_occurred(&bz_server.env);
@@ -654,12 +773,14 @@ std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData,
else if (all_bugs_size == 0) // Create new bug
{
update_client(_("Creating new bug..."));
- bug_id = bz_server.new_bug(pCrashData);
+ bug_id = bz_server.new_bug(pCrashData, depend_on_bugno);
if (bug_id < 0)
{
throw_if_xml_fault_occurred(&bz_server.env);
throw CABRTException(EXCEP_PLUGIN, _("Bugzilla entry creation failed"));
}
+
+ log("adding attachments to bug(%d)...", bug_id);
int ret = bz_server.add_attachments(to_string(bug_id).c_str(), pCrashData);
if (ret == -1)
{
@@ -685,21 +806,7 @@ std::string CReporterBugzilla::Report(const map_crash_data_t& pCrashData,
}
// decision based on state
- bug_id = bz_server.get_bug_id(all_bugs);
- xmlrpc_DECREF(all_bugs);
- if (bug_id == -1)
- {
- throw_if_xml_fault_occurred(&bz_server.env);
- }
-
- struct bug_info bz;
- bug_info_init(&bz);
- if (bz_server.get_bug_info(&bz, bug_id) == -1)
- {
- bug_info_destroy(&bz);
- throw_if_xml_fault_occurred(&bz_server.env);
- throw CABRTException(EXCEP_PLUGIN, _("get_bug_info() failed. Could not collect all mandatory information"));
- }
+ update_client(_("Bug is already reported: %i"), bug_id);
xmlrpc_int32 original_bug_id = bug_id;
if ((strcmp(bz.bug_status, "CLOSED") == 0) && (strcmp(bz.bug_resolution, "DUPLICATE") == 0))
--
1.7.1
13 years, 10 months
[Crash-catcher] Credit court terme, ligne "DAILLY", Affacturage etc... consultez nous.
by SIT Group
Si ce message ne s'affiche pas correctement, visualisez la version en ligne.
Ce message vous est envoyé par : contact(a)srv1-sitgroup.com
Pour ne plus recevoir d'informations de notre part : Cliquez-ici pour vous désabonner.
«Ce courriel et les documents qui y sont attaches peuvent contenir des informations confidentielles.
Si vous n'êtes pas le destinataire escompte, merci d'en informer l'expéditeur immédiatement et de détruire ce courriel ainsi que tous les documents attaches de votre système informatique. Toute divulgation, copie du présent courriel et des documents attaches sans autorisation préalable de son émetteur est interdite.
This e-mail and any attached documents may contain confidential or proprietary information. If you are not the intended recipient, please advise the sender immediately and delete this e-mail and all attached documents from your computer system. Any unauthorized disclosure, or copying hereof is prohibited.
Ce courriel commercial est conforme à la législation en vigueur et aux délibérations de la CNIL des 22 et 30 mars 2005 sur la prospection par courrier électronique dans le cadre professionnel. Conformément à l'article 34 de la loi 78-17 du 6 janvier mille neuf cent soixante dix huit, relative à l'informatique, aux fichiers et aux libertés, vous disposez d'un droit d'accès, de rectification des données nominatives vous concernant.
Le présent message est en parfait respect avec la déontologie et les bonnes pratiques de la communication par marketing direct électronique. Conformément à la législation en vigueur et des différents rectificatifs légaux, vous disposez d'un plein droit d'accès, de modifications ou de suppression des données personnelles vous concernant. Vous pouvez à tout moment exercer se droit sur demande écrite ou via notre espace prévu à cet effet. Conformément à la loi Informatique et libertés, vous pouvez vous désabonner à tout moment. Pour toute autre demande n'hésitez pas à nous écrire (Afin de faciliter le traitement de votre envoi, précisez votre demande dans l'objet et le corps du message).
Loi nº 78-17 du 6 Janvier mille neuf cent soixante dix huit, relative à l'informatique, aux fichiers et aux libertés : Toute personne physique a le droit de s'opposer, pour des motifs légitimes, à ce que des données à caractère personnel la concernant fassent l'objet d'un traitement. Elle a le droit de s'opposer, sans frais, à ce que les données la concernant soient utilisées à des fins de prospection, notamment commerciale, par le responsable actuel du traitement ou celui d'un traitement ultérieur. Les dispositions du premier alinéa ne s'appliquent pas lorsque le traitement répond à une nécessité légale ou lorsque l'application de ces dispositions a été écartée par une disposition expresse de l'acte autorisant le traitement de la publicité par voie électronique.
Art 38 : Toute personne physique a le droit de s'opposer, pour des motifs légitimes, à ce que des données à caractère personnel la concernant fassent l'objet d'un traitement. Elle a le droit de s'opposer, sans frais, à ce que les données la concernant soient utilisées à des fins de prospection, notamment commerciale, par le responsable actuel du traitement ou celui d'un traitement ultérieur. Les dispositions du premier alinéa ne s''appliquent pas lorsque le traitement répond à une obligation légale ou lorsque l'application de ces dispositions a été écartée par une disposition expresse de l'acte autorisant le traitement.
Pour ne plus recevoir d'informations de notre part : Cliquez-ici pour vous désabonner.
Si vous souhaitez vous désabonner, recopiez cette adresse dans la barre d'adresse de votre navigateur :
http://www.srv1-sitgroup.com/u-1.1.php?param=3Rbi_1IvEkRQjb1KxEsDQWYvAORt...
13 years, 10 months
[Crash-catcher] [PATCH] GUI: add a hostname column
by Jiri Moskovcak
Added hostname column to gui, any comments are welcome. The gui should
be able to display only required columns, which means that it should be
abel to store and load it's settings.
Please review,
Jirka
13 years, 10 months
[Crash-catcher] Proposition de collaboration
by Laurent DUMAS
Bonjour,
Je suis Laurent DUMAS, chargé de clientèle chez Pro Mail, 1ère agence de-mail marketing en France.
Jaurais aimé mentretenir avec vous (ou la personne concernée) des opportunités de collaboration entre nos sociétés.
Nous pouvons vous fournir une gamme complète doutils et de prestations dacquisition ou de fidélisation de clients:
Logiciel on-line de gestion de campagnes de-mailing (une version gratuite est disponible; nous pouvons en discuter directement).
Fichiers très qualifiés BtoC et BtoB en France et à linternational (e-mail, mobile, postal, fax), plus de 20 fichiers.
Une gamme de fichiers décideurs ( Marketing, Ressources humaines, Responsables financiers, Direction informatique ...), ces fichiers sont qualifiés 100% par téléphone.
Génération de leads et de prospects, enrichissement de vos propres bases, création de messages, conseil et autres prestations
Développement de couponing avec suivi via un back office on-line.
Merci de me contacter au 01.74 900 718 ou de me communiquer via notre formulaire vos disponibilités afin que je puisse vous rappeler.
Cordialement,
Laurent DUMAS
Chargé de clientèle
Tél : 01 74 900 718
Fax : 01 730 200 81
Accéder à notre site web cliquez IcI
Nous vous avons envoyé ce message dans le cadre de votre activité professionnelle. vous pouvez a tout moment sortir de notre liste de diffusion en Cliquant ICI.
Si vous souhaitez vous désabonner, recopiez cette adresse dans la barre d'adresse de votre navigateur :
http://www.reply-etoileservice.com/u-1.1.php?param=3Rbi_1IvEkRQjb1KxE:8Zb...
13 years, 10 months
Re: [Crash-catcher] [PATCH 1/7] Split print_crash_infos to two functions, add some comments.
by Karel Klic
Oh, git failed to attach the introductory email.
I owe you a summary.
The patches add short options to CLI. The bash completion no longer
offer to report crashes that were already reported. The man page is updated.
I also renamed --get-list to --list, splitted --get-list-full to --list
--full, splitted --report-always to --report --always.
You can also place the argument wherever you want:
abrt-cli --report @1 --always
abrt-cli --report --always @1
Also with short options:
abrt-cli -ra @1
On 06/22/2010 04:57 PM, Karel Klic wrote:
> ---
> src/CLI/CLI.cpp | 79 +++++++++++++++++++++++++++++++-----------------------
> 1 files changed, 45 insertions(+), 34 deletions(-)
>
> diff --git a/src/CLI/CLI.cpp b/src/CLI/CLI.cpp
> index cd530e7..12e433f 100644
> --- a/src/CLI/CLI.cpp
> +++ b/src/CLI/CLI.cpp
> @@ -1,5 +1,5 @@
> /*
> - Copyright (C) 2009 RedHat inc.
> + Copyright (C) 2009, 2010 Red Hat, 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
> @@ -47,43 +47,54 @@ enum
> OPT_DELETE
> };
>
> -static void print_crash_infos(vector_map_crash_data_t& pCrashInfos, int pMode)
> +/** Prints basic information about a crash to stdout. */
> +static void print_crash(const map_crash_data_t&crash)
> {
> - unsigned int ii;
> - for (ii = 0; ii< pCrashInfos.size(); ii++)
> - {
> - map_crash_data_t& info = pCrashInfos[ii];
> - if (pMode == OPT_GET_LIST_FULL || get_crash_data_item_content(info, CD_REPORTED) != "1")
> - {
> - const char *timestr = get_crash_data_item_content(info, FILENAME_TIME).c_str();
> - long time = strtol(timestr, NULL, 10);
> - if (time == 0)
> - error_msg_and_die("Error while converting time string.");
> + /* Create a localized string from crash time. */
> + const char *timestr = get_crash_data_item_content(crash, FILENAME_TIME).c_str();
> + long time = xatou(timestr);
> + char timeloc[256];
> + int success = strftime(timeloc, 128, "%c", localtime(&time));
> + if (!success)
> + error_msg_and_die("Error while converting time to string.");
>
> - char timeloc[256];
> - int success = strftime(timeloc, 128, "%c", localtime(&time));
> - if (!success)
> - error_msg_and_die("Error while converting time to string.");
> + printf(_("\tUID : %s\n"
> + "\tUUID : %s\n"
> + "\tPackage : %s\n"
> + "\tExecutable : %s\n"
> + "\tCrash Time : %s\n"
> + "\tCrash Count: %s\n"),
> + get_crash_data_item_content(crash, CD_UID).c_str(),
> + get_crash_data_item_content(crash, CD_UUID).c_str(),
> + get_crash_data_item_content(crash, FILENAME_PACKAGE).c_str(),
> + get_crash_data_item_content(crash, FILENAME_EXECUTABLE).c_str(),
> + timeloc,
> + get_crash_data_item_content(crash, CD_COUNT).c_str());
> +}
>
> - printf(_("%u.\n"
> - "\tUID : %s\n"
> - "\tUUID : %s\n"
> - "\tPackage : %s\n"
> - "\tExecutable : %s\n"
> - "\tCrash Time : %s\n"
> - "\tCrash Count: %s\n"),
> - ii,
> - get_crash_data_item_content(info, CD_UID).c_str(),
> - get_crash_data_item_content(info, CD_UUID).c_str(),
> - get_crash_data_item_content(info, FILENAME_PACKAGE).c_str(),
> - get_crash_data_item_content(info, FILENAME_EXECUTABLE).c_str(),
> - timeloc,
> - get_crash_data_item_content(info, CD_COUNT).c_str()
> - );
> - }
> +/**
> + * Prints a list containing "crashes" to stdout.
> + * @param include_reported
> + * Do not skip entries marked as already reported.
> + */
> +static void print_crash_list(const vector_map_crash_data_t& crash_list, bool include_reported)
> +{
> + for (unsigned i = 0; i< crash_list.size(); ++i)
> + {
> + const map_crash_data_t& crash = crash_list[i];
> + if (get_crash_data_item_content(crash, CD_REPORTED) == "1"&& !include_reported)
> + continue;
> +
> + printf("%u.\n", i);
> + print_crash(crash);
> }
> }
>
> +/**
> + * Converts crash reference from user's input to unique crash identification
> + * in form UID:UUID.
> + * The returned string must be released by caller.
> + */
> static char *guess_crash_id(const char *str)
> {
> vector_map_crash_data_t ci = call_GetCrashInfos();
> @@ -233,7 +244,7 @@ int main(int argc, char** argv)
> case OPT_GET_LIST_FULL:
> {
> vector_map_crash_data_t ci = call_GetCrashInfos();
> - print_crash_infos(ci, op);
> + print_crash_list(ci, op == OPT_GET_LIST_FULL);
> break;
> }
> case OPT_REPORT:
13 years, 10 months