[LIBREPORT PATCH] added flag to not retry locking the incomplete problem dir
by Jiri Moskovcak
Signed-off-by: Jiri Moskovcak <jmoskovc(a)redhat.com>
---
src/include/dump_dir.h | 1 +
src/lib/dump_dir.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/include/dump_dir.h b/src/include/dump_dir.h
index ba6cc57..c531fcf 100644
--- a/src/include/dump_dir.h
+++ b/src/include/dump_dir.h
@@ -35,6 +35,7 @@ enum {
/* Open symlinks. dd_* funcs don't open symlinks by default */
DD_OPEN_FOLLOW = (1 << 2),
DD_OPEN_READONLY = (1 << 3),
+ DD_DONT_WAIT_FOR_LOCK = (1 << 4),
};
struct dump_dir {
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c
index 64801d2..a8e9a77 100644
--- a/src/lib/dump_dir.c
+++ b/src/lib/dump_dir.c
@@ -295,7 +295,7 @@ static int dd_lock(struct dump_dir *dd, unsigned sleep_usec, int flags)
strcpy(lock_buf + dirname_len, "/.lock");
xunlink(lock_buf);
VERB1 log("Unlocked '%s' (no or corrupted time file)", lock_buf);
- if (--count == 0)
+ if (--count == 0 || flags & DD_DONT_WAIT_FOR_LOCK)
{
errno = EISDIR; /* "this is an ordinary dir, not dump dir" */
return -1;
--
1.8.1.4
11 years
[LIBREPORT PATCH] added flag to not retry locking the incomplete problem dir
by Jiri Moskovcak
Signed-off-by: Jiri Moskovcak <jmoskovc(a)redhat.com>
---
src/include/dump_dir.h | 6 ++----
src/lib/dump_dir.c | 2 +-
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/src/include/dump_dir.h b/src/include/dump_dir.h
index ba6cc57..c227ad5 100644
--- a/src/include/dump_dir.h
+++ b/src/include/dump_dir.h
@@ -35,6 +35,8 @@ enum {
/* Open symlinks. dd_* funcs don't open symlinks by default */
DD_OPEN_FOLLOW = (1 << 2),
DD_OPEN_READONLY = (1 << 3),
+ DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE = (1 << 4),
+ DD_DONT_WAIT_FOR_LOCK = (1 << 5),
};
struct dump_dir {
@@ -63,10 +65,6 @@ void dd_sanitize_mode_and_owner(struct dump_dir *dd);
DIR *dd_init_next_file(struct dump_dir *dd);
int dd_get_next_file(struct dump_dir *dd, char **short_name, char **full_name);
-enum {
- /* DD_FAIL_QUIETLY_ENOENT bit is valid for dd_load_text_ext too, */
- DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE = (DD_OPEN_READONLY << 1),
-};
char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags);
char* dd_load_text(const struct dump_dir *dd, const char *name);
void dd_save_text(struct dump_dir *dd, const char *name, const char *data);
diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c
index 64801d2..a8e9a77 100644
--- a/src/lib/dump_dir.c
+++ b/src/lib/dump_dir.c
@@ -295,7 +295,7 @@ static int dd_lock(struct dump_dir *dd, unsigned sleep_usec, int flags)
strcpy(lock_buf + dirname_len, "/.lock");
xunlink(lock_buf);
VERB1 log("Unlocked '%s' (no or corrupted time file)", lock_buf);
- if (--count == 0)
+ if (--count == 0 || flags & DD_DONT_WAIT_FOR_LOCK)
{
errno = EISDIR; /* "this is an ordinary dir, not dump dir" */
return -1;
--
1.8.1.4
11 years
[ABRT PATCH 1/5] rename problem_api.c -> problem_api_dbus.c
by Jiri Moskovcak
Signed-off-by: Jiri Moskovcak <jmoskovc(a)redhat.com>
---
src/lib/Makefile.am | 2 +-
src/lib/problem_api.c | 176 ---------------------------------------------
src/lib/problem_api_dbus.c | 176 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 177 insertions(+), 177 deletions(-)
delete mode 100644 src/lib/problem_api.c
create mode 100644 src/lib/problem_api_dbus.c
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
index 4b1ddb9..281e5f3 100644
--- a/src/lib/Makefile.am
+++ b/src/lib/Makefile.am
@@ -12,7 +12,7 @@ libabrt_la_SOURCES = \
abrt_glib.c \
migrate_dirs.c \
check_recent_crash_file.c \
- problem_api.c \
+ problem_api_dbus.c \
ignored_problems.c
libabrt_la_CPPFLAGS = \
diff --git a/src/lib/problem_api.c b/src/lib/problem_api.c
deleted file mode 100644
index 04f4069..0000000
--- a/src/lib/problem_api.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- Copyright (C) 2011 ABRT Team
- Copyright (C) 2011 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 "libabrt.h"
-
-static GDBusProxy *get_dbus_proxy(void)
-{
- static GDBusProxy *proxy;
-
- /* we cache it, so we can't free it! */
- if (proxy != NULL)
- return proxy;
-
- GError *error = NULL;
- proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
- G_DBUS_PROXY_FLAGS_NONE,
- NULL,
- ABRT_DBUS_NAME,
- ABRT_DBUS_OBJECT,
- ABRT_DBUS_IFACE,
- NULL,
- &error);
- if (error)
- {
- error_msg(_("Can't connect to system DBus: %s"), error->message);
- g_error_free(error);
- /* proxy is NULL in this case */
- }
- return proxy;
-}
-
-int chown_dir_over_dbus(const char *problem_dir_path)
-{
- GDBusProxy *proxy = get_dbus_proxy();
- if (!proxy)
- return 1;
-
- GError *error = NULL;
- g_dbus_proxy_call_sync(proxy,
- "ChownProblemDir",
- g_variant_new("(s)", problem_dir_path),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &error);
-
- if (error)
- {
- error_msg(_("Can't chown '%s': %s"), problem_dir_path, error->message);
- g_error_free(error);
- return 1;
- }
- return 0;
-}
-
-int delete_problem_dirs_over_dbus(const GList *problem_dir_paths)
-{
- GDBusProxy *proxy = get_dbus_proxy();
- if (!proxy)
- return 1;
-
- GVariant *parameters = variant_from_string_list(problem_dir_paths);
-
- GError *error = NULL;
- g_dbus_proxy_call_sync(proxy,
- "DeleteProblem",
- parameters,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &error);
-//g_variant_unref(parameters); -- need this??? no?? why?
-
- if (error)
- {
- error_msg(_("Deleting problem directory failed: %s"), error->message);
- g_error_free(error);
- return 1;
- }
- return 0;
-}
-
-problem_data_t *get_problem_data_dbus(const char *problem_dir_path)
-{
- GDBusProxy *proxy = get_dbus_proxy();
- if (!proxy)
- return NULL;
-
- GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
- g_variant_builder_add(builder, "s", FILENAME_TIME );
- g_variant_builder_add(builder, "s", FILENAME_REASON );
- g_variant_builder_add(builder, "s", FILENAME_NOT_REPORTABLE);
- g_variant_builder_add(builder, "s", FILENAME_COMPONENT );
- g_variant_builder_add(builder, "s", FILENAME_EXECUTABLE );
- g_variant_builder_add(builder, "s", FILENAME_REPORTED_TO );
- GVariant *params = g_variant_new("(sas)", problem_dir_path, builder);
- g_variant_builder_unref(builder);
-
- GError *error = NULL;
- GVariant *result = g_dbus_proxy_call_sync(proxy,
- "GetInfo",
- params,
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &error);
-
- if (error)
- {
- error_msg(_("Can't get problem data from abrt-dbus: %s"), error->message);
- g_error_free(error);
- return NULL;
- }
-
- problem_data_t *pd = problem_data_new();
- char *key, *val;
- GVariantIter *iter;
- g_variant_get(result, "(a{ss})", &iter);
- while (g_variant_iter_loop(iter, "{ss}", &key, &val))
- {
- problem_data_add_text_noteditable(pd, key, val);
- }
- g_variant_unref(result);
- return pd;
-}
-
-GList *get_problems_over_dbus(bool authorize)
-{
- GDBusProxy *proxy = get_dbus_proxy();
- if (!proxy)
- return ERR_PTR;
-
- GError *error = NULL;
- GVariant *result = g_dbus_proxy_call_sync(proxy,
- authorize ? "GetAllProblems" : "GetProblems",
- g_variant_new("()"),
- G_DBUS_CALL_FLAGS_NONE,
- -1,
- NULL,
- &error);
-
- if (error)
- {
- error_msg(_("Can't get problem list from abrt-dbus: %s"), error->message);
- g_error_free(error);
- return ERR_PTR;
- }
-
- GList *list = NULL;
- if (result)
- {
- /* Fetch "as" from "(as)" */
- GVariant *array = g_variant_get_child_value(result, 0);
- list = string_list_from_variant(array);
- g_variant_unref(array);
- g_variant_unref(result);
- }
-
- return list;
-}
diff --git a/src/lib/problem_api_dbus.c b/src/lib/problem_api_dbus.c
new file mode 100644
index 0000000..04f4069
--- /dev/null
+++ b/src/lib/problem_api_dbus.c
@@ -0,0 +1,176 @@
+/*
+ Copyright (C) 2011 ABRT Team
+ Copyright (C) 2011 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 "libabrt.h"
+
+static GDBusProxy *get_dbus_proxy(void)
+{
+ static GDBusProxy *proxy;
+
+ /* we cache it, so we can't free it! */
+ if (proxy != NULL)
+ return proxy;
+
+ GError *error = NULL;
+ proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SYSTEM,
+ G_DBUS_PROXY_FLAGS_NONE,
+ NULL,
+ ABRT_DBUS_NAME,
+ ABRT_DBUS_OBJECT,
+ ABRT_DBUS_IFACE,
+ NULL,
+ &error);
+ if (error)
+ {
+ error_msg(_("Can't connect to system DBus: %s"), error->message);
+ g_error_free(error);
+ /* proxy is NULL in this case */
+ }
+ return proxy;
+}
+
+int chown_dir_over_dbus(const char *problem_dir_path)
+{
+ GDBusProxy *proxy = get_dbus_proxy();
+ if (!proxy)
+ return 1;
+
+ GError *error = NULL;
+ g_dbus_proxy_call_sync(proxy,
+ "ChownProblemDir",
+ g_variant_new("(s)", problem_dir_path),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+
+ if (error)
+ {
+ error_msg(_("Can't chown '%s': %s"), problem_dir_path, error->message);
+ g_error_free(error);
+ return 1;
+ }
+ return 0;
+}
+
+int delete_problem_dirs_over_dbus(const GList *problem_dir_paths)
+{
+ GDBusProxy *proxy = get_dbus_proxy();
+ if (!proxy)
+ return 1;
+
+ GVariant *parameters = variant_from_string_list(problem_dir_paths);
+
+ GError *error = NULL;
+ g_dbus_proxy_call_sync(proxy,
+ "DeleteProblem",
+ parameters,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+//g_variant_unref(parameters); -- need this??? no?? why?
+
+ if (error)
+ {
+ error_msg(_("Deleting problem directory failed: %s"), error->message);
+ g_error_free(error);
+ return 1;
+ }
+ return 0;
+}
+
+problem_data_t *get_problem_data_dbus(const char *problem_dir_path)
+{
+ GDBusProxy *proxy = get_dbus_proxy();
+ if (!proxy)
+ return NULL;
+
+ GVariantBuilder *builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
+ g_variant_builder_add(builder, "s", FILENAME_TIME );
+ g_variant_builder_add(builder, "s", FILENAME_REASON );
+ g_variant_builder_add(builder, "s", FILENAME_NOT_REPORTABLE);
+ g_variant_builder_add(builder, "s", FILENAME_COMPONENT );
+ g_variant_builder_add(builder, "s", FILENAME_EXECUTABLE );
+ g_variant_builder_add(builder, "s", FILENAME_REPORTED_TO );
+ GVariant *params = g_variant_new("(sas)", problem_dir_path, builder);
+ g_variant_builder_unref(builder);
+
+ GError *error = NULL;
+ GVariant *result = g_dbus_proxy_call_sync(proxy,
+ "GetInfo",
+ params,
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+
+ if (error)
+ {
+ error_msg(_("Can't get problem data from abrt-dbus: %s"), error->message);
+ g_error_free(error);
+ return NULL;
+ }
+
+ problem_data_t *pd = problem_data_new();
+ char *key, *val;
+ GVariantIter *iter;
+ g_variant_get(result, "(a{ss})", &iter);
+ while (g_variant_iter_loop(iter, "{ss}", &key, &val))
+ {
+ problem_data_add_text_noteditable(pd, key, val);
+ }
+ g_variant_unref(result);
+ return pd;
+}
+
+GList *get_problems_over_dbus(bool authorize)
+{
+ GDBusProxy *proxy = get_dbus_proxy();
+ if (!proxy)
+ return ERR_PTR;
+
+ GError *error = NULL;
+ GVariant *result = g_dbus_proxy_call_sync(proxy,
+ authorize ? "GetAllProblems" : "GetProblems",
+ g_variant_new("()"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL,
+ &error);
+
+ if (error)
+ {
+ error_msg(_("Can't get problem list from abrt-dbus: %s"), error->message);
+ g_error_free(error);
+ return ERR_PTR;
+ }
+
+ GList *list = NULL;
+ if (result)
+ {
+ /* Fetch "as" from "(as)" */
+ GVariant *array = g_variant_get_child_value(result, 0);
+ list = string_list_from_variant(array);
+ g_variant_unref(array);
+ g_variant_unref(result);
+ }
+
+ return list;
+}
--
1.8.1.4
11 years
[FAF PATCH] bugzilla: increase limits for bug creation and update
by Richard Marko
New ticket now requires 100 reports and 200 reports for update
message.
Closes #192.
Signed-off-by: Richard Marko <rmarko(a)redhat.com>
---
bin/faf-bugzilla-create-bugs | 2 +-
bin/faf-bugzilla-update-bugs | 2 +-
pyfaf/bugzilla.py | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/bin/faf-bugzilla-create-bugs b/bin/faf-bugzilla-create-bugs
index 1be2b62..d01a662 100755
--- a/bin/faf-bugzilla-create-bugs
+++ b/bin/faf-bugzilla-create-bugs
@@ -13,7 +13,7 @@ if __name__ == "__main__":
parser.add_argument('--opsys', help='OpSys name', default='Fedora')
parser.add_argument('--version', help='OpSys version')
parser.add_argument('--count', metavar='N', help='Minimal number of'
- ' reports required', default=10)
+ ' reports required', default=100)
parser.add_argument('--dry-run', action='store_true',
help='Do not perform any actions')
diff --git a/bin/faf-bugzilla-update-bugs b/bin/faf-bugzilla-update-bugs
index e6d1d5d..4e25c3e 100755
--- a/bin/faf-bugzilla-update-bugs
+++ b/bin/faf-bugzilla-update-bugs
@@ -15,7 +15,7 @@ if __name__ == '__main__':
parser.add_argument('--opsys', help='OpSys name', default='Fedora')
parser.add_argument('--version', help='OpSys version')
parser.add_argument('--count', metavar='N', help='Minimal number of'
- ' reports required', default=50)
+ ' reports required', default=200)
parser.add_argument('--dry-run', action='store_true',
help='Do not perform any actions')
diff --git a/pyfaf/bugzilla.py b/pyfaf/bugzilla.py
index f9e31d6..612969c 100644
--- a/pyfaf/bugzilla.py
+++ b/pyfaf/bugzilla.py
@@ -979,7 +979,7 @@ class Bugzilla(object):
def query_no_ticket(db, opsys_name, opsys_version=None,
- minimal_reports_threshold=10):
+ minimal_reports_threshold=100):
"""
Return list of problems without bugzilla tickets with
report count over `minimal_reports_threshold`.
@@ -1016,7 +1016,7 @@ def query_no_ticket(db, opsys_name, opsys_version=None,
def query_update_candidates(db, opsys_name, opsys_version=None,
- minimal_reports_threshold=50):
+ minimal_reports_threshold=200):
"""
Return list of problems with bugzilla tickets
which are not CLOSED and have more reports
--
1.8.1.4
11 years
faf bugzilla text and typo
by Jens-Ulrik Petersen
Hi!
The first sentence in bugzilla reports does not read so well:
"""
Faf server *recevied* number of crash reports for this package.
"""
(Does Faf stand for anything?)
Anyway I think something like the following would be better:
"""
The Faf server has received a number of crash reports for this package.
"""
If FAF stands for something intelligible then it would be nice
to include that in the text: "The Fedora Frequent Abrts server has received....".
I can open an issue if that is better.
Thanks, Jens
11 years
[PATCH] abrt-action-ureport: rewrite in python, improve messages
by Denys Vlasenko
1. Before this change, "abrt-cli report DIR", if it found that
it was already reported, was saying:
ABRT Server: URL=https://retrace.fedoraproject.org/faf/reports/8739/
Bugzilla: URL=https://bugzilla.redhat.com/show_bug.cgi?id=688129
This change makes it:
A bug was already filed about this problem:
ABRT Server: URL=https://retrace.fedoraproject.org/faf/reports/8739/
Bugzilla: URL=https://bugzilla.redhat.com/show_bug.cgi?id=688129
2. If "abrt-cli report DIR" found that ureport was sent, but no bugs were filed,
abrt-action-ureport used to die silently. Now it prints one line:
"uReport was already sent, not sending it again".
3. Since now abrt-action-generate-core-backtrace emits its own message,
"Generating core_backtarce" message at verbosity 1 is removed from here.
To support i18n, the script had to be rewritten in python
Signed-off-by: Denys Vlasenko <dvlasenk(a)redhat.com>
---
src/plugins/Makefile.am | 3 +-
src/plugins/abrt-action-ureport | 159 ++++++++++++++++++++++++++--------------
2 files changed, 108 insertions(+), 54 deletions(-)
mode change 100644 => 100755 src/plugins/abrt-action-ureport
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index b249bf1..8b82a38 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -65,7 +65,8 @@ PYTHON_FILES = \
abrt-action-list-dsos \
abrt-action-analyze-core \
abrt-action-analyze-vmcore.in \
- abrt-action-perform-ccpp-analysis.in
+ abrt-action-perform-ccpp-analysis.in \
+ abrt-action-ureport
EXTRA_DIST = \
$(PYTHON_FILES) \
diff --git a/src/plugins/abrt-action-ureport b/src/plugins/abrt-action-ureport
old mode 100644
new mode 100755
index b6ae6a2..578d46a
--- a/src/plugins/abrt-action-ureport
+++ b/src/plugins/abrt-action-ureport
@@ -1,68 +1,121 @@
-#!/bin/sh
+#!/usr/bin/python -u
+# WARNING: python -u means unbuffered I/O. Without it the messages are
+# passed to the parent asynchronously which looks bad in clients.
#
# This script wraps reporter-ureport client and keeps number of sent
# uReports to a server consistent with number of problem ocurrences.
-# $1 a message
-log1()
-{
- test -n "$ABRT_VERBOSE" && test "$ABRT_VERBOSE" -ge 1 && echo "$1" >&2
-}
-
-# $1 a full path fo file
-# $2 a default value
-try_parse_number()
-{
- if test -f $1 && grep -q "^[0-9][0-9]*$" < "$1" && test 0 -eq $(wc -l < $1); then
- cat -- "$1"
- else
- log1 "Not a number in file '$1'"
- printf "%s" "$2"
- fi
-}
+import sys
-#
-# Main
-#
+from report import *
+from reportclient import _, verbose, set_verbosity, error_msg_and_die, error_msg, log1, log
+
+GETTEXT_PROGNAME = "abrt"
+import getopt
+import locale
+import gettext
+_ = lambda x: gettext.lgettext(x)
+def init_gettext():
+ try:
+ locale.setlocale(locale.LC_ALL, "")
+ except locale.Error:
+ os.environ['LC_ALL'] = 'C'
+ locale.setlocale(locale.LC_ALL, "")
+ # Defeat "AttributeError: 'module' object has no attribute 'nl_langinfo'"
+ try:
+ gettext.bind_textdomain_codeset(GETTEXT_PROGNAME, locale.nl_langinfo(locale.CODESET))
+ except AttributeError:
+ pass
+ gettext.bindtextdomain(GETTEXT_PROGNAME, '/usr/share/locale')
+ gettext.textdomain(GETTEXT_PROGNAME)
+
+
+def spawn_and_wait(prog):
+ return os.spawnlp(os.P_WAIT, prog, prog)
+
+def try_parse_number(dd, filename):
+ try:
+ n = dd.load_text(filename)
+ return int(n)
+ except:
+ error_msg(_("Not a number in file '%s'"), filename)
+ return 0
+
+if __name__ == "__main__":
+ # localization
+ init_gettext()
+
+ ABRT_VERBOSE = os.getenv("ABRT_VERBOSE")
+ if (ABRT_VERBOSE):
+ try:
+ verbose = int(ABRT_VERBOSE)
+ except:
+ pass
-1>&2
+ progname = os.path.basename(sys.argv[0])
+ help_text = _("Usage: %s [-v]") % progname
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "vh", ["help"])
+ except getopt.GetoptError, err:
+ error_msg(err) # prints something like "option -a not recognized"
+ error_msg_and_die(help_text)
-UREPORTS=$(try_parse_number "$PWD/ureports_counter" "0")
-COUNT=$(try_parse_number "$PWD/count" "0")
+ for opt, arg in opts:
+ if opt in ("-h", "--help"):
+ print help_text
+ sys.exit(0)
+ elif opt == "-v":
+ verbose += 1
-# Send only if the problem is not yet reported
-# if the count file is corrupted or
-# if the number of ureports is lower then the number of occurrences
-if test 0 -ne "$UREPORTS" && test 0 -ne "$COUNT" && test "$UREPORTS" -ge "$COUNT"; then
- log1 "uReport has been already sent: '$PWD'"
+ set_verbosity(verbose)
- if test -f reported_to; then
- grep -e "^Bugzilla: " -e "^ABRT Server: " < reported_to | sort -u
+ dirname = os.getcwd()
- if grep -q -e "^Bugzilla: " -e "^ABRT Server: " < reported_to; then
- exit 70 # EXIT_STOP_EVENT_RUN
- fi
+ dd = dd_opendir(dirname, 0)
+ if not dd:
+ sys.exit(1)
+ core_backtrace_exists = dd.exist("core_backtrace")
+ reported_to = dd.load_text("reported_to")
+ ureports_counter = try_parse_number(dd, "ureports_counter")
+ count = try_parse_number(dd, "count")
+ dd.close()
- log1 "Bug for '$PWD' not yet filed. Continuing."
- exit 0
- fi
+ # Send only if the problem is not yet reported
+ # if the count file is corrupted or
+ # if the number of ureports is lower then the number of occurrences
+ if ureports_counter != 0 and count != 0 and ureports_counter >= count:
+ log1("uReport has been already sent: '%s'", dirname)
- log1 "uReport was sent but '$PWD/reported_to' doesn't exist. Continuing."
- exit 0
-fi
+ if reported_to and reported_to != "":
+ bugs = set()
+ for line in reported_to.split("\n"):
+ if line.startswith("Bugzilla:") or line.startswith("ABRT Server:"):
+ bugs.add(line)
+ if bugs:
+ log(_("A bug was already filed about this problem:"))
+ bugs = sorted(bugs)
+ for bug in bugs:
+ print bug
+ sys.exit(70) # EXIT_STOP_EVENT_RUN
+ log1("Bug for '%s' not yet filed. Continuing.", dirname)
+ sys.exit(0)
+ else:
+ log1("'%s/reported_to' doesn't exist", dirname)
-if test ! -s core_backtrace; then
- log1 "Generating core_backtrace"
+ log(_("uReport was already sent, not sending it again"))
+ sys.exit(0)
- abrt-action-generate-core-backtrace || {
- log1 "uReport can't be sent without core_backtrace. Exiting."
- exit 1
- }
-fi
+ if not core_backtrace_exists:
+ exitcode = spawn_and_wait("abrt-action-generate-core-backtrace")
+ if exitcode != 0:
+ log1("uReport can't be sent without core_backtrace. Exiting.")
+ sys.exit(1)
-reporter-ureport
-RET_CODE=$?
-if [ $RET_CODE -eq 0 ] || [ $RET_CODE -eq 70 ]; then
- printf "%s" "$((UREPORTS + 1))" > ureports_counter
- exit $RET_CODE
-fi
+ exitcode = spawn_and_wait("reporter-ureport")
+ if exitcode == 0 or exitcode == 70:
+ dd = dd_opendir(".", 0)
+ if not dd:
+ sys.exit(1)
+ dd.save_text("ureports_counter", str(ureports_counter + 1))
+ dd.close()
+ sys.exit(exitcode)
--
1.8.1.4
11 years
[BTPARSER PATCH] Include version string in the man page
by Martin Milata
Fixes rhbz#905854.
Signed-off-by: Martin Milata <mmilata(a)redhat.com>
---
.gitignore | 1 +
Makefile.am | 5 ++++-
Makefile.in | 5 ++++-
btparser.1 | 55 -------------------------------------------------------
btparser.1.in | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
5 files changed, 64 insertions(+), 57 deletions(-)
delete mode 100644 btparser.1
create mode 100644 btparser.1.in
diff --git a/.gitignore b/.gitignore
index cfcfe33..055238f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,6 +4,7 @@
Makefile
autom4te.cache
btparser
+btparser.1
btparser.pc
btparser.spec
*.o
diff --git a/Makefile.am b/Makefile.am
index 9ef0032..f7a0bcf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,7 +8,10 @@ btparser_SOURCES = btparser.c
btparser_LDADD = lib/libbtparser.la
man_MANS = btparser.1
-EXTRA_DIST = $(man_MANS)
+EXTRA_DIST = btparser.1.in
+
+btparser.1: btparser.1.in
+ sed -e "s,\@PACKAGE_STRING\@,$(PACKAGE_STRING),g" $< > $@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = btparser.pc
diff --git a/Makefile.in b/Makefile.in
index c492958..8655737 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -326,7 +326,7 @@ btparser_CFLAGS = -Wall
btparser_SOURCES = btparser.c
btparser_LDADD = lib/libbtparser.la
man_MANS = btparser.1
-EXTRA_DIST = $(man_MANS) btparser.pc.in autogen.sh RELEASE \
+EXTRA_DIST = btparser.1.in btparser.pc.in autogen.sh RELEASE \
btparser.spec.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = btparser.pc
@@ -1016,6 +1016,9 @@ uninstall-man: uninstall-man1
uninstall-binPROGRAMS uninstall-man uninstall-man1 \
uninstall-pkgconfigDATA
+
+btparser.1: btparser.1.in
+ sed -e "s,\@PACKAGE_STRING\@,$(PACKAGE_STRING),g" $< > $@
.PHONY: upload
upload:
make dist-gzip
diff --git a/btparser.1 b/btparser.1
deleted file mode 100644
index eee2fef..0000000
--- a/btparser.1
+++ /dev/null
@@ -1,55 +0,0 @@
-.TH btparser "1" "24 May 2010" ""
-.SH NAME
-btparser \- a backtrace analyzer
-.SH SYNOPSIS
-.B btparser
-[option]... [FILE]...
-.SH DESCRIPTION
-.I btparser
-is a command line tool that analyzes backtraces produced by
-GDB and provides their textual representation useful for
-crash duplication detection.
-
-By default, btparser prints the backtrace tree created by
-parsing the input file.
-
-.SH OPTIONS
-.B Basic startup options
-.IP "\-V, \-\-version"
-Displays version of btparser.
-.IP "\-?, \-\-help"
-Print a help message describing all of btparser’s command-line options.
-
-.PP
-.B Actions
-.IP "\-r, \-\-rate"
-Print a float number between 0 and 1, representing the quality of the
-backtrace.
-.IP "\-c, \-\-crash\-function"
-Print the name of the function where the program crashed, if it's
-successfully detected.
-.IP "\-h, \-\-duplicate\-hash"
-Print a short, textual representation of the backtrace, useful for
-detecting the backtrace duplicates.
-.IP "\-s, \-\-distances"
-Print Damerau–Levenshtein distances between the backtraces specified on the command
-line.
-.IP "\-g, \-\-dendrogram"
-Cluster backtraces by their distance and print an ASCII representation of the
-dendrogram.
-.IP "\-l, \-\-clusters=LEVEL"
-Print clusters cut from the dendrogram at the specified level.
-
-.PP
-.B Additional options
-.IP "\-i, \-\-stdin"
-Read input from the standard input rather than file.
-.IP "\-m, \-\-max\-frames=FRAMES"
-When creating optimized backtrace or preparing backtrace for comparison, limit
-the number of frames to FRAMES. (default 8)
-.IP "\-z, \-\-min\-cluster\-size=SIZE"
-When printing clusters, ignore clusters that contain fewer than SIZE objects. (default 2)
-.IP "\-d, \-\-debug"
-Prints debug information when scanning/parsing the backtrace.
-.IP "\-v, \-\-verbose"
-Print more output than usual.
diff --git a/btparser.1.in b/btparser.1.in
new file mode 100644
index 0000000..036b9f2
--- /dev/null
+++ b/btparser.1.in
@@ -0,0 +1,55 @@
+.TH btparser "1" "24 May 2010" "@PACKAGE_STRING@"
+.SH NAME
+btparser \- a backtrace analyzer
+.SH SYNOPSIS
+.B btparser
+[option]... [FILE]...
+.SH DESCRIPTION
+.I btparser
+is a command line tool that analyzes backtraces produced by
+GDB and provides their textual representation useful for
+crash duplication detection.
+
+By default, btparser prints the backtrace tree created by
+parsing the input file.
+
+.SH OPTIONS
+.B Basic startup options
+.IP "\-V, \-\-version"
+Displays version of btparser.
+.IP "\-?, \-\-help"
+Print a help message describing all of btparser’s command-line options.
+
+.PP
+.B Actions
+.IP "\-r, \-\-rate"
+Print a float number between 0 and 1, representing the quality of the
+backtrace.
+.IP "\-c, \-\-crash\-function"
+Print the name of the function where the program crashed, if it's
+successfully detected.
+.IP "\-h, \-\-duplicate\-hash"
+Print a short, textual representation of the backtrace, useful for
+detecting the backtrace duplicates.
+.IP "\-s, \-\-distances"
+Print Damerau–Levenshtein distances between the backtraces specified on the command
+line.
+.IP "\-g, \-\-dendrogram"
+Cluster backtraces by their distance and print an ASCII representation of the
+dendrogram.
+.IP "\-l, \-\-clusters=LEVEL"
+Print clusters cut from the dendrogram at the specified level.
+
+.PP
+.B Additional options
+.IP "\-i, \-\-stdin"
+Read input from the standard input rather than file.
+.IP "\-m, \-\-max\-frames=FRAMES"
+When creating optimized backtrace or preparing backtrace for comparison, limit
+the number of frames to FRAMES. (default 8)
+.IP "\-z, \-\-min\-cluster\-size=SIZE"
+When printing clusters, ignore clusters that contain fewer than SIZE objects. (default 2)
+.IP "\-d, \-\-debug"
+Prints debug information when scanning/parsing the backtrace.
+.IP "\-v, \-\-verbose"
+Print more output than usual.
--
1.7.11.7
11 years
[SATYR PATCH] Include version string in the man page
by Martin Milata
Related to rhbz#905854.
Signed-off-by: Martin Milata <mmilata(a)redhat.com>
---
.gitignore | 1 +
Makefile.am | 5 ++++-
satyr.1 | 29 -----------------------------
satyr.1.in | 29 +++++++++++++++++++++++++++++
4 files changed, 34 insertions(+), 30 deletions(-)
delete mode 100644 satyr.1
create mode 100644 satyr.1.in
diff --git a/.gitignore b/.gitignore
index adb0ae9..ae69aa9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,6 +6,7 @@ Makefile
Makefile.in
ar-lib
compile
+satyr.1
/autom4te.cache
/satyr
diff --git a/Makefile.am b/Makefile.am
index 11aaf9b..8ee051c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,7 +10,10 @@ satyr_SOURCES = satyr.c
satyr_LDADD = lib/libsatyr.la
man_MANS = satyr.1
-EXTRA_DIST = $(man_MANS)
+EXTRA_DIST = satyr.1.in
+
+satyr.1: satyr.1.in
+ sed -e "s,\@PACKAGE_STRING\@,$(PACKAGE_STRING),g" $< > $@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = satyr.pc
diff --git a/satyr.1 b/satyr.1
deleted file mode 100644
index b64c33d..0000000
--- a/satyr.1
+++ /dev/null
@@ -1,29 +0,0 @@
-.TH SATYR "1" "2013-03-18" ""
-.SH NAME
-satyr \- create and manipulate problem reports
-.SH SYNOPSIS
-.B satyr
-<command> [option...]
-.SH DESCRIPTION
-.I satyr
-is a command line tool that creates anonymous reports of software problems that
-are suitable for automated processing.
-
-The tool has to be invoked with a
-.I <command>
-that specifies the action to be performed. The available commands are
-documented below.
-
-.SH OPTIONS
-.B Commands
-.IP "abrt\-print\-report\-from\-dir <directory>"
-
-Creates report from ABRT problem directory
-.I directory
-and prints it to standard output.
-
-.IP "abrt\-create\-core\-stacktrace <directory>"
-
-Creates stacktrace from ABRT problem directory
-.I directory
-that contains a core dump.
diff --git a/satyr.1.in b/satyr.1.in
new file mode 100644
index 0000000..00d7178
--- /dev/null
+++ b/satyr.1.in
@@ -0,0 +1,29 @@
+.TH SATYR "1" "2013-03-18" "@PACKAGE_STRING@"
+.SH NAME
+satyr \- create and manipulate problem reports
+.SH SYNOPSIS
+.B satyr
+<command> [option...]
+.SH DESCRIPTION
+.I satyr
+is a command line tool that creates anonymous reports of software problems that
+are suitable for automated processing.
+
+The tool has to be invoked with a
+.I <command>
+that specifies the action to be performed. The available commands are
+documented below.
+
+.SH OPTIONS
+.B Commands
+.IP "abrt\-print\-report\-from\-dir <directory>"
+
+Creates report from ABRT problem directory
+.I directory
+and prints it to standard output.
+
+.IP "abrt\-create\-core\-stacktrace <directory>"
+
+Creates stacktrace from ABRT problem directory
+.I directory
+that contains a core dump.
--
1.7.11.7
11 years
[SATYR PATCH] Get rid of uintptr_t usage
by Martin Milata
Using uintptr_t might pose a problem when processing data from 64-bit
machine on a 32-bit machine.
Related to rhbz#951506.
Signed-off-by: Martin Milata <mmilata(a)redhat.com>
---
lib/disasm.c | 5 +++--
lib/elves.c | 7 ++++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/lib/disasm.c b/lib/disasm.c
index 9df9cd9..c47a58c 100644
--- a/lib/disasm.c
+++ b/lib/disasm.c
@@ -24,6 +24,7 @@
#include "strbuf.h"
#include <string.h>
#include <stdio.h>
+#include <inttypes.h>
#if HAVE_LIBOPCODES
#include <bfd.h>
@@ -269,8 +270,8 @@ sr_disasm_instruction_parse_single_address_operand(char *instruction,
/* Parse the address. */
int chars_read;
- uintptr_t addr;
- int ret = sscanf(p, "%jx %n", &addr, &chars_read);
+ uint64_t addr;
+ int ret = sscanf(p, "%"SCNx64" %n", &addr, &chars_read);
if (ret < 1)
return false;
diff --git a/lib/elves.c b/lib/elves.c
index bf844d6..a4f1957 100644
--- a/lib/elves.c
+++ b/lib/elves.c
@@ -35,6 +35,7 @@
#include <libelf.h>
#include <string.h>
#include <unistd.h>
+#include <inttypes.h>
/**
* Finds a section by its name in an ELF file.
@@ -166,7 +167,7 @@ sr_elf_get_procedure_linkage_table(const char *filename,
/* Find the relocation section for .plt (typically .rela.plt), together
* with its symbol and string table
*/
- uintptr_t plt_base = shdr.sh_addr;
+ uint64_t plt_base = shdr.sh_addr;
Elf_Data *rela_plt_data = NULL;
Elf_Data *plt_symbols = NULL;
size_t stringtable = 0;
@@ -477,7 +478,7 @@ read_cie(Dwarf_CFI_Entry *cfi,
* Assumption: we'll always run on architecture the ELF is run on,
* therefore we don't consider byte order.
*/
-static uintptr_t
+static uint64_t
fde_read_address(const uint8_t *p, unsigned len)
{
int i;
@@ -491,7 +492,7 @@ fde_read_address(const uint8_t *p, unsigned len)
for (i = 0; i < len; i++)
u.b[i] = *p++;
- return (len == 4 ? (uintptr_t)u.n4 : (uintptr_t)u.n8);
+ return (len == 4 ? (uint64_t)u.n4 : u.n8);
}
#endif /* WITH_ELFUTILS */
--
1.7.11.7
11 years
[LIBREPORT PATCH 1/7] refactorize: map_string_t clean up
by Jakub Filak
libreport hides GHashTable behind map_string_t and adds some utility
functions using map_string_t type. Programmer should use map_string_t
instead of GHashTable but libreport calls some GHashTable functions
directly. This patch adds wrappers for GHashTable functions and makes
libreport using them.
Related to #147
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
libreport.spec.in | 1 +
src/include/Makefile.am | 1 +
src/include/internal_libreport.h | 22 ++----------
src/include/libreport_types.h | 70 +++++++++++++++++++++++++++++++++++++++
src/include/problem_data.h | 2 +-
src/lib/abrt_types.c | 6 ++--
src/lib/event_config.c | 12 +++----
src/lib/load_plugin_settings.c | 4 +--
src/lib/user_settings.c | 11 +++---
src/plugins/reporter-bugzilla.c | 4 +--
src/plugins/reporter-kerneloops.c | 4 +--
src/plugins/reporter-mailx.c | 4 +--
src/plugins/reporter-rhtsupport.c | 4 +--
src/plugins/reporter-upload.c | 6 ++--
14 files changed, 104 insertions(+), 47 deletions(-)
create mode 100644 src/include/libreport_types.h
diff --git a/libreport.spec.in b/libreport.spec.in
index 76e0d5f..b86ccf9 100644
--- a/libreport.spec.in
+++ b/libreport.spec.in
@@ -332,6 +332,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%defattr(-,root,root,-)
# Public api headers:
%doc apidoc/html/*
+%{_includedir}/libreport/libreport_types.h
%{_includedir}/libreport/client.h
%{_includedir}/libreport/dump_dir.h
%{_includedir}/libreport/event_config.h
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 31c0738..806b93e 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -1,5 +1,6 @@
libreport_includedir = $(includedir)/libreport
libreport_include_HEADERS = \
+ libreport_types.h \
client.h \
dump_dir.h \
event_config.h \
diff --git a/src/include/internal_libreport.h b/src/include/internal_libreport.h
index b7c354d..177ce15 100644
--- a/src/include/internal_libreport.h
+++ b/src/include/internal_libreport.h
@@ -53,7 +53,6 @@
#endif
#include <pwd.h>
#include <grp.h>
-#include <glib.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -95,6 +94,7 @@ int vdprintf(int d, const char *format, va_list ap);
#include "run_event.h"
#include "workflow.h"
#include "file_obj.h"
+#include "libreport_types.h"
#ifdef __cplusplus
extern "C" {
@@ -567,22 +567,6 @@ struct strbuf *strbuf_prepend_strf(struct strbuf *strbuf,
struct strbuf *strbuf_prepend_strfv(struct strbuf *strbuf,
const char *format, va_list p);
-
-/* TODO: rename to map_string_t */
-typedef GHashTable map_string_h;
-#define new_map_string libreport_new_map_string
-map_string_h *new_map_string(void);
-#define free_map_string libreport_free_map_string
-void free_map_string(map_string_h *ms);
-#define get_map_string_item_or_empty libreport_get_map_string_item_or_empty
-const char *get_map_string_item_or_empty(map_string_h *ms, const char *key);
-static inline
-const char *get_map_string_item_or_NULL(map_string_h *ms, const char *key)
-{
- return (const char*)g_hash_table_lookup(ms, key);
-}
-
-
/* Returns command line of running program.
* Caller is responsible to free() the returned value.
* If the pid is not valid or command line can not be obtained,
@@ -636,10 +620,10 @@ void parse_release_for_rhts(const char *pRelease, char **product, char **version
* @return if it success it returns true, otherwise it returns false.
*/
#define load_conf_file libreport_load_conf_file
-bool load_conf_file(const char *pPath, map_string_h *settings, bool skipKeysWithoutValue);
+bool load_conf_file(const char *pPath, map_string_t *settings, bool skipKeysWithoutValue);
#define save_conf_file libreport_save_conf_file
-bool save_conf_file(const char *path, map_string_h *settings);
+bool save_conf_file(const char *path, map_string_t *settings);
#define save_user_settings libreport_save_user_settings
bool save_user_settings();
#define load_user_settings libreport_load_user_settings
diff --git a/src/include/libreport_types.h b/src/include/libreport_types.h
new file mode 100644
index 0000000..23174a1
--- /dev/null
+++ b/src/include/libreport_types.h
@@ -0,0 +1,70 @@
+/*
+ Copyright (C) 2013 ABRT team
+ Copyright (C) 2013 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.
+*/
+#ifndef LIBREPORT_TYPES_H_
+#define LIBREPORT_TYPES_H_
+
+#include <glib.h>
+
+typedef GHashTable map_string_t;
+#define new_map_string libreport_new_map_string
+map_string_t *new_map_string(void);
+#define free_map_string libreport_free_map_string
+void free_map_string(map_string_t *ms);
+#define insert_map_string_item libreport_insert_map_string_item
+static inline
+void insert_map_string(map_string_t *ms, char *key, char *value)
+{
+ g_hash_table_insert(ms, key, value);
+}
+#define replace_map_string_item libreport_replace_map_string_item
+static inline
+void replace_map_string_item(map_string_t *ms, char *key, char *value)
+{
+ g_hash_table_replace(ms, key, value);
+}
+#define remove_map_string_item libreport_remove_map_string_item
+static inline
+void remove_map_string_item(map_string_t *ms, const char *key)
+{
+ g_hash_table_remove(ms, key);
+}
+#define get_map_string_item_or_empty libreport_get_map_string_item_or_empty
+const char *get_map_string_item_or_empty(map_string_t *ms, const char *key);
+#define get_map_string_item_or_NULL libreport_get_map_string_item_or_NULL
+static inline
+const char *get_map_string_item_or_NULL(map_string_t *ms, const char *key)
+{
+ return (const char*)g_hash_table_lookup(ms, key);
+}
+
+typedef GHashTableIter map_string_iter_t;
+#define init_map_string_iter libreport_init_map_string_iter
+static inline
+void init_map_string_iter(map_string_iter_t *iter, map_string_t *ms)
+{
+ g_hash_table_iter_init(iter, ms);
+}
+#define next_map_string_iter libreport_next_map_string_iter
+static inline
+int next_map_string_iter(map_string_iter_t *iter, const char **key, const char **value)
+{
+ return g_hash_table_iter_next(iter, (gpointer *)key, (gpointer *)value);
+}
+
+#endif /* LIBREPORT_TYPES_H_ */
diff --git a/src/include/problem_data.h b/src/include/problem_data.h
index 80c8b9a..9038dc9 100644
--- a/src/include/problem_data.h
+++ b/src/include/problem_data.h
@@ -22,7 +22,7 @@
#ifndef LIBREPORT_PROBLEM_DATA_H_
#define LIBREPORT_PROBLEM_DATA_H_
-#include <glib.h>
+#include "libreport_types.h"
#ifdef __cplusplus
extern "C" {
diff --git a/src/lib/abrt_types.c b/src/lib/abrt_types.c
index 8dc4e36..a255af6 100644
--- a/src/lib/abrt_types.c
+++ b/src/lib/abrt_types.c
@@ -18,18 +18,18 @@
*/
#include "internal_libreport.h"
-map_string_h *new_map_string(void)
+map_string_t *new_map_string(void)
{
return g_hash_table_new_full(g_str_hash, g_str_equal, free, free);
}
-void free_map_string(map_string_h *ms)
+void free_map_string(map_string_t *ms)
{
if (ms)
g_hash_table_destroy(ms);
}
-const char *get_map_string_item_or_empty(map_string_h *ms, const char *key)
+const char *get_map_string_item_or_empty(map_string_t *ms, const char *key)
{
const char *v = (const char*)g_hash_table_lookup(ms, key);
if (!v) v = "";
diff --git a/src/lib/event_config.c b/src/lib/event_config.c
index 2f140a4..5418394 100644
--- a/src/lib/event_config.c
+++ b/src/lib/event_config.c
@@ -149,16 +149,16 @@ static void load_config_files(const char *dir_path)
if (new_config)
event_config = new_event_config(filename);
- map_string_h *keys_and_values = new_map_string();
+ map_string_t *keys_and_values = new_map_string();
load_conf_file(fullpath, keys_and_values, /*skipKeysWithoutValue:*/ false);
/* Insert or replace every key/value from keys_and_values to event_config->option */
- GHashTableIter iter;
- char *name;
- char *value;
- g_hash_table_iter_init(&iter, keys_and_values);
- while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value))
+ map_string_iter_t iter;
+ const char *name;
+ const char *value;
+ init_map_string_iter(&iter, keys_and_values);
+ while (next_map_string_iter(&iter, &name, &value))
{
event_option_t *opt;
GList *elem = g_list_find_custom(event_config->options, name,
diff --git a/src/lib/load_plugin_settings.c b/src/lib/load_plugin_settings.c
index acd3f07..84ebd63 100644
--- a/src/lib/load_plugin_settings.c
+++ b/src/lib/load_plugin_settings.c
@@ -21,7 +21,7 @@
/* Returns false if open failed, else returns true.
* TODO: better error detection?
*/
-bool load_conf_file(const char *path, map_string_h *settings, bool skipKeysWithoutValue)
+bool load_conf_file(const char *path, map_string_t *settings, bool skipKeysWithoutValue)
{
FILE *fp = stdin;
if (strcmp(path, "-") != 0)
@@ -93,7 +93,7 @@ bool load_conf_file(const char *path, map_string_h *settings, bool skipKeysWitho
if (in_quote)
goto free_line;
- g_hash_table_replace(settings, xstrdup(line), xstrdup(value));
+ replace_map_string_item(settings, xstrdup(line), xstrdup(value));
free_line:
free(line);
}
diff --git a/src/lib/user_settings.c b/src/lib/user_settings.c
index 1305d5e..58c19af 100644
--- a/src/lib/user_settings.c
+++ b/src/lib/user_settings.c
@@ -33,12 +33,13 @@ static bool create_parentdir(char *path)
}
/* Returns false if write failed */
-bool save_conf_file(const char *path, map_string_h *settings)
+bool save_conf_file(const char *path, map_string_t *settings)
{
bool ret;
FILE *out;
- char *temp_path, *name, *value;
- GHashTableIter iter;
+ char *temp_path;
+ const char *name, *value;
+ map_string_iter_t iter;
ret = false;
@@ -51,8 +52,8 @@ bool save_conf_file(const char *path, map_string_h *settings)
if (!out)
goto cleanup;
- g_hash_table_iter_init(&iter, settings);
- while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value))
+ init_map_string_iter(&iter, settings);
+ while (next_map_string_iter(&iter, &name, &value))
fprintf(out, "%s = \"%s\"\n", name, value);
fclose(out);
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index 3c07216..602038e 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -707,7 +707,7 @@ struct bugzilla_struct {
int b_ssl_verify;
};
-static void set_settings(struct bugzilla_struct *b, map_string_h *settings)
+static void set_settings(struct bugzilla_struct *b, map_string_t *settings)
{
const char *environ;
@@ -913,7 +913,7 @@ int main(int argc, char **argv)
export_abrt_envvars(0);
- map_string_h *settings = new_map_string();
+ map_string_t *settings = new_map_string();
struct bugzilla_struct rhbz = { 0 };
{
if (!conf_file)
diff --git a/src/plugins/reporter-kerneloops.c b/src/plugins/reporter-kerneloops.c
index e72fcd9..a158eb9 100644
--- a/src/plugins/reporter-kerneloops.c
+++ b/src/plugins/reporter-kerneloops.c
@@ -87,7 +87,7 @@ static CURLcode http_post_to_kerneloops_site(const char *url, const char *oopsda
static void report_to_kerneloops(
const char *dump_dir_name,
- map_string_h *settings)
+ map_string_t *settings)
{
problem_data_t *problem_data = create_problem_data_for_reporting(dump_dir_name);
if (!problem_data)
@@ -138,7 +138,7 @@ int main(int argc, char **argv)
textdomain(PACKAGE);
#endif
- map_string_h *settings = new_map_string();
+ map_string_t *settings = new_map_string();
const char *dump_dir_name = ".";
GList *conf_file = NULL;
diff --git a/src/plugins/reporter-mailx.c b/src/plugins/reporter-mailx.c
index 7c9167b..17d65ae 100644
--- a/src/plugins/reporter-mailx.c
+++ b/src/plugins/reporter-mailx.c
@@ -55,7 +55,7 @@ static char** append_str_to_vector(char **vec, unsigned *size_p, const char *str
static void create_and_send_email(
const char *dump_dir_name,
- map_string_h *settings,
+ map_string_t *settings,
bool notify_only)
{
problem_data_t *problem_data = create_problem_data_for_reporting(dump_dir_name);
@@ -179,7 +179,7 @@ int main(int argc, char **argv)
export_abrt_envvars(0);
- map_string_h *settings = new_map_string();
+ map_string_t *settings = new_map_string();
load_conf_file(conf_file, settings, /*skip key w/o values:*/ false);
create_and_send_email(dump_dir_name, settings, /*notify_only*/(opts & OPT_n));
diff --git a/src/plugins/reporter-rhtsupport.c b/src/plugins/reporter-rhtsupport.c
index 90e88ed..abdcdd4 100644
--- a/src/plugins/reporter-rhtsupport.c
+++ b/src/plugins/reporter-rhtsupport.c
@@ -164,7 +164,7 @@ int create_tarball(const char *tempfile, problem_data_t *problem_data)
}
static
-char *get_param_string(const char *name, map_string_h *settings, const char *dflt)
+char *get_param_string(const char *name, map_string_t *settings, const char *dflt)
{
char *envname = xasprintf("RHTSupport_%s", name);
const char *envvar = getenv(envname);
@@ -232,7 +232,7 @@ int main(int argc, char **argv)
export_abrt_envvars(0);
/* Parse config, extract necessary params */
- map_string_h *settings = new_map_string();
+ map_string_t *settings = new_map_string();
if (!conf_file)
conf_file = g_list_append(conf_file, (char*) CONF_DIR"/plugins/rhtsupport.conf");
while (conf_file)
diff --git a/src/plugins/reporter-upload.c b/src/plugins/reporter-upload.c
index a527431..bde573e 100644
--- a/src/plugins/reporter-upload.c
+++ b/src/plugins/reporter-upload.c
@@ -22,7 +22,7 @@
static int create_and_upload_archive(
const char *dump_dir_name,
- map_string_h *settings)
+ map_string_t *settings)
{
int result = 1; /* error */
@@ -217,9 +217,9 @@ int main(int argc, char **argv)
export_abrt_envvars(0);
- map_string_h *settings = new_map_string();
+ map_string_t *settings = new_map_string();
if (url)
- g_hash_table_replace(settings, xstrdup("URL"), xstrdup(url));
+ replace_map_string_item(settings, xstrdup("URL"), xstrdup(url));
if (conf_file)
load_conf_file(conf_file, settings, /*skip key w/o values:*/ false);
--
1.8.1.4
11 years