doczkal / rpms / abrt

Forked from rpms/abrt 4 years ago
Clone

Blame SOURCES/0044-localization-fixes.patch

a60cd7
From 40823feb83cc2a7ad7aac8fb0da1ff7c0773eb2a Mon Sep 17 00:00:00 2001
a60cd7
From: Jakub Filak <jfilak@redhat.com>
a60cd7
Date: Mon, 14 Jul 2014 16:06:17 +0200
a60cd7
Subject: [ABRT PATCH 44/66] localization fixes
a60cd7
a60cd7
commit fc0f32d878bb93e7498340224281fa526b4aeaf7
a60cd7
Author: Jakub Filak <jfilak@redhat.com>
a60cd7
Date:   Wed Apr 16 12:03:31 2014 +0200
a60cd7
a60cd7
    localization: fix gettext
a60cd7
a60cd7
    https://www.gnu.org/software/gettext/manual/html_node/Libraries.html
a60cd7
a60cd7
commit f8533576b349f346acafdc7c0182a995a569a443
a60cd7
Author: Jakub Filak <jfilak@redhat.com>
a60cd7
Date:   Wed Apr 16 21:08:29 2014 +0200
a60cd7
a60cd7
    do not clear LANG env variable
a60cd7
    abrt-action-install-debuginfo-to-abrt-cache
a60cd7
a60cd7
commit d05e231eaf05dc6680be031741d1d7593445f70d
a60cd7
Author: Jakub Filak <jfilak@redhat.com>
a60cd7
Date:   Wed Apr 16 21:13:44 2014 +0200
a60cd7
a60cd7
    a-a-a-core: fix localization
a60cd7
a60cd7
    The strings of that file are not translated at all because
a60cd7
    the file was not included in POTFILES.in
a60cd7
a60cd7
Resolves rhbz#1087880
a60cd7
a60cd7
Signed-off-by: Jakub Filak <jfilak@redhat.com>
a60cd7
---
a60cd7
 po/POTFILES.in                                     |   1 +
a60cd7
 src/configuration-gui/system-config-abrt.c         |   4 +-
a60cd7
 src/include/Makefile.am                            |   3 +
a60cd7
 src/include/internal_libabrt.h                     |  50 ++++++
a60cd7
 src/include/libabrt.h                              |  15 --
a60cd7
 src/lib/Makefile.am                                |   3 +
a60cd7
 src/lib/hooklib.c                                  |   4 +-
a60cd7
 src/lib/ignored_problems.c                         |   4 +-
a60cd7
 src/lib/libabrt_init.c                             |  28 ++++
a60cd7
 src/lib/problem_api_dbus.c                         |  10 +-
a60cd7
 src/plugins/Makefile.am                            |   8 +-
a60cd7
 src/plugins/abrt-action-analyze-core               | 186 ---------------------
a60cd7
 src/plugins/abrt-action-analyze-core.in            | 186 +++++++++++++++++++++
a60cd7
 .../abrt-action-install-debuginfo-to-abrt-cache.c  |   3 +-
a60cd7
 14 files changed, 298 insertions(+), 207 deletions(-)
a60cd7
 create mode 100644 src/include/internal_libabrt.h
a60cd7
 create mode 100644 src/lib/libabrt_init.c
a60cd7
 delete mode 100644 src/plugins/abrt-action-analyze-core
a60cd7
 create mode 100644 src/plugins/abrt-action-analyze-core.in
a60cd7
a60cd7
diff --git a/po/POTFILES.in b/po/POTFILES.in
a60cd7
index 2c36802..ff9b97a 100644
a60cd7
--- a/po/POTFILES.in
a60cd7
+++ b/po/POTFILES.in
a60cd7
@@ -21,6 +21,7 @@ src/lib/problem_api_dbus.c
a60cd7
 src/lib/ignored_problems.c
a60cd7
 src/plugins/abrt-action-analyze-backtrace.c
a60cd7
 src/plugins/abrt-action-analyze-c.c
a60cd7
+src/plugins/abrt-action-analyze-core.in
a60cd7
 src/plugins/abrt-action-analyze-oops.c
a60cd7
 src/plugins/abrt-action-analyze-xorg.c
a60cd7
 src/plugins/abrt-action-analyze-python.c
a60cd7
diff --git a/src/configuration-gui/system-config-abrt.c b/src/configuration-gui/system-config-abrt.c
a60cd7
index b15a5ef..bd9f13f 100644
a60cd7
--- a/src/configuration-gui/system-config-abrt.c
a60cd7
+++ b/src/configuration-gui/system-config-abrt.c
a60cd7
@@ -18,7 +18,7 @@
a60cd7
 #include "system-config-abrt.h"
a60cd7
 #include "abrt-config-widget.h"
a60cd7
 
a60cd7
-#include <libabrt.h>
a60cd7
+#include "internal_libabrt.h"
a60cd7
 
a60cd7
 #define CLOSE_BUTTON_DATA_NAME_CALLBACK "my-close-callback"
a60cd7
 #define CLOSE_BUTTON_DATA_NAME_USER_DATA "my-close-user-data"
a60cd7
@@ -105,6 +105,8 @@ system_config_abrt_dialog_delete_event(GtkWidget *dialog, GdkEvent *event, gpoin
a60cd7
 
a60cd7
 void show_system_config_abrt_dialog(GtkWindow *parent)
a60cd7
 {
a60cd7
+    INITIALIZE_LIBABRT();
a60cd7
+
a60cd7
     GtkWidget *dialog = gtk_dialog_new();
a60cd7
 
a60cd7
     gtk_window_set_title(GTK_WINDOW(dialog), _("Problem Reporting Configuration"));
a60cd7
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
a60cd7
index 49a6f5c..c1952cb 100644
a60cd7
--- a/src/include/Makefile.am
a60cd7
+++ b/src/include/Makefile.am
a60cd7
@@ -6,3 +6,6 @@ libabrt_include_HEADERS = \
a60cd7
     abrt-dbus.h \
a60cd7
     hooklib.h \
a60cd7
     problem_api.h
a60cd7
+
a60cd7
+EXTRA_DIST = \
a60cd7
+    internal_libabrt.h
a60cd7
diff --git a/src/include/internal_libabrt.h b/src/include/internal_libabrt.h
a60cd7
new file mode 100644
a60cd7
index 0000000..3ad22fc
a60cd7
--- /dev/null
a60cd7
+++ b/src/include/internal_libabrt.h
a60cd7
@@ -0,0 +1,50 @@
a60cd7
+/*
a60cd7
+    Copyright (C) 2014  ABRT team
a60cd7
+    Copyright (C) 2014  RedHat Inc
a60cd7
+
a60cd7
+    This program is free software; you can redistribute it and/or modify
a60cd7
+    it under the terms of the GNU General Public License as published by
a60cd7
+    the Free Software Foundation; either version 2 of the License, or
a60cd7
+    (at your option) any later version.
a60cd7
+
a60cd7
+    This program is distributed in the hope that it will be useful,
a60cd7
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
a60cd7
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a60cd7
+    GNU General Public License for more details.
a60cd7
+
a60cd7
+    You should have received a copy of the GNU General Public License along
a60cd7
+    with this program; if not, write to the Free Software Foundation, Inc.,
a60cd7
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
a60cd7
+*/
a60cd7
+
a60cd7
+#include "libabrt.h"
a60cd7
+
a60cd7
+#ifdef HAVE_CONFIG_H
a60cd7
+# include "config.h"
a60cd7
+#endif
a60cd7
+
a60cd7
+#undef NORETURN
a60cd7
+#define NORETURN __attribute__ ((noreturn))
a60cd7
+
a60cd7
+/* Must be after #include "config.h" */
a60cd7
+#if ENABLE_NLS
a60cd7
+# include <libintl.h>
a60cd7
+# define _(S) dgettext(PACKAGE, S)
a60cd7
+#else
a60cd7
+# define _(S) (S)
a60cd7
+#endif
a60cd7
+
a60cd7
+extern int g_libabrt_inited;
a60cd7
+void libabrt_init(void);
a60cd7
+
a60cd7
+#define INITIALIZE_LIBABRT() \
a60cd7
+    do \
a60cd7
+    { \
a60cd7
+        if (!g_libabrt_inited) \
a60cd7
+        { \
a60cd7
+            g_libabrt_inited = 1; \
a60cd7
+            libabrt_init(); \
a60cd7
+        } \
a60cd7
+    } \
a60cd7
+    while (0)
a60cd7
+
a60cd7
diff --git a/src/include/libabrt.h b/src/include/libabrt.h
a60cd7
index d5911e7..3e42a09 100644
a60cd7
--- a/src/include/libabrt.h
a60cd7
+++ b/src/include/libabrt.h
a60cd7
@@ -15,21 +15,6 @@
a60cd7
 #include <libreport/internal_libreport.h>
a60cd7
 #include "hooklib.h"
a60cd7
 
a60cd7
-#ifdef HAVE_CONFIG_H
a60cd7
-# include "config.h"
a60cd7
-#endif
a60cd7
-
a60cd7
-/* Must be after #include "config.h" */
a60cd7
-#if ENABLE_NLS
a60cd7
-# include <libintl.h>
a60cd7
-# define _(S) gettext(S)
a60cd7
-#else
a60cd7
-# define _(S) (S)
a60cd7
-#endif
a60cd7
-
a60cd7
-#undef NORETURN
a60cd7
-#define NORETURN __attribute__ ((noreturn))
a60cd7
-
a60cd7
 #undef ARRAY_SIZE
a60cd7
 #define ARRAY_SIZE(x) ((unsigned)(sizeof(x) / sizeof((x)[0])))
a60cd7
 
a60cd7
diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am
a60cd7
index 5c281d2..32a054a 100644
a60cd7
--- a/src/lib/Makefile.am
a60cd7
+++ b/src/lib/Makefile.am
a60cd7
@@ -5,6 +5,7 @@ lib_LTLIBRARIES = \
a60cd7
     libabrt.la
a60cd7
 
a60cd7
 libabrt_la_SOURCES = \
a60cd7
+    libabrt_init.c \
a60cd7
     abrt_conf.c \
a60cd7
     hooklib.c \
a60cd7
     daemon_is_ok.c \
a60cd7
@@ -40,3 +41,5 @@ libabrt_la_LIBADD = \
a60cd7
     $(GIO_LIBS) \
a60cd7
     $(LIBREPORT_LIBS) \
a60cd7
     $(SATYR_LIBS)
a60cd7
+
a60cd7
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
a60cd7
diff --git a/src/lib/hooklib.c b/src/lib/hooklib.c
a60cd7
index 23447df..4a50727 100644
a60cd7
--- a/src/lib/hooklib.c
a60cd7
+++ b/src/lib/hooklib.c
a60cd7
@@ -16,7 +16,7 @@
a60cd7
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
a60cd7
 */
a60cd7
 #include <sys/statvfs.h>
a60cd7
-#include "libabrt.h"
a60cd7
+#include "internal_libabrt.h"
a60cd7
 
a60cd7
 int low_free_space(unsigned setting_MaxCrashReportsSize, const char *dump_location)
a60cd7
 {
a60cd7
@@ -241,6 +241,8 @@ char *run_unstrip_n(const char *dump_dir_name, unsigned timeout_sec)
a60cd7
 
a60cd7
 char *get_backtrace(const char *dump_dir_name, unsigned timeout_sec, const char *debuginfo_dirs)
a60cd7
 {
a60cd7
+    INITIALIZE_LIBABRT();
a60cd7
+
a60cd7
     struct dump_dir *dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
a60cd7
     if (!dd)
a60cd7
         return NULL;
a60cd7
diff --git a/src/lib/ignored_problems.c b/src/lib/ignored_problems.c
a60cd7
index df138d8..7779c4c 100644
a60cd7
--- a/src/lib/ignored_problems.c
a60cd7
+++ b/src/lib/ignored_problems.c
a60cd7
@@ -17,7 +17,7 @@
a60cd7
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
a60cd7
 */
a60cd7
 
a60cd7
-#include "libabrt.h"
a60cd7
+#include "internal_libabrt.h"
a60cd7
 
a60cd7
 #define IGN_COLUMN_DELIMITER ';'
a60cd7
 #define IGN_DD_OPEN_FLAGS (DD_OPEN_READONLY | DD_FAIL_QUIETLY_ENOENT | DD_FAIL_QUIETLY_EACCES)
a60cd7
@@ -193,6 +193,8 @@ void ignored_problems_add(ignored_problems_t *set, const char *problem_id)
a60cd7
 void ignored_problems_remove_row(ignored_problems_t *set, const char *problem_id,
a60cd7
         const char *uuid, const char *duphash)
a60cd7
 {
a60cd7
+    INITIALIZE_LIBABRT();
a60cd7
+
a60cd7
     VERB1 log("Going to remove problem '%s' from ignored problems", problem_id);
a60cd7
 
a60cd7
     FILE *orig_fp;
a60cd7
diff --git a/src/lib/libabrt_init.c b/src/lib/libabrt_init.c
a60cd7
new file mode 100644
a60cd7
index 0000000..f9c1449
a60cd7
--- /dev/null
a60cd7
+++ b/src/lib/libabrt_init.c
a60cd7
@@ -0,0 +1,28 @@
a60cd7
+/*
a60cd7
+    Copyright (C) 2014  ABRT team
a60cd7
+    Copyright (C) 2014  RedHat Inc
a60cd7
+
a60cd7
+    This program is free software; you can redistribute it and/or modify
a60cd7
+    it under the terms of the GNU General Public License as published by
a60cd7
+    the Free Software Foundation; either version 2 of the License, or
a60cd7
+    (at your option) any later version.
a60cd7
+
a60cd7
+    This program is distributed in the hope that it will be useful,
a60cd7
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
a60cd7
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a60cd7
+    GNU General Public License for more details.
a60cd7
+
a60cd7
+    You should have received a copy of the GNU General Public License along
a60cd7
+    with this program; if not, write to the Free Software Foundation, Inc.,
a60cd7
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
a60cd7
+*/
a60cd7
+#include "internal_libabrt.h"
a60cd7
+
a60cd7
+int g_libabrt_inited;
a60cd7
+
a60cd7
+void libabrt_init(void)
a60cd7
+{
a60cd7
+#if ENABLE_NLS
a60cd7
+    bindtextdomain(PACKAGE, LOCALEDIR);
a60cd7
+#endif
a60cd7
+}
a60cd7
diff --git a/src/lib/problem_api_dbus.c b/src/lib/problem_api_dbus.c
a60cd7
index 784a43f..2d77898 100644
a60cd7
--- a/src/lib/problem_api_dbus.c
a60cd7
+++ b/src/lib/problem_api_dbus.c
a60cd7
@@ -18,7 +18,7 @@
a60cd7
 */
a60cd7
 
a60cd7
 #include "abrt_glib.h"
a60cd7
-#include "libabrt.h"
a60cd7
+#include "internal_libabrt.h"
a60cd7
 
a60cd7
 static GDBusProxy *get_dbus_proxy(void)
a60cd7
 {
a60cd7
@@ -48,6 +48,8 @@ static GDBusProxy *get_dbus_proxy(void)
a60cd7
 
a60cd7
 int chown_dir_over_dbus(const char *problem_dir_path)
a60cd7
 {
a60cd7
+    INITIALIZE_LIBABRT();
a60cd7
+
a60cd7
     GDBusProxy *proxy = get_dbus_proxy();
a60cd7
     if (!proxy)
a60cd7
         return 1;
a60cd7
@@ -72,6 +74,8 @@ int chown_dir_over_dbus(const char *problem_dir_path)
a60cd7
 
a60cd7
 int delete_problem_dirs_over_dbus(const GList *problem_dir_paths)
a60cd7
 {
a60cd7
+    INITIALIZE_LIBABRT();
a60cd7
+
a60cd7
     GDBusProxy *proxy = get_dbus_proxy();
a60cd7
     if (!proxy)
a60cd7
         return 1;
a60cd7
@@ -99,6 +103,8 @@ int delete_problem_dirs_over_dbus(const GList *problem_dir_paths)
a60cd7
 
a60cd7
 problem_data_t *get_problem_data_dbus(const char *problem_dir_path)
a60cd7
 {
a60cd7
+    INITIALIZE_LIBABRT();
a60cd7
+
a60cd7
     GDBusProxy *proxy = get_dbus_proxy();
a60cd7
     if (!proxy)
a60cd7
         return NULL;
a60cd7
@@ -143,6 +149,8 @@ problem_data_t *get_problem_data_dbus(const char *problem_dir_path)
a60cd7
 
a60cd7
 GList *get_problems_over_dbus(bool authorize)
a60cd7
 {
a60cd7
+    INITIALIZE_LIBABRT();
a60cd7
+
a60cd7
     GDBusProxy *proxy = get_dbus_proxy();
a60cd7
     if (!proxy)
a60cd7
         return ERR_PTR;
a60cd7
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
a60cd7
index dd32c7d..727dae0 100644
a60cd7
--- a/src/plugins/Makefile.am
a60cd7
+++ b/src/plugins/Makefile.am
a60cd7
@@ -89,6 +89,7 @@ EXTRA_DIST = \
a60cd7
     analyze_LocalGDB.xml.in \
a60cd7
     analyze_RetraceServer.xml.in \
a60cd7
     analyze_VMcore.xml.in \
a60cd7
+    abrt-action-analyze-core.in \
a60cd7
     abrt-action-analyze-vmcore \
a60cd7
     abrt-action-check-oops-for-hw-error \
a60cd7
     abrt-action-save-kernel-data \
a60cd7
@@ -306,7 +307,7 @@ endif
a60cd7
 
a60cd7
 DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
a60cd7
 
a60cd7
-DISTCLEANFILES = abrt-action-analyze-ccpp-local
a60cd7
+DISTCLEANFILES = abrt-action-analyze-ccpp-local abrt-action-analyze-core
a60cd7
 
a60cd7
 abrt-action-perform-ccpp-analysis: abrt-action-perform-ccpp-analysis.in
a60cd7
 	sed -e s,\@libexecdir\@,$(libexecdir),g \
a60cd7
@@ -315,3 +316,8 @@ abrt-action-perform-ccpp-analysis: abrt-action-perform-ccpp-analysis.in
a60cd7
 abrt-action-analyze-ccpp-local: abrt-action-analyze-ccpp-local.in
a60cd7
 	sed -e s,\@LIBEXEC_DIR\@,$(libexecdir),g \
a60cd7
         $< >$@
a60cd7
+
a60cd7
+abrt-action-analyze-core: abrt-action-analyze-core.in
a60cd7
+	sed -e s,\@localedir\@,$(localedir),g \
a60cd7
+        -e s,\@PACKAGE\@,$(PACKAGE),g \
a60cd7
+        $< >$@
a60cd7
diff --git a/src/plugins/abrt-action-analyze-core b/src/plugins/abrt-action-analyze-core
a60cd7
deleted file mode 100644
a60cd7
index 806cc26..0000000
a60cd7
--- a/src/plugins/abrt-action-analyze-core
a60cd7
+++ /dev/null
a60cd7
@@ -1,186 +0,0 @@
a60cd7
-#!/usr/bin/python -u
a60cd7
-# -*- coding: utf-8 -*-
a60cd7
-# WARNING: python -u means unbuffered I/O. Without it the messages are
a60cd7
-# passed to the parent asynchronously which looks bad in clients.
a60cd7
-
a60cd7
-from subprocess import Popen, PIPE
a60cd7
-import sys
a60cd7
-import os
a60cd7
-import getopt
a60cd7
-
a60cd7
-GETTEXT_PROGNAME = "abrt"
a60cd7
-import locale
a60cd7
-import gettext
a60cd7
-
a60cd7
-_ = lambda x: gettext.lgettext(x)
a60cd7
-
a60cd7
-
a60cd7
-verbose = 0
a60cd7
-
a60cd7
-def log(s):
a60cd7
-    sys.stderr.write("%s\n" % s)
a60cd7
-
a60cd7
-def log1(message):
a60cd7
-    if verbose > 0:
a60cd7
-        log(message)
a60cd7
-
a60cd7
-def log2(message):
a60cd7
-    if verbose > 1:
a60cd7
-        log(message)
a60cd7
-
a60cd7
-def error_msg(s):
a60cd7
-    sys.stderr.write("%s\n" % s)
a60cd7
-
a60cd7
-def error_msg_and_die(s):
a60cd7
-    sys.stderr.write("%s\n" % s)
a60cd7
-    sys.exit(1)
a60cd7
-
a60cd7
-def xopen(name, mode):
a60cd7
-    try:
a60cd7
-        r = open(name, mode)
a60cd7
-    except IOError, ex:
a60cd7
-        error_msg_and_die("Can't open '%s': %s" % (name, ex))
a60cd7
-    return r
a60cd7
-
a60cd7
-
a60cd7
-def init_gettext():
a60cd7
-    try:
a60cd7
-        locale.setlocale(locale.LC_ALL, "")
a60cd7
-    except locale.Error:
a60cd7
-        os.environ['LC_ALL'] = 'C'
a60cd7
-        locale.setlocale(locale.LC_ALL, "")
a60cd7
-    # Defeat "AttributeError: 'module' object has no attribute 'nl_langinfo'"
a60cd7
-    try:
a60cd7
-        gettext.bind_textdomain_codeset(GETTEXT_PROGNAME, locale.nl_langinfo(locale.CODESET))
a60cd7
-    except AttributeError:
a60cd7
-        pass
a60cd7
-    gettext.bindtextdomain(GETTEXT_PROGNAME, '/usr/share/locale')
a60cd7
-    gettext.textdomain(GETTEXT_PROGNAME)
a60cd7
-
a60cd7
-#eu_unstrip_OUT=`eu-unstrip "--core=$core" -n 2>eu_unstrip.ERR`
a60cd7
-def extract_info_from_core(coredump_name):
a60cd7
-    """
a60cd7
-    Extracts builds with filenames,
a60cd7
-    Returns a list of tuples (build_id, filename)
a60cd7
-    """
a60cd7
-    #OFFSET = 0
a60cd7
-    BUILD_ID = 1
a60cd7
-    LIBRARY = 2
a60cd7
-    #SEP = 3
a60cd7
-    EXECUTABLE = 4
a60cd7
-
a60cd7
-    log(_("Analyzing coredump '%s'") % coredump_name)
a60cd7
-    eu_unstrip_OUT = Popen(["eu-unstrip","--core=%s" % coredump_name, "-n"], stdout=PIPE, bufsize=-1).communicate()[0]
a60cd7
-    # parse eu_unstrip_OUT and return the list of build_ids
a60cd7
-
a60cd7
-    # eu_unstrip_OUT = (
a60cd7
-    # "0x7f42362ca000+0x204000 c4d35d993598a6242f7525d024b5ec3becf5b447@0x7f42362ca1a0 /usr/lib64/libcanberra-gtk.so.0 - libcanberra-gtk.so.0\n"
a60cd7
-    # "0x3afa400000+0x210000 607308f916c13c3ad9ee503008d31fa671ba73ce@0x3afa4001a0 /usr/lib64/libcanberra.so.0 - libcanberra.so.0\n"
a60cd7
-    # "0x3afa400000+0x210000 607308f916c13c3ad9ee503008d31fa671ba73ce@0x3afa4001a0 /usr/lib64/libcanberra.so.0 - libcanberra.so.0\n"
a60cd7
-    # "0x3bc7000000+0x208000 3be016bb723e85779a23e111a8ab1a520b209422@0x3bc70001a0 /usr/lib64/libvorbisfile.so.3 - libvorbisfile.so.3\n"
a60cd7
-    # "0x7f423609e000+0x22c000 87f9c7d9844f364c73aa2566d6cfc9c5fa36d35d@0x7f423609e1a0 /usr/lib64/libvorbis.so.0 - libvorbis.so.0\n"
a60cd7
-    # "0x7f4235e99000+0x205000 b5bc98c125a11b571cf4f2746268a6d3cfa95b68@0x7f4235e991a0 /usr/lib64/libogg.so.0 - libogg.so.0\n"
a60cd7
-    # "0x7f4235c8b000+0x20e000 f1ff6c8ee30dba27e90ef0c5b013df2833da2889@0x7f4235c8b1a0 /usr/lib64/libtdb.so.1 - libtdb.so.1\n"
a60cd7
-    # "0x3bc3000000+0x209000 8ef56f789fd914e8d0678eb0cdfda1bfebb00b40@0x3bc30001a0 /usr/lib64/libltdl.so.7 - libltdl.so.7\n"
a60cd7
-    # "0x7f4231b64000+0x22b000 3ca5b83798349f78b362b1ea51c8a4bc8114b8b1@0x7f4231b641a0 /usr/lib64/gio/modules/libgvfsdbus.so - libgvfsdbus.so\n"
a60cd7
-    # "0x7f423192a000+0x218000 ad024a01ad132737a8cfc7c95beb7c77733a652d@0x7f423192a1a0 /usr/lib64/libgvfscommon.so.0 - libgvfscommon.so.0\n"
a60cd7
-    # "0x7f423192a000+0x218000 ad024a01ad132737a8cfc7c95beb7c77733a652d@0x7f423192a1a0 /usr/lib64/libgvfscommon.so.0 - libgvfscommon.so.0\n"
a60cd7
-    # "0x3bb8e00000+0x20e000 d240ac5755184a95c783bb98a2d05530e0cf958a@0x3bb8e001a0 /lib64/libudev.so.0 - libudev.so.0\n"
a60cd7
-    # )
a60cd7
-    #print eu_unstrip_OUT
a60cd7
-    # we failed to get build ids from the core -> die
a60cd7
-    if not eu_unstrip_OUT:
a60cd7
-        error_msg_and_die("Can't get build ids from %s" % coredump_name)
a60cd7
-
a60cd7
-    lines = eu_unstrip_OUT.split('\n')
a60cd7
-    # using set ensures the unique values
a60cd7
-    build_ids = set()
a60cd7
-    libraries = set()
a60cd7
-
a60cd7
-    for line in lines:
a60cd7
-        b_ids_line = line.split()
a60cd7
-        if len(b_ids_line) >= EXECUTABLE:
a60cd7
-            # [exe] -> the executable itself
a60cd7
-            # linux-vdso.so.1 -> Virtual Dynamic Shared Object
a60cd7
-            # linux-gate.so.1 -> the same as vdso
a60cd7
-            # See https://bugzilla.redhat.com/show_bug.cgi?id=706969
a60cd7
-            # "Please split kernel debuginfo packages so that VDSO debuginfos are separate" -
a60cd7
-            # we might want to remove this special-casing later.
a60cd7
-            if b_ids_line[BUILD_ID] == '-':
a60cd7
-                log(_("Missing build id: %s" % b_ids_line[EXECUTABLE]))
a60cd7
-            elif ((len(b_ids_line) == EXECUTABLE) or (b_ids_line[EXECUTABLE] not in ["linux-vdso.so.1", "linux-gate.so.1"])):
a60cd7
-                build_id = b_ids_line[BUILD_ID].split('@')[0]
a60cd7
-                build_ids.add(build_id)
a60cd7
-                library = b_ids_line[LIBRARY]
a60cd7
-                libraries.add(library)
a60cd7
-            else:
a60cd7
-                log2("skipping line '%s'" % line)
a60cd7
-    log1("Found %i build_ids" % len(build_ids))
a60cd7
-    log1("Found %i libs" % len(libraries))
a60cd7
-    return build_ids
a60cd7
-
a60cd7
-def build_ids_to_path(build_ids):
a60cd7
-    """
a60cd7
-    build_id1=${build_id:0:2}
a60cd7
-    build_id2=${build_id:2}
a60cd7
-    file="usr/lib/debug/.build-id/$build_id1/$build_id2.debug"
a60cd7
-    """
a60cd7
-    return ["/usr/lib/debug/.build-id/%s/%s.debug" % (b_id[:2], b_id[2:]) for b_id in build_ids]
a60cd7
-
a60cd7
-if __name__ == "__main__":
a60cd7
-    # localization
a60cd7
-    init_gettext()
a60cd7
-
a60cd7
-    ABRT_VERBOSE = os.getenv("ABRT_VERBOSE")
a60cd7
-    if (ABRT_VERBOSE):
a60cd7
-        try:
a60cd7
-            verbose = int(ABRT_VERBOSE)
a60cd7
-        except:
a60cd7
-            pass
a60cd7
-
a60cd7
-    progname = os.path.basename(sys.argv[0])
a60cd7
-    help_text = _("Usage: %s [-v] [-o OUTFILE] -c COREFILE") % progname
a60cd7
-    try:
a60cd7
-        opts, args = getopt.getopt(sys.argv[1:], "vhc:o:", ["help", "core="])
a60cd7
-    except getopt.GetoptError, err:
a60cd7
-        error_msg(err) # prints something like "option -a not recognized"
a60cd7
-        error_msg_and_die(help_text)
a60cd7
-
a60cd7
-    core = None
a60cd7
-    opt_o = None
a60cd7
-
a60cd7
-    for opt, arg in opts:
a60cd7
-        if opt in ("-h", "--help"):
a60cd7
-            print help_text
a60cd7
-            exit(0)
a60cd7
-        elif opt == "-v":
a60cd7
-            verbose += 1
a60cd7
-        elif opt == "-o":
a60cd7
-            opt_o = arg
a60cd7
-        elif opt in ("-c", "--core"):
a60cd7
-            core = arg
a60cd7
-
a60cd7
-    if not core:
a60cd7
-        error_msg(_("COREFILE is not specified"))
a60cd7
-        error_msg_and_die(help_text)
a60cd7
-
a60cd7
-    b_ids = extract_info_from_core(core)
a60cd7
-
a60cd7
-    try:
a60cd7
-        # Note that we open -o FILE only when we reach the point
a60cd7
-        # when we are definitely going to write something to it
a60cd7
-        outfile = sys.stdout
a60cd7
-        outname = opt_o
a60cd7
-        # Make sure the file is readable for all
a60cd7
-        oldmask = os.umask(0002)
a60cd7
-        for bid in b_ids:
a60cd7
-            if outname:
a60cd7
-                outfile = xopen(outname, "w")
a60cd7
-                outname = None
a60cd7
-            outfile.write("%s\n" % bid)
a60cd7
-        outfile.close()
a60cd7
-        os.umask(oldmask)
a60cd7
-    except IOError, e:
a60cd7
-        if not opt_o:
a60cd7
-            opt_o = "<stdout>"
a60cd7
-        error_msg_and_die("Error writing to '%s': %s" % (opt_o, e))
a60cd7
diff --git a/src/plugins/abrt-action-analyze-core.in b/src/plugins/abrt-action-analyze-core.in
a60cd7
new file mode 100644
a60cd7
index 0000000..0185ac5
a60cd7
--- /dev/null
a60cd7
+++ b/src/plugins/abrt-action-analyze-core.in
a60cd7
@@ -0,0 +1,186 @@
a60cd7
+#!/usr/bin/python -u
a60cd7
+# -*- coding: utf-8 -*-
a60cd7
+# WARNING: python -u means unbuffered I/O. Without it the messages are
a60cd7
+# passed to the parent asynchronously which looks bad in clients.
a60cd7
+
a60cd7
+from subprocess import Popen, PIPE
a60cd7
+import sys
a60cd7
+import os
a60cd7
+import getopt
a60cd7
+
a60cd7
+GETTEXT_PROGNAME = "@PACKAGE@"
a60cd7
+import locale
a60cd7
+import gettext
a60cd7
+
a60cd7
+_ = lambda x: gettext.lgettext(x)
a60cd7
+
a60cd7
+
a60cd7
+verbose = 0
a60cd7
+
a60cd7
+def log(s):
a60cd7
+    sys.stderr.write("%s\n" % s)
a60cd7
+
a60cd7
+def log1(message):
a60cd7
+    if verbose > 0:
a60cd7
+        log(message)
a60cd7
+
a60cd7
+def log2(message):
a60cd7
+    if verbose > 1:
a60cd7
+        log(message)
a60cd7
+
a60cd7
+def error_msg(s):
a60cd7
+    sys.stderr.write("%s\n" % s)
a60cd7
+
a60cd7
+def error_msg_and_die(s):
a60cd7
+    sys.stderr.write("%s\n" % s)
a60cd7
+    sys.exit(1)
a60cd7
+
a60cd7
+def xopen(name, mode):
a60cd7
+    try:
a60cd7
+        r = open(name, mode)
a60cd7
+    except IOError, ex:
a60cd7
+        error_msg_and_die("Can't open '%s': %s" % (name, ex))
a60cd7
+    return r
a60cd7
+
a60cd7
+
a60cd7
+def init_gettext():
a60cd7
+    try:
a60cd7
+        locale.setlocale(locale.LC_ALL, "")
a60cd7
+    except locale.Error:
a60cd7
+        os.environ['LC_ALL'] = 'C'
a60cd7
+        locale.setlocale(locale.LC_ALL, "")
a60cd7
+    # Defeat "AttributeError: 'module' object has no attribute 'nl_langinfo'"
a60cd7
+    try:
a60cd7
+        gettext.bind_textdomain_codeset(GETTEXT_PROGNAME, locale.nl_langinfo(locale.CODESET))
a60cd7
+    except AttributeError:
a60cd7
+        pass
a60cd7
+    gettext.bindtextdomain(GETTEXT_PROGNAME, "@localedir@")
a60cd7
+    gettext.textdomain(GETTEXT_PROGNAME)
a60cd7
+
a60cd7
+#eu_unstrip_OUT=`eu-unstrip "--core=$core" -n 2>eu_unstrip.ERR`
a60cd7
+def extract_info_from_core(coredump_name):
a60cd7
+    """
a60cd7
+    Extracts builds with filenames,
a60cd7
+    Returns a list of tuples (build_id, filename)
a60cd7
+    """
a60cd7
+    #OFFSET = 0
a60cd7
+    BUILD_ID = 1
a60cd7
+    LIBRARY = 2
a60cd7
+    #SEP = 3
a60cd7
+    EXECUTABLE = 4
a60cd7
+
a60cd7
+    log(_("Analyzing coredump '%s'") % coredump_name)
a60cd7
+    eu_unstrip_OUT = Popen(["eu-unstrip","--core=%s" % coredump_name, "-n"], stdout=PIPE, bufsize=-1).communicate()[0]
a60cd7
+    # parse eu_unstrip_OUT and return the list of build_ids
a60cd7
+
a60cd7
+    # eu_unstrip_OUT = (
a60cd7
+    # "0x7f42362ca000+0x204000 c4d35d993598a6242f7525d024b5ec3becf5b447@0x7f42362ca1a0 /usr/lib64/libcanberra-gtk.so.0 - libcanberra-gtk.so.0\n"
a60cd7
+    # "0x3afa400000+0x210000 607308f916c13c3ad9ee503008d31fa671ba73ce@0x3afa4001a0 /usr/lib64/libcanberra.so.0 - libcanberra.so.0\n"
a60cd7
+    # "0x3afa400000+0x210000 607308f916c13c3ad9ee503008d31fa671ba73ce@0x3afa4001a0 /usr/lib64/libcanberra.so.0 - libcanberra.so.0\n"
a60cd7
+    # "0x3bc7000000+0x208000 3be016bb723e85779a23e111a8ab1a520b209422@0x3bc70001a0 /usr/lib64/libvorbisfile.so.3 - libvorbisfile.so.3\n"
a60cd7
+    # "0x7f423609e000+0x22c000 87f9c7d9844f364c73aa2566d6cfc9c5fa36d35d@0x7f423609e1a0 /usr/lib64/libvorbis.so.0 - libvorbis.so.0\n"
a60cd7
+    # "0x7f4235e99000+0x205000 b5bc98c125a11b571cf4f2746268a6d3cfa95b68@0x7f4235e991a0 /usr/lib64/libogg.so.0 - libogg.so.0\n"
a60cd7
+    # "0x7f4235c8b000+0x20e000 f1ff6c8ee30dba27e90ef0c5b013df2833da2889@0x7f4235c8b1a0 /usr/lib64/libtdb.so.1 - libtdb.so.1\n"
a60cd7
+    # "0x3bc3000000+0x209000 8ef56f789fd914e8d0678eb0cdfda1bfebb00b40@0x3bc30001a0 /usr/lib64/libltdl.so.7 - libltdl.so.7\n"
a60cd7
+    # "0x7f4231b64000+0x22b000 3ca5b83798349f78b362b1ea51c8a4bc8114b8b1@0x7f4231b641a0 /usr/lib64/gio/modules/libgvfsdbus.so - libgvfsdbus.so\n"
a60cd7
+    # "0x7f423192a000+0x218000 ad024a01ad132737a8cfc7c95beb7c77733a652d@0x7f423192a1a0 /usr/lib64/libgvfscommon.so.0 - libgvfscommon.so.0\n"
a60cd7
+    # "0x7f423192a000+0x218000 ad024a01ad132737a8cfc7c95beb7c77733a652d@0x7f423192a1a0 /usr/lib64/libgvfscommon.so.0 - libgvfscommon.so.0\n"
a60cd7
+    # "0x3bb8e00000+0x20e000 d240ac5755184a95c783bb98a2d05530e0cf958a@0x3bb8e001a0 /lib64/libudev.so.0 - libudev.so.0\n"
a60cd7
+    # )
a60cd7
+    #print eu_unstrip_OUT
a60cd7
+    # we failed to get build ids from the core -> die
a60cd7
+    if not eu_unstrip_OUT:
a60cd7
+        error_msg_and_die("Can't get build ids from %s" % coredump_name)
a60cd7
+
a60cd7
+    lines = eu_unstrip_OUT.split('\n')
a60cd7
+    # using set ensures the unique values
a60cd7
+    build_ids = set()
a60cd7
+    libraries = set()
a60cd7
+
a60cd7
+    for line in lines:
a60cd7
+        b_ids_line = line.split()
a60cd7
+        if len(b_ids_line) >= EXECUTABLE:
a60cd7
+            # [exe] -> the executable itself
a60cd7
+            # linux-vdso.so.1 -> Virtual Dynamic Shared Object
a60cd7
+            # linux-gate.so.1 -> the same as vdso
a60cd7
+            # See https://bugzilla.redhat.com/show_bug.cgi?id=706969
a60cd7
+            # "Please split kernel debuginfo packages so that VDSO debuginfos are separate" -
a60cd7
+            # we might want to remove this special-casing later.
a60cd7
+            if b_ids_line[BUILD_ID] == '-':
a60cd7
+                log(_("Missing build id: %s" % b_ids_line[EXECUTABLE]))
a60cd7
+            elif ((len(b_ids_line) == EXECUTABLE) or (b_ids_line[EXECUTABLE] not in ["linux-vdso.so.1", "linux-gate.so.1"])):
a60cd7
+                build_id = b_ids_line[BUILD_ID].split('@')[0]
a60cd7
+                build_ids.add(build_id)
a60cd7
+                library = b_ids_line[LIBRARY]
a60cd7
+                libraries.add(library)
a60cd7
+            else:
a60cd7
+                log2("skipping line '%s'" % line)
a60cd7
+    log1("Found %i build_ids" % len(build_ids))
a60cd7
+    log1("Found %i libs" % len(libraries))
a60cd7
+    return build_ids
a60cd7
+
a60cd7
+def build_ids_to_path(build_ids):
a60cd7
+    """
a60cd7
+    build_id1=${build_id:0:2}
a60cd7
+    build_id2=${build_id:2}
a60cd7
+    file="usr/lib/debug/.build-id/$build_id1/$build_id2.debug"
a60cd7
+    """
a60cd7
+    return ["/usr/lib/debug/.build-id/%s/%s.debug" % (b_id[:2], b_id[2:]) for b_id in build_ids]
a60cd7
+
a60cd7
+if __name__ == "__main__":
a60cd7
+    # localization
a60cd7
+    init_gettext()
a60cd7
+
a60cd7
+    ABRT_VERBOSE = os.getenv("ABRT_VERBOSE")
a60cd7
+    if (ABRT_VERBOSE):
a60cd7
+        try:
a60cd7
+            verbose = int(ABRT_VERBOSE)
a60cd7
+        except:
a60cd7
+            pass
a60cd7
+
a60cd7
+    progname = os.path.basename(sys.argv[0])
a60cd7
+    help_text = _("Usage: %s [-v] [-o OUTFILE] -c COREFILE") % progname
a60cd7
+    try:
a60cd7
+        opts, args = getopt.getopt(sys.argv[1:], "vhc:o:", ["help", "core="])
a60cd7
+    except getopt.GetoptError, err:
a60cd7
+        error_msg(err) # prints something like "option -a not recognized"
a60cd7
+        error_msg_and_die(help_text)
a60cd7
+
a60cd7
+    core = None
a60cd7
+    opt_o = None
a60cd7
+
a60cd7
+    for opt, arg in opts:
a60cd7
+        if opt in ("-h", "--help"):
a60cd7
+            print help_text
a60cd7
+            exit(0)
a60cd7
+        elif opt == "-v":
a60cd7
+            verbose += 1
a60cd7
+        elif opt == "-o":
a60cd7
+            opt_o = arg
a60cd7
+        elif opt in ("-c", "--core"):
a60cd7
+            core = arg
a60cd7
+
a60cd7
+    if not core:
a60cd7
+        error_msg(_("COREFILE is not specified"))
a60cd7
+        error_msg_and_die(help_text)
a60cd7
+
a60cd7
+    b_ids = extract_info_from_core(core)
a60cd7
+
a60cd7
+    try:
a60cd7
+        # Note that we open -o FILE only when we reach the point
a60cd7
+        # when we are definitely going to write something to it
a60cd7
+        outfile = sys.stdout
a60cd7
+        outname = opt_o
a60cd7
+        # Make sure the file is readable for all
a60cd7
+        oldmask = os.umask(0002)
a60cd7
+        for bid in b_ids:
a60cd7
+            if outname:
a60cd7
+                outfile = xopen(outname, "w")
a60cd7
+                outname = None
a60cd7
+            outfile.write("%s\n" % bid)
a60cd7
+        outfile.close()
a60cd7
+        os.umask(oldmask)
a60cd7
+    except IOError, e:
a60cd7
+        if not opt_o:
a60cd7
+            opt_o = "<stdout>"
a60cd7
+        error_msg_and_die("Error writing to '%s': %s" % (opt_o, e))
a60cd7
diff --git a/src/plugins/abrt-action-install-debuginfo-to-abrt-cache.c b/src/plugins/abrt-action-install-debuginfo-to-abrt-cache.c
a60cd7
index cf74326..e0eccc0 100644
a60cd7
--- a/src/plugins/abrt-action-install-debuginfo-to-abrt-cache.c
a60cd7
+++ b/src/plugins/abrt-action-install-debuginfo-to-abrt-cache.c
a60cd7
@@ -74,7 +74,8 @@ int main(int argc, char **argv)
a60cd7
         // However since we communicate through environment variables
a60cd7
         // we have to keep a whitelist of variables to keep.
a60cd7
         static const char *whitelist[] = {
a60cd7
-            "REPORT_CLIENT_SLAVE" //  Check if the app is being run as a slave
a60cd7
+            "REPORT_CLIENT_SLAVE", //  Check if the app is being run as a slave
a60cd7
+            "LANG",
a60cd7
         };
a60cd7
         const size_t wlsize = sizeof(whitelist)/sizeof(char*);
a60cd7
         char *setlist[sizeof(whitelist)/sizeof(char*)] = { 0 };
a60cd7
-- 
a60cd7
1.8.3.1
a60cd7