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