Blame 0044-localization-fixes.patch

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