A lot of good software is in different languages
by Kieron Tilley
Ryals Trouble police withfriends links Cox or images? View often this message app online.
Fri, 26 Nov 2010 19:54:14 +0100
Dear crash-catcher, Raymond
Soft the best! Anti-Virus, Security, Autodesk, CD-DVD SoftwareCopyright © 2010 hQe3No3 | All highlights Rights shooting Reserved.We Jeb are committed to protecting defenders your privacy, so your email address will NEVER besold, rented, or exchanged. This church message was sent to crash-catcher(a)lists.fedorahosted.org. Visit I your subscription management page to modify JKUSA your email communication preferencesor update your personal profile. To stop ALL winds email from us, click here (or reply manager via email with "remove" shop in the subject refuses line).
13 years, 7 months
[PATCH] factor out headers so that "report lib" API is separated out of abrt API
by Denys Vlasenko
This patch minimally affects code per se - it adds
create_crash_dump_dir() function which takes in-memory
representation of the dump (map_crash_data_t object)
and creates a on-disk representation.
Then it returns pointer to struct dump_dir.
With this function, it is possible to run an event
on a user-constructed map_crash_data_t:
map_crash_data_t cd;
add_to_crash_data(cd, "foo", "bar");
struct dump_dir *dd = create_crash_dump_dir(cd);
char *dir_name = strdup(dd->dd_dir);
dd_close(dd);
run_event(run_state, dir_name, event);
delete_crash_dump_dir(dir_name);
which is, basically, what report library is about.
The biggest part of the patch is reshuffling of
header files, with the following result: three header
files which are not cluttered by other ABRT stuff,
and expose the following API each:
crash_dump.h - in-memory crash dump data ops
dump_dir.h - on-disk crash dump data ops
run_event.h - run_event() and friends
These is a test application, test_report.cpp.cpp,
which demonstrates (and tests) usage of these headers.
(grep for "test-report" and enable it in build system
if you want it to be built).
It creates a temporary dump in
/var/run/abrt/tmp-11672-1290787845 and runs "report" event.
Deleting of temp dump is disabled for testing purposes -
you might want to see the contents.
Here is how the binary looks like:
# size `which test-report`
text data bss dec hex filename
3730 668 48 4446 115e /usr/bin/test-report
# ldd `which test-report`
linux-vdso.so.1 => (0x00007ffffa80f000)
libabrt.so.0 => /usr/lib64/libabrt.so.0 (0x00007fad1f35e000)
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x0000003c1f200000)
libstdc++.so.6 => /usr/lib64/libstdc++.so.6 (0x0000003c2c200000)
libm.so.6 => /lib64/libm.so.6 (0x00007fad1f0da000)
libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000003c28e00000)
libc.so.6 => /lib64/libc.so.6 (0x00007fad1ed5b000)
/lib64/ld-linux-x86-64.so.2 (0x00007fad1f570000)
Next step would be to clean up the namespace,
then rename libabrt.so into libreport.so,
then split it into a separate package so that we can install it
without installing other two abrt .so files.
Please review.
--
vda
diff -x '*.po' -d -urpN abrt.1/abrt.spec abrt.2/abrt.spec
--- abrt.1/abrt.spec 2010-11-23 15:49:33.000000000 +0100
+++ abrt.2/abrt.spec 2010-11-26 17:00:04.754196757 +0100
@@ -369,6 +369,7 @@ fi
%{_datadir}/icons/hicolor/*/status/*
%{_datadir}/%{name}/icons/hicolor/*/status/*
%{_bindir}/abrt-applet
+#%{_bindir}/test-report
%{_sysconfdir}/xdg/autostart/abrt-applet.desktop
%files addon-ccpp
diff -x '*.po' -d -urpN abrt.1/src/applet/Makefile.am abrt.2/src/applet/Makefile.am
--- abrt.1/src/applet/Makefile.am 2010-11-26 13:20:34.000000000 +0100
+++ abrt.2/src/applet/Makefile.am 2010-11-26 17:00:19.800197498 +0100
@@ -1,4 +1,5 @@
bin_PROGRAMS = abrt-applet
+#test-report
abrt_applet_SOURCES = \
Applet.cpp \
@@ -30,6 +31,15 @@ abrt_applet_LDADD = \
$(LIBNOTIFY_LIBS) \
$(GTK_LIBS)
+#test_report_SOURCES = \
+# test_report.cpp
+#test_report_CPPFLAGS = \
+# -Wall -Werror \
+# -I$(srcdir)/../include \
+# -D_GNU_SOURCE
+#test_report_LDADD = \
+# ../lib/libabrt.la
+
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
@INTLTOOL_DESKTOP_RULE@
diff -x '*.po' -d -urpN abrt.1/src/applet/test_report.cpp abrt.2/src/applet/test_report.cpp
--- abrt.1/src/applet/test_report.cpp 1970-01-01 01:00:00.000000000 +0100
+++ abrt.2/src/applet/test_report.cpp 2010-11-26 17:06:03.862196962 +0100
@@ -0,0 +1,61 @@
+/*
+ Copyright (C) 2009 Jiri Moskovcak (jmoskovc(a)redhat.com)
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#if HAVE_LOCALE_H
+# include <locale.h>
+#endif
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include "crash_dump.h"
+#include "dump_dir.h"
+#include "run_event.h"
+
+static char *do_log(char *log_line, void *param)
+{
+ printf("%s\n", log_line);
+ return log_line;
+}
+
+int main(int argc, char** argv)
+{
+ map_crash_data_t cd;
+
+ add_to_crash_data(cd, "analyzer", "wow");
+ const char *event = "report";
+
+ struct dump_dir *dd = create_crash_dump_dir(cd);
+ if (!dd)
+ return 1;
+ char *dir_name = strdup(dd->dd_dir);
+ dd_close(dd);
+
+ printf("Temp dump dir: '%s'\n", dir_name);
+
+ struct run_event_state *run_state = new_run_event_state();
+ run_state->logging_callback = do_log;
+ int r = run_event(run_state, dir_name, event);
+ if (r == -1)
+ printf("No actions are found for event '%s'\n", event);
+ free_run_event_state(run_state);
+
+// delete_crash_dump_dir(dir_name);
+ free(dir_name);
+
+ return 0;
+}
diff -x '*.po' -d -urpN abrt.1/src/cli/dbus.h abrt.2/src/cli/dbus.h
--- abrt.1/src/cli/dbus.h 2010-11-10 00:12:48.000000000 +0100
+++ abrt.2/src/cli/dbus.h 2010-11-26 15:59:55.634196669 +0100
@@ -19,7 +19,7 @@
#define ABRT_CLI_DBUS_H
#include "abrt_dbus.h"
-#include "crash_types.h"
+#include "abrt_crash_dump.h"
extern DBusConnection* s_dbus_conn;
diff -x '*.po' -d -urpN abrt.1/src/daemon/abrt-server.c abrt.2/src/daemon/abrt-server.c
--- abrt.1/src/daemon/abrt-server.c 2010-11-23 15:49:33.000000000 +0100
+++ abrt.2/src/daemon/abrt-server.c 2010-11-26 15:59:48.771196440 +0100
@@ -17,7 +17,7 @@
*/
#include "abrtlib.h"
#include "dump_dir.h"
-#include "crash_types.h" /* FILENAME_foo */
+#include "abrt_crash_dump.h" /* FILENAME_foo */
#include "hooklib.h"
#include "parse_options.h"
diff -x '*.po' -d -urpN abrt.1/src/daemon/CommLayerServer.h abrt.2/src/daemon/CommLayerServer.h
--- abrt.1/src/daemon/CommLayerServer.h 2010-11-10 00:12:48.000000000 +0100
+++ abrt.2/src/daemon/CommLayerServer.h 2010-11-26 15:59:52.274197011 +0100
@@ -20,7 +20,7 @@
#define COMMLAYERSERVER_H_
#include "abrtlib.h"
-#include "crash_types.h"
+#include "abrt_crash_dump.h"
class CCommLayerServer {
public:
diff -x '*.po' -d -urpN abrt.1/src/daemon/Daemon.cpp abrt.2/src/daemon/Daemon.cpp
--- abrt.1/src/daemon/Daemon.cpp 2010-11-25 13:29:42.000000000 +0100
+++ abrt.2/src/daemon/Daemon.cpp 2010-11-26 16:37:12.984196978 +0100
@@ -536,7 +536,7 @@ static gboolean handle_inotify_cb(GIOCha
char *d = concat_path_file(DEBUG_DUMPS_DIR, worst_dir);
free(worst_dir);
worst_dir = NULL;
- delete_debug_dump_dir(d);
+ delete_crash_dump_dir(d);
free(d);
}
}
@@ -561,7 +561,7 @@ static gboolean handle_inotify_cb(GIOCha
log("Deleting crash %s (dup of %s), sending dbus signal",
strrchr(fullname, '/') + 1,
strrchr(first, '/') + 1);
- delete_debug_dump_dir(fullname);
+ delete_crash_dump_dir(fullname);
}
const char *uid_str = get_crash_data_item_content_or_NULL(crashinfo, FILENAME_UID);
@@ -586,7 +586,7 @@ static gboolean handle_inotify_cb(GIOCha
case MW_GPG_ERROR:
default:
log("Corrupted or bad crash %s (res:%d), deleting", fullname, (int)res);
- delete_debug_dump_dir(fullname);
+ delete_crash_dump_dir(fullname);
break;
}
}
diff -x '*.po' -d -urpN abrt.1/src/daemon/Daemon.h abrt.2/src/daemon/Daemon.h
--- abrt.1/src/daemon/Daemon.h 2010-11-10 00:12:48.000000000 +0100
+++ abrt.2/src/daemon/Daemon.h 2010-11-26 15:59:45.713946651 +0100
@@ -21,7 +21,7 @@
#include <pthread.h>
#include "abrt_types.h"
-#include "crash_types.h"
+#include "abrt_crash_dump.h"
class CCrashWatcher;
class CCommLayerServer;
diff -x '*.po' -d -urpN abrt.1/src/daemon/MiddleWare.cpp abrt.2/src/daemon/MiddleWare.cpp
--- abrt.1/src/daemon/MiddleWare.cpp 2010-11-25 13:29:42.000000000 +0100
+++ abrt.2/src/daemon/MiddleWare.cpp 2010-11-26 16:37:17.302196315 +0100
@@ -60,6 +60,15 @@ static bool DebugDumpToCrashReport(const
if (!dd)
return false;
+ static const char *const must_have_files[] = {
+ FILENAME_ARCHITECTURE,
+ FILENAME_KERNEL ,
+ FILENAME_PACKAGE ,
+ FILENAME_COMPONENT ,
+ FILENAME_RELEASE ,
+ FILENAME_EXECUTABLE ,
+ NULL
+ };
const char *const *v = must_have_files;
while (*v)
{
@@ -72,7 +81,7 @@ static bool DebugDumpToCrashReport(const
v++;
}
- load_crash_data_from_debug_dump(dd, pCrashData);
+ load_crash_data_from_crash_dump_dir(dd, pCrashData);
char *events = list_possible_events(dd, NULL, "");
dd_close(dd);
@@ -143,7 +152,7 @@ mw_result_t CreateCrashReport(const char
goto ret;
}
- /* Do a load_crash_data_from_debug_dump from (possibly updated)
+ /* Do a load_crash_data_from_crash_dump_dir from (possibly updated)
* crash dump dir
*/
if (!DebugDumpToCrashReport(dump_dir_name, pCrashData))
@@ -575,7 +584,7 @@ static mw_result_t FillCrashInfo(const c
if (!dd)
return MW_ERROR;
- load_crash_data_from_debug_dump(dd, pCrashData);
+ load_crash_data_from_crash_dump_dir(dd, pCrashData);
char *events = list_possible_events(dd, NULL, "");
dd_close(dd);
@@ -648,7 +657,7 @@ vector_map_crash_data_t GetCrashInfos(lo
break;
case MW_ERROR:
error_msg("Dump directory %s doesn't exist or misses crucial files, deleting", dump_dir_name);
- delete_debug_dump_dir(dump_dir_name);
+ delete_crash_dump_dir(dump_dir_name);
break;
default:
break;
diff -x '*.po' -d -urpN abrt.1/src/gui/CCDump.py abrt.2/src/gui/CCDump.py
--- abrt.1/src/gui/CCDump.py 2010-11-23 15:49:33.000000000 +0100
+++ abrt.2/src/gui/CCDump.py 2010-11-26 16:00:00.963196459 +0100
@@ -3,7 +3,7 @@ from datetime import datetime
from abrt_utils import _, init_logging, log, log1, log2
-# Keep in sync with crash_types.h!
+# Keep in sync with abrt_crash_dump.h!
CD_TYPE = 0
CD_EDITABLE = 1
CD_CONTENT = 2
diff -x '*.po' -d -urpN abrt.1/src/hooks/abrt-hook-ccpp.c abrt.2/src/hooks/abrt-hook-ccpp.c
--- abrt.1/src/hooks/abrt-hook-ccpp.c 2010-11-18 14:06:35.000000000 +0100
+++ abrt.2/src/hooks/abrt-hook-ccpp.c 2010-11-26 16:37:05.065945704 +0100
@@ -498,8 +498,8 @@ int main(int argc, char** argv)
}
/* We close dumpdir before we start catering for crash storm case.
- * Otherwise, delete_debug_dump_dir's from other concurrent
- * CCpp's won't be able to delete our dump (their delete_debug_dump_dir
+ * Otherwise, delete_crash_dump_dir's from other concurrent
+ * CCpp's won't be able to delete our dump (their delete_crash_dump_dir
* will wait for us), and we won't be able to delete their dumps.
* Classic deadlock.
*/
diff -x '*.po' -d -urpN abrt.1/src/include/abrt_crash_dump.h abrt.2/src/include/abrt_crash_dump.h
--- abrt.1/src/include/abrt_crash_dump.h 1970-01-01 01:00:00.000000000 +0100
+++ abrt.2/src/include/abrt_crash_dump.h 2010-11-26 16:18:05.641946877 +0100
@@ -0,0 +1,94 @@
+/*
+ Copyright (C) 2009 Abrt team.
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#ifndef ABRT_CRASH_DUMP_H_
+#define ABRT_CRASH_DUMP_H_
+
+#include "crash_dump.h"
+#include "abrt_types.h"
+
+// Text bigger than this usually is attached, not added inline
+#define CD_TEXT_ATT_SIZE (2*1024)
+
+// Keep in sync with CCDump.py:
+
+// Filenames in dump directory:
+// filled by a hook:
+#define FILENAME_ANALYZER "analyzer"
+#define FILENAME_EXECUTABLE "executable"
+#define FILENAME_BINARY "binary"
+#define FILENAME_CMDLINE "cmdline"
+#define FILENAME_REASON "reason"
+#define FILENAME_COREDUMP "coredump"
+#define FILENAME_BACKTRACE "backtrace"
+#define FILENAME_MEMORYMAP "memorymap"
+#define FILENAME_DUPHASH "global_uuid" /* name is compat, to be renamed to "duphash" */
+// Name of the function where the application crashed.
+// Optional.
+#define FILENAME_CRASH_FUNCTION "crash_function"
+// filled by CDebugDump::Create() (which also fills FILENAME_UID):
+#define FILENAME_ARCHITECTURE "architecture"
+#define FILENAME_KERNEL "kernel"
+#define FILENAME_TIME "time"
+#define FILENAME_RELEASE "release" /* from /etc/redhat-release */
+// filled by <what?>
+#define FILENAME_PACKAGE "package"
+#define FILENAME_COMPONENT "component"
+#define FILENAME_DESCRIPTION "description" /* package descr (not crash descr) */
+#define FILENAME_COMMENT "comment"
+#define FILENAME_REPRODUCE "reproduce"
+#define FILENAME_RATING "rating"
+#define FILENAME_HOSTNAME "hostname"
+// Optional. Set to "1" by abrt-handle-upload for every unpacked crashdump
+#define FILENAME_REMOTE "remote"
+#define FILENAME_TAINTED "kernel_tainted"
+// TODO: TicketUploader also has open-coded "TICKET", "CUSTOMER" files
+
+#define FILENAME_UID "uid"
+#define FILENAME_UUID "uuid"
+#define FILENAME_INFORMALL "inform_all_users"
+#define FILENAME_COUNT "count"
+#define FILENAME_MESSAGE "message"
+// Not stored as files, added "on the fly":
+#define CD_DUMPDIR "DumpDir"
+// "Which events are possible (make sense) on this crash dump?"
+// (a string with "\n" terminated event names)
+#define CD_EVENTS "Events"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+bool is_editable_file(const char *file_name);
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#ifdef __cplusplus
+
+typedef std::vector<map_crash_data_t> vector_map_crash_data_t;
+
+void log_map_crash_data(const map_crash_data_t& data, const char *name);
+
+#endif /* __cplusplus */
+
+
+#endif
diff -x '*.po' -d -urpN abrt.1/src/include/abrtlib.h abrt.2/src/include/abrtlib.h
--- abrt.1/src/include/abrtlib.h 2010-11-26 13:20:34.000000000 +0100
+++ abrt.2/src/include/abrtlib.h 2010-11-26 16:11:02.024196895 +0100
@@ -77,9 +77,10 @@ int vdprintf(int d, const char *format,
#include "hash_sha1.h"
#include "hash_md5.h"
-#include "crash_types.h"
-#include "dump_dir.h"
+#include "abrt_crash_dump.h"
#include "abrt_types.h"
+#include "dump_dir.h"
+#include "run_event.h"
#ifdef __cplusplus
@@ -216,23 +217,6 @@ char* get_cmdline(pid_t pid);
/* Returns 1 if abrtd daemon is running, 0 otherwise. */
int daemon_is_ok();
-struct run_event_state {
- int (*post_run_callback)(const char *dump_dir_name, void *param);
- void *post_run_param;
- char* (*logging_callback)(char *log_line, void *param);
- void *logging_param;
-};
-static inline struct run_event_state *new_run_event_state()
- { return (struct run_event_state*)xzalloc(sizeof(struct run_event_state)); }
-static inline void free_run_event_state(struct run_event_state *state)
- { free(state); }
-/* Returns exitcode of first failed action, or first nonzero return value
- * of post_run_callback. If all actions are successful, returns 0.
- * If no actions were run for the event, returns -1.
- */
-int run_event(struct run_event_state *state, const char *dump_dir_name, const char *event);
-char *list_possible_events(struct dump_dir *dd, const char *dump_dir_name, const char *pfx);
-
#ifdef __cplusplus
}
#endif
diff -x '*.po' -d -urpN abrt.1/src/include/crash_dump.h abrt.2/src/include/crash_dump.h
--- abrt.1/src/include/crash_dump.h 1970-01-01 01:00:00.000000000 +0100
+++ abrt.2/src/include/crash_dump.h 2010-11-26 17:01:52.181197722 +0100
@@ -0,0 +1,72 @@
+/*
+ Copyright (C) 2009 Abrt team.
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#ifndef CRASH_DUMP_H_
+#define CRASH_DUMP_H_
+
+
+// Crash data is a map of 3-element vectors of strings: type, editable, content
+#define CD_TYPE 0
+#define CD_EDITABLE 1
+#define CD_CONTENT 2
+
+// SYS - system value, should not be displayed
+// BIN - binary data
+// TXT - text data, can be displayed
+#define CD_SYS "s"
+#define CD_BIN "b"
+#define CD_TXT "t"
+
+#define CD_ISEDITABLE "y"
+#define CD_ISNOTEDITABLE "n"
+
+struct dump_dir;
+
+#ifdef __cplusplus
+
+#include <map>
+#include <vector>
+#include <string>
+
+/* In-memory crash data structure and accessors */
+
+typedef std::map<std::string, std::vector<std::string> > map_crash_data_t;
+
+void add_to_crash_data_ext(map_crash_data_t& pCrashData,
+ const char *pItem,
+ const char *pType,
+ const char *pEditable,
+ const char *pContent);
+/* Uses type:CD_TXT, editable:CD_ISNOTEDITABLE */
+void add_to_crash_data(map_crash_data_t& pCrashData,
+ const char *pItem,
+ const char *pContent);
+
+const char *get_crash_data_item_content_or_NULL(const map_crash_data_t& crash_data, const char *key);
+/* Aborts if key is not found: */
+const std::string& get_crash_data_item_content(const map_crash_data_t& crash_data, const char *key);
+
+
+/* Conversions between in-memory and on-disk formats */
+
+void load_crash_data_from_crash_dump_dir(struct dump_dir *dd, map_crash_data_t& data);
+struct dump_dir *create_crash_dump_dir(const map_crash_data_t& crash_data);
+
+#endif
+
+#endif
diff -x '*.po' -d -urpN abrt.1/src/include/crash_types.h abrt.2/src/include/crash_types.h
--- abrt.1/src/include/crash_types.h 2010-11-23 15:49:33.000000000 +0100
+++ abrt.2/src/include/crash_types.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,128 +0,0 @@
-/*
- Copyright (C) 2009 Abrt team.
- Copyright (C) 2009 RedHat inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-#ifndef CRASHTYPES_H_
-#define CRASHTYPES_H_
-
-#include "abrt_types.h"
-
-// Keep in sync with CCDump.py:
-
-// Filenames in dump directory:
-// filled by a hook:
-#define FILENAME_ANALYZER "analyzer"
-#define FILENAME_EXECUTABLE "executable"
-#define FILENAME_BINARY "binary"
-#define FILENAME_CMDLINE "cmdline"
-#define FILENAME_REASON "reason"
-#define FILENAME_COREDUMP "coredump"
-#define FILENAME_BACKTRACE "backtrace"
-#define FILENAME_MEMORYMAP "memorymap"
-#define FILENAME_DUPHASH "global_uuid" /* name is compat, to be renamed to "duphash" */
-// Name of the function where the application crashed.
-// Optional.
-#define FILENAME_CRASH_FUNCTION "crash_function"
-// filled by CDebugDump::Create() (which also fills FILENAME_UID):
-#define FILENAME_ARCHITECTURE "architecture"
-#define FILENAME_KERNEL "kernel"
-#define FILENAME_TIME "time"
-#define FILENAME_RELEASE "release" /* from /etc/redhat-release */
-// filled by <what?>
-#define FILENAME_PACKAGE "package"
-#define FILENAME_COMPONENT "component"
-#define FILENAME_DESCRIPTION "description" /* package descr (not crash descr) */
-#define FILENAME_COMMENT "comment"
-#define FILENAME_REPRODUCE "reproduce"
-#define FILENAME_RATING "rating"
-#define FILENAME_HOSTNAME "hostname"
-// Optional. Set to "1" by abrt-handle-upload for every unpacked crashdump
-#define FILENAME_REMOTE "remote"
-#define FILENAME_TAINTED "kernel_tainted"
-// TODO: TicketUploader also has open-coded "TICKET", "CUSTOMER" files
-
-#define FILENAME_UID "uid"
-#define FILENAME_UUID "uuid"
-#define FILENAME_INFORMALL "inform_all_users"
-#define FILENAME_COUNT "count"
-#define FILENAME_MESSAGE "message"
-// Not stored as files, added "on the fly":
-#define CD_DUMPDIR "DumpDir"
-// "Which events are possible (make sense) on this crash dump?"
-// (a string with "\n" terminated event names)
-#define CD_EVENTS "Events"
-
-
-// Crash data is a map of 3-element vectors of strings: type, editable, content
-#define CD_TYPE 0
-#define CD_EDITABLE 1
-#define CD_CONTENT 2
-
-// SYS - system value, should not be displayed
-// BIN - binary data
-// TXT - text data, can be displayed
-#define CD_SYS "s"
-#define CD_BIN "b"
-#define CD_TXT "t"
-// Text bigger than this usually is attached, not added inline
-#define CD_TEXT_ATT_SIZE (2*1024)
-
-#define CD_ISEDITABLE "y"
-#define CD_ISNOTEDITABLE "n"
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern const char *const must_have_files[];
-
-bool is_editable_file(const char *file_name);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#ifdef __cplusplus
-
-// <key, data>
-typedef map_vector_string_t map_crash_data_t;
-typedef std::vector<map_crash_data_t> vector_map_crash_data_t;
-
-void add_to_crash_data_ext(map_crash_data_t& pCrashData,
- const char *pItem,
- const char *pType,
- const char *pEditable,
- const char *pContent);
-// Uses type:CD_TXT, editable:CD_ISNOTEDITABLE
-void add_to_crash_data(map_crash_data_t& pCrashData,
- const char *pItem,
- const char *pContent);
-
-void load_crash_data_from_debug_dump(struct dump_dir *dd, map_crash_data_t& data);
-
-const char *get_crash_data_item_content_or_NULL(const map_crash_data_t& crash_data, const char *key);
-// Aborts if key is not found:
-const std::string& get_crash_data_item_content(const map_crash_data_t& crash_data, const char *key);
-
-void log_map_crash_data(const map_crash_data_t& data, const char *name);
-
-#endif /* __cplusplus */
-
-
-#endif
diff -x '*.po' -d -urpN abrt.1/src/include/dbus_common.h abrt.2/src/include/dbus_common.h
--- abrt.1/src/include/dbus_common.h 2010-11-10 00:12:48.000000000 +0100
+++ abrt.2/src/include/dbus_common.h 2010-11-26 16:00:06.738197107 +0100
@@ -19,7 +19,7 @@
#ifndef DBUSCOMMON_H_
#define DBUSCOMMON_H_
-#include "crash_types.h"
+#include "abrt_crash_dump.h"
#define ABRTD_DBUS_NAME "com.redhat.abrt"
#define ABRTD_DBUS_PATH "/com/redhat/abrt"
diff -x '*.po' -d -urpN abrt.1/src/include/dump_dir.h abrt.2/src/include/dump_dir.h
--- abrt.1/src/include/dump_dir.h 2010-11-18 14:06:35.000000000 +0100
+++ abrt.2/src/include/dump_dir.h 2010-11-26 16:37:20.261196413 +0100
@@ -1,6 +1,5 @@
/*
- DebugDump.h - header file for the library caring of writing new reports
- to the specific directory
+ On-disk storage of crash dumps
Copyright (C) 2009 Zdenek Prikryl (zprikryl(a)redhat.com)
Copyright (C) 2009 RedHat inc.
@@ -19,8 +18,12 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef DEBUGDUMP_H_
-#define DEBUGDUMP_H_
+#ifndef DUMP_DIR_H_
+#define DUMP_DIR_H_
+
+/* For DIR */
+#include <sys/types.h>
+#include <dirent.h>
#ifdef __cplusplus
extern "C" {
@@ -56,7 +59,7 @@ void dd_save_text(struct dump_dir *dd, c
void dd_save_binary(struct dump_dir *dd, const char *name, const char *data, unsigned size);
void dd_delete(struct dump_dir *dd);
-void delete_debug_dump_dir(const char *dd_dir);
+void delete_crash_dump_dir(const char *dd_dir);
#ifdef __cplusplus
}
diff -x '*.po' -d -urpN abrt.1/src/include/Makefile.am abrt.2/src/include/Makefile.am
--- abrt.1/src/include/Makefile.am 2010-11-23 15:49:33.000000000 +0100
+++ abrt.2/src/include/Makefile.am 2010-11-26 16:11:05.912197159 +0100
@@ -1,11 +1,14 @@
HEADER_FILES = \
+ crash_dump.h \
+ dump_dir.h \
+ run_event.h \
+ \
abrt_exception.h \
abrtlib.h \
abrt_types.h \
comm_layer_inner.h \
- crash_types.h \
+ abrt_crash_dump.h \
dbus_common.h \
- dump_dir.h \
observer.h \
plugin.h \
action.h \
diff -x '*.po' -d -urpN abrt.1/src/include/plugin.h abrt.2/src/include/plugin.h
--- abrt.1/src/include/plugin.h 2010-11-26 13:20:34.000000000 +0100
+++ abrt.2/src/include/plugin.h 2010-11-26 16:00:04.323196959 +0100
@@ -23,7 +23,7 @@
#define PLUGIN_H_
#include "abrt_types.h"
-#include "crash_types.h"
+#include "abrt_crash_dump.h"
#define PLUGINS_MAGIC_NUMBER 6
diff -x '*.po' -d -urpN abrt.1/src/include/run_event.h abrt.2/src/include/run_event.h
--- abrt.1/src/include/run_event.h 1970-01-01 01:00:00.000000000 +0100
+++ abrt.2/src/include/run_event.h 2010-11-26 16:15:13.067196740 +0100
@@ -0,0 +1,48 @@
+/*
+ Copyright (C) 2009 Abrt team.
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#ifndef RUN_EVENT_H_
+#define RUN_EVENT_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct dump_dir;
+
+struct run_event_state {
+ int (*post_run_callback)(const char *dump_dir_name, void *param);
+ void *post_run_param;
+ char* (*logging_callback)(char *log_line, void *param);
+ void *logging_param;
+};
+struct run_event_state *new_run_event_state(void);
+void free_run_event_state(struct run_event_state *state);
+
+/* Returns exitcode of first failed action, or first nonzero return value
+ * of post_run_callback. If all actions are successful, returns 0.
+ * If no actions were run for the event, returns -1.
+ */
+int run_event(struct run_event_state *state, const char *dump_dir_name, const char *event);
+char *list_possible_events(struct dump_dir *dd, const char *dump_dir_name, const char *pfx);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff -x '*.po' -d -urpN abrt.1/src/lib/crash_dump.cpp abrt.2/src/lib/crash_dump.cpp
--- abrt.1/src/lib/crash_dump.cpp 1970-01-01 01:00:00.000000000 +0100
+++ abrt.2/src/lib/crash_dump.cpp 2010-11-26 16:18:14.890946826 +0100
@@ -0,0 +1,244 @@
+/*
+ Copyright (C) 2010 Denys Vlasenko (dvlasenk(a)redhat.com)
+ Copyright (C) 2010 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include "abrtlib.h"
+#include "abrt_crash_dump.h"
+
+static const char *const editable_files[] = {
+ FILENAME_DESCRIPTION,
+ FILENAME_COMMENT ,
+ FILENAME_REPRODUCE ,
+ FILENAME_BACKTRACE ,
+ NULL
+};
+
+static bool is_editable(const char *name, const char *const *v)
+{
+ while (*v) {
+ if (strcmp(*v, name) == 0)
+ return true;
+ v++;
+ }
+ return false;
+}
+
+bool is_editable_file(const char *file_name)
+{
+ return is_editable(file_name, editable_files);
+}
+
+
+void add_to_crash_data_ext(map_crash_data_t& pCrashData,
+ const char *pItem,
+ const char *pType,
+ const char *pEditable,
+ const char *pContent)
+{
+ map_crash_data_t::iterator it = pCrashData.find(pItem);
+ if (it == pCrashData.end()) {
+ vector_string_t& v = pCrashData[pItem]; /* create empty vector */
+ v.push_back(pType);
+ v.push_back(pEditable);
+ v.push_back(pContent);
+ return;
+ }
+ vector_string_t& v = it->second;
+ while (v.size() < 3)
+ v.push_back("");
+ v[CD_TYPE] = pType;
+ v[CD_EDITABLE] = pEditable;
+ v[CD_CONTENT] = pContent;
+}
+
+void add_to_crash_data(map_crash_data_t& pCrashData,
+ const char *pItem,
+ const char *pContent)
+{
+ add_to_crash_data_ext(pCrashData, pItem, CD_TXT, CD_ISNOTEDITABLE, pContent);
+}
+
+static char* is_text_file(const char *name, ssize_t *sz)
+{
+ /* We were using magic.h API to check for file being text, but it thinks
+ * that file containing just "0" is not text (!!)
+ * So, we do it ourself.
+ */
+
+ int fd = open(name, O_RDONLY);
+ if (fd < 0)
+ return NULL; /* it's not text (because it does not exist! :) */
+
+ /* Maybe 64k limit is small. But _some_ limit is necessary:
+ * fields declared "text" may end up in editing fields and such.
+ * We don't want to accidentally end up with 100meg text in a textbox!
+ * So, don't remove this. If you really need to, raise the limit.
+ */
+ off_t size = lseek(fd, 0, SEEK_END);
+ if (size < 0 || size > 64*1024)
+ {
+ close(fd);
+ return NULL; /* it's not a SMALL text */
+ }
+ lseek(fd, 0, SEEK_SET);
+
+ char *buf = (char*)xmalloc(*sz);
+ ssize_t r = *sz = full_read(fd, buf, *sz);
+ close(fd);
+ if (r < 0)
+ {
+ free(buf);
+ return NULL; /* it's not text (because we can't read it) */
+ }
+
+ /* Some files in our dump directories are known to always be textual */
+ const char *base = strrchr(name, '/');
+ if (base)
+ {
+ base++;
+ if (strcmp(base, FILENAME_BACKTRACE) == 0
+ || strcmp(base, FILENAME_CMDLINE) == 0
+ ) {
+ return buf;
+ }
+ }
+
+ /* Every once in a while, even a text file contains a few garbled
+ * or unexpected non-ASCII chars. We should not declare it "binary".
+ */
+ const unsigned RATIO = 50;
+ unsigned total_chars = r + RATIO;
+ unsigned bad_chars = 1; /* 1 prevents division by 0 later */
+ while (--r >= 0)
+ {
+ if (buf[r] >= 0x7f
+ /* among control chars, only '\t','\n' etc are allowed */
+ || (buf[r] < ' ' && !isspace(buf[r]))
+ ) {
+ if (buf[r] == '\0')
+ {
+ /* We don't like NULs very much. Not text for sure! */
+ free(buf);
+ return NULL;
+ }
+ bad_chars++;
+ }
+ }
+
+ if ((total_chars / bad_chars) >= RATIO)
+ return buf; /* looks like text to me */
+
+ free(buf);
+ return NULL; /* it's binary */
+}
+
+void load_crash_data_from_crash_dump_dir(struct dump_dir *dd, map_crash_data_t& data)
+{
+ char *short_name;
+ char *full_name;
+
+ dd_init_next_file(dd);
+ while (dd_get_next_file(dd, &short_name, &full_name))
+ {
+ ssize_t sz = 4*1024;
+ char *text = NULL;
+ bool editable = is_editable_file(short_name);
+
+ if (!editable)
+ {
+ text = is_text_file(full_name, &sz);
+ if (!text)
+ {
+ add_to_crash_data_ext(data,
+ short_name,
+ CD_BIN,
+ CD_ISNOTEDITABLE,
+ full_name
+ );
+
+ free(short_name);
+ free(full_name);
+ continue;
+ }
+ }
+
+ char *content;
+ if (sz < 4*1024) /* is_text_file did read entire file */
+ content = xstrndup(text, sz); //TODO: can avoid this copying if is_text_file() adds NUL
+ else /* no, need to read it all */
+ content = dd_load_text(dd, short_name);
+ free(text);
+
+ add_to_crash_data_ext(data,
+ short_name,
+ CD_TXT,
+ editable ? CD_ISEDITABLE : CD_ISNOTEDITABLE,
+ content
+ );
+ free(short_name);
+ free(full_name);
+ free(content);
+ }
+}
+
+static const std::string* helper_get_crash_data_item_content(const map_crash_data_t& crash_data, const char *key)
+{
+ map_crash_data_t::const_iterator it = crash_data.find(key);
+ if (it == crash_data.end()) {
+ return NULL;
+ }
+ if (it->second.size() <= CD_CONTENT) {
+ return NULL;
+ }
+ return &it->second[CD_CONTENT];
+}
+
+const std::string& get_crash_data_item_content(const map_crash_data_t& crash_data, const char *key)
+{
+ const std::string* sp = helper_get_crash_data_item_content(crash_data, key);
+ if (sp == NULL) {
+ if (crash_data.find(key) == crash_data.end())
+ error_msg_and_die("Error accessing crash data: no ['%s']", key);
+ error_msg_and_die("Error accessing crash data: no ['%s'][%d]", key, CD_CONTENT);
+ }
+ return *sp;
+}
+
+const char *get_crash_data_item_content_or_NULL(const map_crash_data_t& crash_data, const char *key)
+{
+ const std::string* sp = helper_get_crash_data_item_content(crash_data, key);
+ if (!sp) {
+ return NULL;
+ }
+ return sp->c_str();
+}
+
+void log_map_crash_data(const map_crash_data_t& data, const char *name)
+{
+ map_crash_data_t::const_iterator it = data.begin();
+ while (it != data.end())
+ {
+ ssize_t sz = it->second.size();
+ log("%s[%s]:%s/%s/'%.20s'",
+ name, it->first.c_str(),
+ sz > 0 ? it->second[0].c_str() : "<NO [0]>",
+ sz > 1 ? it->second[1].c_str() : "<NO [1]>",
+ sz > 2 ? it->second[2].c_str() : "<NO [2]>"
+ );
+ it++;
+ }
+}
diff -x '*.po' -d -urpN abrt.1/src/lib/CrashTypes.cpp abrt.2/src/lib/CrashTypes.cpp
--- abrt.1/src/lib/CrashTypes.cpp 2010-11-10 00:12:48.000000000 +0100
+++ abrt.2/src/lib/CrashTypes.cpp 1970-01-01 01:00:00.000000000 +0100
@@ -1,254 +0,0 @@
-/*
- Copyright (C) 2010 Denys Vlasenko (dvlasenk(a)redhat.com)
- Copyright (C) 2010 RedHat inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-#include "abrtlib.h"
-#include "crash_types.h"
-
-const char *const must_have_files[] = {
- FILENAME_ARCHITECTURE,
- FILENAME_KERNEL ,
- FILENAME_PACKAGE ,
- FILENAME_COMPONENT ,
- FILENAME_RELEASE ,
- FILENAME_EXECUTABLE ,
- NULL
-};
-
-static const char *const editable_files[] = {
- FILENAME_DESCRIPTION,
- FILENAME_COMMENT ,
- FILENAME_REPRODUCE ,
- FILENAME_BACKTRACE ,
- NULL
-};
-
-static bool is_editable(const char *name, const char *const *v)
-{
- while (*v) {
- if (strcmp(*v, name) == 0)
- return true;
- v++;
- }
- return false;
-}
-
-bool is_editable_file(const char *file_name)
-{
- return is_editable(file_name, editable_files);
-}
-
-
-void add_to_crash_data_ext(map_crash_data_t& pCrashData,
- const char *pItem,
- const char *pType,
- const char *pEditable,
- const char *pContent)
-{
- map_crash_data_t::iterator it = pCrashData.find(pItem);
- if (it == pCrashData.end()) {
- vector_string_t& v = pCrashData[pItem]; /* create empty vector */
- v.push_back(pType);
- v.push_back(pEditable);
- v.push_back(pContent);
- return;
- }
- vector_string_t& v = it->second;
- while (v.size() < 3)
- v.push_back("");
- v[CD_TYPE] = pType;
- v[CD_EDITABLE] = pEditable;
- v[CD_CONTENT] = pContent;
-}
-
-void add_to_crash_data(map_crash_data_t& pCrashData,
- const char *pItem,
- const char *pContent)
-{
- add_to_crash_data_ext(pCrashData, pItem, CD_TXT, CD_ISNOTEDITABLE, pContent);
-}
-
-static char* is_text_file(const char *name, ssize_t *sz)
-{
- /* We were using magic.h API to check for file being text, but it thinks
- * that file containing just "0" is not text (!!)
- * So, we do it ourself.
- */
-
- int fd = open(name, O_RDONLY);
- if (fd < 0)
- return NULL; /* it's not text (because it does not exist! :) */
-
- /* Maybe 64k limit is small. But _some_ limit is necessary:
- * fields declared "text" may end up in editing fields and such.
- * We don't want to accidentally end up with 100meg text in a textbox!
- * So, don't remove this. If you really need to, raise the limit.
- */
- off_t size = lseek(fd, 0, SEEK_END);
- if (size < 0 || size > 64*1024)
- {
- close(fd);
- return NULL; /* it's not a SMALL text */
- }
- lseek(fd, 0, SEEK_SET);
-
- char *buf = (char*)xmalloc(*sz);
- ssize_t r = *sz = full_read(fd, buf, *sz);
- close(fd);
- if (r < 0)
- {
- free(buf);
- return NULL; /* it's not text (because we can't read it) */
- }
-
- /* Some files in our dump directories are known to always be textual */
- const char *base = strrchr(name, '/');
- if (base)
- {
- base++;
- if (strcmp(base, FILENAME_BACKTRACE) == 0
- || strcmp(base, FILENAME_CMDLINE) == 0
- ) {
- return buf;
- }
- }
-
- /* Every once in a while, even a text file contains a few garbled
- * or unexpected non-ASCII chars. We should not declare it "binary".
- */
- const unsigned RATIO = 50;
- unsigned total_chars = r + RATIO;
- unsigned bad_chars = 1; /* 1 prevents division by 0 later */
- while (--r >= 0)
- {
- if (buf[r] >= 0x7f
- /* among control chars, only '\t','\n' etc are allowed */
- || (buf[r] < ' ' && !isspace(buf[r]))
- ) {
- if (buf[r] == '\0')
- {
- /* We don't like NULs very much. Not text for sure! */
- free(buf);
- return NULL;
- }
- bad_chars++;
- }
- }
-
- if ((total_chars / bad_chars) >= RATIO)
- return buf; /* looks like text to me */
-
- free(buf);
- return NULL; /* it's binary */
-}
-
-void load_crash_data_from_debug_dump(struct dump_dir *dd, map_crash_data_t& data)
-{
- char *short_name;
- char *full_name;
-
- dd_init_next_file(dd);
- while (dd_get_next_file(dd, &short_name, &full_name))
- {
- ssize_t sz = 4*1024;
- char *text = NULL;
- bool editable = is_editable_file(short_name);
-
- if (!editable)
- {
- text = is_text_file(full_name, &sz);
- if (!text)
- {
- add_to_crash_data_ext(data,
- short_name,
- CD_BIN,
- CD_ISNOTEDITABLE,
- full_name
- );
-
- free(short_name);
- free(full_name);
- continue;
- }
- }
-
- char *content;
- if (sz < 4*1024) /* is_text_file did read entire file */
- content = xstrndup(text, sz); //TODO: can avoid this copying if is_text_file() adds NUL
- else /* no, need to read it all */
- content = dd_load_text(dd, short_name);
- free(text);
-
- add_to_crash_data_ext(data,
- short_name,
- CD_TXT,
- editable ? CD_ISEDITABLE : CD_ISNOTEDITABLE,
- content
- );
- free(short_name);
- free(full_name);
- free(content);
- }
-}
-
-static const std::string* helper_get_crash_data_item_content(const map_crash_data_t& crash_data, const char *key)
-{
- map_crash_data_t::const_iterator it = crash_data.find(key);
- if (it == crash_data.end()) {
- return NULL;
- }
- if (it->second.size() <= CD_CONTENT) {
- return NULL;
- }
- return &it->second[CD_CONTENT];
-}
-
-const std::string& get_crash_data_item_content(const map_crash_data_t& crash_data, const char *key)
-{
- const std::string* sp = helper_get_crash_data_item_content(crash_data, key);
- if (sp == NULL) {
- if (crash_data.find(key) == crash_data.end())
- error_msg_and_die("Error accessing crash data: no ['%s']", key);
- error_msg_and_die("Error accessing crash data: no ['%s'][%d]", key, CD_CONTENT);
- }
- return *sp;
-}
-
-const char *get_crash_data_item_content_or_NULL(const map_crash_data_t& crash_data, const char *key)
-{
- const std::string* sp = helper_get_crash_data_item_content(crash_data, key);
- if (!sp) {
- return NULL;
- }
- return sp->c_str();
-}
-
-void log_map_crash_data(const map_crash_data_t& data, const char *name)
-{
- map_crash_data_t::const_iterator it = data.begin();
- while (it != data.end())
- {
- ssize_t sz = it->second.size();
- log("%s[%s]:%s/%s/'%.20s'",
- name, it->first.c_str(),
- sz > 0 ? it->second[0].c_str() : "<NO [0]>",
- sz > 1 ? it->second[1].c_str() : "<NO [1]>",
- sz > 2 ? it->second[2].c_str() : "<NO [2]>"
- );
- it++;
- }
-}
diff -x '*.po' -d -urpN abrt.1/src/lib/create_crash_dump_dir.cpp abrt.2/src/lib/create_crash_dump_dir.cpp
--- abrt.1/src/lib/create_crash_dump_dir.cpp 1970-01-01 01:00:00.000000000 +0100
+++ abrt.2/src/lib/create_crash_dump_dir.cpp 2010-11-26 17:01:45.235946821 +0100
@@ -0,0 +1,57 @@
+/*
+ Copyright (C) 2010 ABRT team
+ Copyright (C) 2010 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+
+#include "abrtlib.h"
+
+using namespace std;
+
+struct dump_dir *create_crash_dump_dir(const map_crash_data_t& crash_data)
+{
+ char *path = xasprintf(LOCALSTATEDIR"/run/abrt/tmp-%lu-%lu", (long)getpid(), (long)time(NULL));
+ struct dump_dir *dd = dd_create(path, getuid());
+ free(path);
+ if (!dd)
+ return NULL;
+
+ map_crash_data_t::const_iterator its = crash_data.begin();
+ while (its != crash_data.end())
+ {
+ const char *name, *value;
+ name = its->first.c_str();
+
+ if (name[0] == '.' || strchr(name, '/'))
+ {
+ error_msg("Crash data field name contains disallowed chars: '%s'", name);
+ goto next;
+ }
+
+//FIXME: what to do with CD_BINs??
+ /* Fields: CD_TYPE (is CD_SYS, CD_BIN or CD_TXT),
+ * CD_EDITABLE, CD_CONTENT */
+ if (its->second[CD_TYPE] == CD_BIN)
+ goto next;
+
+ value = its->second[CD_CONTENT].c_str();
+ dd_save_text(dd, name, value);
+ next:
+ its++;
+ }
+
+ return dd;
+}
diff -x '*.po' -d -urpN abrt.1/src/lib/dump_dir.c abrt.2/src/lib/dump_dir.c
--- abrt.1/src/lib/dump_dir.c 2010-11-23 15:49:33.000000000 +0100
+++ abrt.2/src/lib/dump_dir.c 2010-11-26 16:37:23.190946261 +0100
@@ -504,7 +504,7 @@ int dd_get_next_file(struct dump_dir *dd
}
/* Utility function */
-void delete_debug_dump_dir(const char *dd_dir)
+void delete_crash_dump_dir(const char *dd_dir)
{
struct dump_dir *dd = dd_opendir(dd_dir, /*flags:*/ 0);
if (dd)
diff -x '*.po' -d -urpN abrt.1/src/lib/hooklib.c abrt.2/src/lib/hooklib.c
--- abrt.1/src/lib/hooklib.c 2010-11-10 00:12:48.000000000 +0100
+++ abrt.2/src/lib/hooklib.c 2010-11-26 16:37:25.956195578 +0100
@@ -132,7 +132,7 @@ void trim_debug_dumps(unsigned setting_M
char *d = concat_path_file(DEBUG_DUMPS_DIR, worst_dir);
free(worst_dir);
worst_dir = NULL;
- delete_debug_dump_dir(d);
+ delete_crash_dump_dir(d);
free(d);
}
}
diff -x '*.po' -d -urpN abrt.1/src/lib/make_descr.cpp abrt.2/src/lib/make_descr.cpp
--- abrt.1/src/lib/make_descr.cpp 2010-11-26 13:20:34.000000000 +0100
+++ abrt.2/src/lib/make_descr.cpp 2010-11-26 15:59:24.770946727 +0100
@@ -17,7 +17,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "abrtlib.h"
-#include "crash_types.h"
+#include "abrt_crash_dump.h"
using namespace std;
diff -x '*.po' -d -urpN abrt.1/src/lib/Makefile.am abrt.2/src/lib/Makefile.am
--- abrt.1/src/lib/Makefile.am 2010-11-26 13:30:48.000000000 +0100
+++ abrt.2/src/lib/Makefile.am 2010-11-26 16:26:59.295196812 +0100
@@ -39,7 +39,8 @@ libabrt_la_SOURCES = \
load_plugin_settings.cpp \
make_descr.cpp \
run_event.c \
- CrashTypes.cpp \
+ crash_dump.cpp \
+ create_crash_dump_dir.cpp \
ABRTException.cpp \
hooklib.c hooklib.h \
parse_release.cpp \
@@ -50,6 +51,7 @@ libabrt_la_CPPFLAGS = \
-DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
-DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \
-DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
+ -DLOCALSTATEDIR='"$(localstatedir)"' \
-DCONF_DIR=\"$(CONF_DIR)\" \
-DVAR_RUN=\"$(VAR_RUN)\" \
$(GLIB_CFLAGS) \
diff -x '*.po' -d -urpN abrt.1/src/lib/run_event.c abrt.2/src/lib/run_event.c
--- abrt.1/src/lib/run_event.c 2010-11-25 13:29:42.000000000 +0100
+++ abrt.2/src/lib/run_event.c 2010-11-26 16:15:40.765196547 +0100
@@ -18,6 +18,16 @@
*/
#include "abrtlib.h"
+struct run_event_state *new_run_event_state()
+{
+ return (struct run_event_state*)xzalloc(sizeof(struct run_event_state));
+}
+
+void free_run_event_state(struct run_event_state *state)
+{
+ free(state);
+}
+
int run_event(struct run_event_state *state,
const char *dump_dir_name,
const char *event
diff -x '*.po' -d -urpN abrt.1/src/plugins/abrt-action-bugzilla.cpp abrt.2/src/plugins/abrt-action-bugzilla.cpp
--- abrt.1/src/plugins/abrt-action-bugzilla.cpp 2010-11-26 13:20:34.000000000 +0100
+++ abrt.2/src/plugins/abrt-action-bugzilla.cpp 2010-11-26 16:01:59.670197039 +0100
@@ -18,7 +18,7 @@
*/
#include "abrtlib.h"
#include "abrt_xmlrpc.h"
-#include "crash_types.h"
+#include "abrt_crash_dump.h"
#include "abrt_exception.h"
#define XML_RPC_SUFFIX "/xmlrpc.cgi"
@@ -645,7 +645,7 @@ static void report_to_bugzilla(
throw CABRTException(EXCEP_PLUGIN, _("Can't open '%s'"), dump_dir_name);
}
map_crash_data_t pCrashData;
- load_crash_data_from_debug_dump(dd, pCrashData);
+ load_crash_data_from_crash_dump_dir(dd, pCrashData);
dd_close(dd);
const char *env;
diff -x '*.po' -d -urpN abrt.1/src/plugins/abrt-action-kerneloops.cpp abrt.2/src/plugins/abrt-action-kerneloops.cpp
--- abrt.1/src/plugins/abrt-action-kerneloops.cpp 2010-11-26 13:20:34.000000000 +0100
+++ abrt.2/src/plugins/abrt-action-kerneloops.cpp 2010-11-26 16:02:07.077946588 +0100
@@ -19,7 +19,7 @@
#include <curl/curl.h>
#include "abrtlib.h"
-#include "crash_types.h"
+#include "abrt_crash_dump.h"
#include "abrt_exception.h"
#define PROGNAME "abrt-action-kerneloops"
@@ -92,7 +92,7 @@ static void report_to_kerneloops(
exit(1); /* error msg is already logged */
map_crash_data_t pCrashData;
- load_crash_data_from_debug_dump(dd, pCrashData);
+ load_crash_data_from_crash_dump_dir(dd, pCrashData);
dd_close(dd);
const char *backtrace = get_crash_data_item_content_or_NULL(pCrashData, FILENAME_BACKTRACE);
diff -x '*.po' -d -urpN abrt.1/src/plugins/abrt-action-mailx.cpp abrt.2/src/plugins/abrt-action-mailx.cpp
--- abrt.1/src/plugins/abrt-action-mailx.cpp 2010-11-26 13:20:34.000000000 +0100
+++ abrt.2/src/plugins/abrt-action-mailx.cpp 2010-11-26 16:02:04.869946597 +0100
@@ -21,7 +21,7 @@
#include "abrtlib.h"
#include "parse_options.h"
-#include "crash_types.h"
+#include "abrt_crash_dump.h"
#include "abrt_exception.h"
#define PROGNAME "abrt-action-mailx"
@@ -67,7 +67,7 @@ static void create_and_send_email(
exit(1); /* error msg is already logged by dd_opendir */
map_crash_data_t pCrashData;
- load_crash_data_from_debug_dump(dd, pCrashData);
+ load_crash_data_from_crash_dump_dir(dd, pCrashData);
dd_close(dd);
char* env;
diff -x '*.po' -d -urpN abrt.1/src/plugins/abrt-action-print.cpp abrt.2/src/plugins/abrt-action-print.cpp
--- abrt.1/src/plugins/abrt-action-print.cpp 2010-11-26 13:20:34.000000000 +0100
+++ abrt.2/src/plugins/abrt-action-print.cpp 2010-11-26 16:02:09.459946487 +0100
@@ -20,7 +20,7 @@
*/
#include "abrtlib.h"
#include "parse_options.h"
-#include "crash_types.h"
+#include "abrt_crash_dump.h"
#include "abrt_exception.h"
#define PROGNAME "abrt-action-print"
@@ -82,7 +82,7 @@ int main(int argc, char **argv)
return 1; /* error message is already logged */
map_crash_data_t pCrashData;
- load_crash_data_from_debug_dump(dd, pCrashData);
+ load_crash_data_from_crash_dump_dir(dd, pCrashData);
dd_close(dd);
char *dsc = make_description_logger(pCrashData);
diff -x '*.po' -d -urpN abrt.1/src/plugins/abrt-action-rhtsupport.cpp abrt.2/src/plugins/abrt-action-rhtsupport.cpp
--- abrt.1/src/plugins/abrt-action-rhtsupport.cpp 2010-11-26 13:20:34.000000000 +0100
+++ abrt.2/src/plugins/abrt-action-rhtsupport.cpp 2010-11-26 16:02:02.533947235 +0100
@@ -22,7 +22,7 @@
#include "abrt_curl.h"
#include "abrt_xmlrpc.h"
#include "abrt_rh_support.h"
-#include "crash_types.h"
+#include "abrt_crash_dump.h"
#include "abrt_exception.h"
#define PROGNAME "abrt-action-rhtsupport"
@@ -36,7 +36,7 @@ static void report_to_rhtsupport(
exit(1); /* error msg is already logged by dd_opendir */
map_crash_data_t pCrashData;
- load_crash_data_from_debug_dump(dd, pCrashData);
+ load_crash_data_from_crash_dump_dir(dd, pCrashData);
dd_close(dd);
/* Gzipping e.g. 0.5gig coredump takes a while. Let client know what we are doing */
diff -x '*.po' -d -urpN abrt.1/src/plugins/abrt-action-upload.cpp abrt.2/src/plugins/abrt-action-upload.cpp
--- abrt.1/src/plugins/abrt-action-upload.cpp 2010-11-26 13:20:34.000000000 +0100
+++ abrt.2/src/plugins/abrt-action-upload.cpp 2010-11-26 15:59:42.707197220 +0100
@@ -21,7 +21,7 @@
#include <curl/curl.h>
#include "abrtlib.h"
#include "parse_options.h"
-#include "crash_types.h"
+#include "abrt_crash_dump.h"
#include "abrt_exception.h"
#define PROGNAME "abrt-action-upload"
13 years, 7 months
[PATCH] reorganize libraries
by Denys Vlasenko
This patch does not change any code per se,
it renames libABRTfoo -> libabrt_bar and moves a few functions around.
After the patch, we are left with the following libs:
libabrt - the stuff shared among most of abrt (like xmalloc, logging)
libabrt_daemon - only daemon-related things are here
(should probably be just moved into daemon - later)
libabrt_dbus - daemon, cli and applet use this
libabrt_web - abrt-action-foo where foo deals with network/web/ftp/...
As a result, we have following reductions in dependent libs:
/usr/libexec/abrt-hook-ccpp:
linux-vdso.so.1 => ()
- libABRTUtils.so.0 => /usr/lib64/libABRTUtils.so.0 ()
+ libabrt.so.0 => /usr/lib64/libabrt.so.0 ()
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 ()
- libdbus-1.so.3 => /lib64/libdbus-1.so.3 ()
- libpthread.so.0 => /lib64/libpthread.so.0 ()
- librt.so.1 => /lib64/librt.so.1 ()
- libdl.so.2 => /lib64/libdl.so.2 ()
/usr/libexec/abrt-action-upload:
linux-vdso.so.1 => ()
libtar.so.1 => /usr/lib64/libtar.so.1 ()
libcurl.so.4 => /usr/lib64/libcurl.so.4 ()
- libABRTdUtils.so.0 => /usr/lib64/libABRTdUtils.so.0 ()
- libABRTUtils.so.0 => /usr/lib64/libABRTUtils.so.0 ()
+ libabrt.so.0 => /usr/lib64/libabrt.so.0 ()
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 ()
- libdbus-1.so.3 => /lib64/libdbus-1.so.3 ()
Similar savings are in almost every abrt-action-foo.
--
vda
diff -x '*.po' -d -urpN abrt.0/src/applet/Makefile.am abrt.1/src/applet/Makefile.am
--- abrt.0/src/applet/Makefile.am 2010-11-15 15:26:40.000000000 +0100
+++ abrt.1/src/applet/Makefile.am 2010-11-25 16:10:50.175689754 +0100
@@ -22,14 +22,13 @@ abrt_applet_CPPFLAGS = \
# $(LIBNOTIFY_CFLAGS)
# $(DBUS_GLIB_CFLAGS)
abrt_applet_LDADD = \
- ../lib/libABRTUtils.la \
+ ../lib/libabrt.la \
+ ../lib/libabrt_dbus.la \
-lglib-2.0 \
-lgthread-2.0 \
$(DBUS_LIBS) \
$(LIBNOTIFY_LIBS) \
$(GTK_LIBS)
-# ../../lib/Utils/libABRTdUtils.la
-# $(DL_LIBS)
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
diff -x '*.po' -d -urpN abrt.0/src/btparser/Makefile.am abrt.1/src/btparser/Makefile.am
--- abrt.0/src/btparser/Makefile.am 2010-11-15 15:27:06.000000000 +0100
+++ abrt.1/src/btparser/Makefile.am 2010-11-25 16:11:27.215689428 +0100
@@ -15,7 +15,7 @@ libbtparser_la_SOURCES = \
utils.h utils.c
libbtparser_la_CFLAGS = -Wall -Werror -D_GNU_SOURCE -I../lib
libbtparser_la_LDFLAGS = -version-info 1:1:0
-libbtparser_la_LIBADD = ../lib/libABRTUtils.la
+libbtparser_la_LIBADD = ../lib/libabrt.la
# From http://www.seul.org/docs/autotut/
# Version consists 3 numbers: CURRENT, REVISION, AGE.
diff -x '*.po' -d -urpN abrt.0/src/cli/Makefile.am abrt.1/src/cli/Makefile.am
--- abrt.0/src/cli/Makefile.am 2010-11-15 15:26:53.000000000 +0100
+++ abrt.1/src/cli/Makefile.am 2010-11-25 16:27:42.437689615 +0100
@@ -16,8 +16,8 @@ abrt_cli_CPPFLAGS = \
# $(GTK_CFLAGS)
abrt_cli_LDADD = \
- ../lib/libABRTUtils.la \
- ../lib/libABRTdUtils.la \
+ ../lib/libabrt.la \
+ ../lib/libabrt_dbus.la \
$(GLIB_LIBS)
man_MANS = abrt-cli.1
diff -x '*.po' -d -urpN abrt.0/src/cli/report.cpp abrt.1/src/cli/report.cpp
--- abrt.0/src/cli/report.cpp 2010-11-23 15:49:41.000000000 +0100
+++ abrt.1/src/cli/report.cpp 2010-11-26 13:03:55.657895296 +0100
@@ -21,7 +21,6 @@
#include "run-command.h"
#include "dbus.h"
#include "abrtlib.h"
-#include "plugin.h" // LoadPluginSettings
/* Field separator for the crash report file that is edited by user. */
#define FIELD_SEP "%----"
@@ -534,7 +533,7 @@ static void get_reporter_plugin_settings
{
map_string_t single_plugin_settings;
std::string path = std::string(homedir) + "/.abrt/"
- + it->first + "."PLUGINS_CONF_EXTENSION;
+ + it->first + ".conf";
/* Load plugin config in the home dir. Do not skip lines with empty value (but containing a "key="),
because user may want to override password from /etc/abrt/plugins/*.conf, but he prefers to
enter it every time he reports. */
diff -x '*.po' -d -urpN abrt.0/src/daemon/Makefile.am abrt.1/src/daemon/Makefile.am
--- abrt.0/src/daemon/Makefile.am 2010-11-23 13:35:00.000000000 +0100
+++ abrt.1/src/daemon/Makefile.am 2010-11-25 16:33:24.152439347 +0100
@@ -36,8 +36,9 @@ abrtd_CPPFLAGS = \
abrtd_LDADD = \
$(DL_LIBS) \
$(DBUS_LIBS) \
- ../lib/libABRTUtils.la \
- ../lib/libABRTdUtils.la
+ ../lib/libabrt.la \
+ ../lib/libabrt_daemon.la \
+ ../lib/libabrt_dbus.la
abrt_server_SOURCES = \
abrt-server.c
@@ -54,7 +55,7 @@ abrt_server_CPPFLAGS = \
-D_GNU_SOURCE \
-Wall -Werror
abrt_server_LDADD = \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_handle_crashdump_SOURCES = \
abrt-handle-crashdump.c
@@ -73,7 +74,7 @@ abrt_handle_crashdump_CPPFLAGS = \
-D_GNU_SOURCE \
-Wall -Werror
abrt_handle_crashdump_LDADD = \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_action_save_package_data_SOURCES = \
rpm.h rpm.c \
@@ -95,8 +96,7 @@ abrt_action_save_package_data_CPPFLAGS =
-Wall -Werror
abrt_action_save_package_data_LDADD = \
$(RPM_LIBS) \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
dbusabrtconfdir = ${sysconfdir}/dbus-1/system.d/
dist_dbusabrtconf_DATA = dbus-abrt.conf
diff -x '*.po' -d -urpN abrt.0/src/daemon/rpm.c abrt.1/src/daemon/rpm.c
--- abrt.0/src/daemon/rpm.c 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/daemon/rpm.c 2010-11-25 16:24:40.294439222 +0100
@@ -26,6 +26,30 @@
static GList *list_fingerprints = NULL;
+/* cuts the name from the NVR format: foo-1.2.3-1.el6
+ returns a newly allocated string
+*/
+char* get_package_name_from_NVR_or_NULL(const char* packageNVR)
+{
+ char* package_name = NULL;
+ if (packageNVR != NULL)
+ {
+ VERB1 log("packageNVR %s", packageNVR);
+ package_name = xstrdup(packageNVR);
+ char *pos = strrchr(package_name, '-');
+ if (pos != NULL)
+ {
+ *pos = 0;
+ pos = strrchr(package_name, '-');
+ if (pos != NULL)
+ {
+ *pos = 0;
+ }
+ }
+ }
+ return package_name;
+}
+
void rpm_init()
{
int status = rpmReadConfigFiles((const char*)NULL, (const char*)NULL);
diff -x '*.po' -d -urpN abrt.0/src/daemon/rpm.h abrt.1/src/daemon/rpm.h
--- abrt.0/src/daemon/rpm.h 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/daemon/rpm.h 2010-11-25 16:24:56.404689348 +0100
@@ -80,6 +80,8 @@ char* rpm_get_package_nvr(const char* fi
*/
char* rpm_get_component(const char* filename);
+char* get_package_name_from_NVR_or_NULL(const char* packageNVR);
+
#ifdef __cplusplus
}
#endif
diff -x '*.po' -d -urpN abrt.0/src/hooks/Makefile.am abrt.1/src/hooks/Makefile.am
--- abrt.0/src/hooks/Makefile.am 2010-11-15 15:27:00.000000000 +0100
+++ abrt.1/src/hooks/Makefile.am 2010-11-25 16:34:25.945689356 +0100
@@ -12,7 +12,7 @@ abrt_hook_ccpp_CPPFLAGS = \
-DVAR_RUN=\"$(VAR_RUN)\" \
-D_GNU_SOURCE
abrt_hook_ccpp_LDADD = \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
# dumpoops
dumpoops_SOURCES = \
@@ -30,7 +30,8 @@ dumpoops_CPPFLAGS = \
-D_GNU_SOURCE
# build will succeed, but at runtime plugins do need ABRT*d*Utils
dumpoops_LDADD = \
- ../lib/libABRTUtils.la \
+ ../lib/libabrt_daemon.la \
+ ../lib/libabrt.la \
$(GLIB_FLAGS)
python_PYTHON = abrt.pth abrt_exception_handler.py
diff -x '*.po' -d -urpN abrt.0/src/include/abrtlib.h abrt.1/src/include/abrtlib.h
--- abrt.0/src/include/abrtlib.h 2010-11-15 16:58:12.000000000 +0100
+++ abrt.1/src/include/abrtlib.h 2010-11-25 16:06:37.132439142 +0100
@@ -80,7 +80,6 @@ int vdprintf(int d, const char *format,
#include "crash_types.h"
#include "dump_dir.h"
#include "abrt_types.h"
-#include "abrt_packages.h"
#ifdef __cplusplus
@@ -254,6 +253,27 @@ std::string to_string(T x)
void parse_args(const char *psArgs, vector_string_t& pArgs, int quote = -1);
void parse_release(const char *pRelease, char **product, char **version);
+char* make_description_bz(const map_crash_data_t& pCrashData);
+char* make_description_reproduce_comment(const map_crash_data_t& pCrashData);
+char* make_description_logger(const map_crash_data_t& pCrashData);
+char* make_description_mailx(const map_crash_data_t& pCrashData);
+
+/**
+ * Loads settings and stores it in second parameter. On success it
+ * returns true, otherwise returns false.
+ *
+ * @param path A path of config file.
+ * Config file consists of "key=value" lines.
+ * @param settings A readed plugin's settings.
+ * @param skipKeysWithoutValue
+ * If true, lines in format "key=" (without value) are skipped.
+ * Otherwise empty value "" is inserted into pSettings.
+ * @return if it success it returns true, otherwise it returns false.
+ */
+extern bool LoadPluginSettings(const char *pPath,
+ map_plugin_settings_t& pSettings,
+ bool skipKeysWithoutValue = true);
+
// TODO: npajkovs: full rewrite ssprintf -> xasprintf
static inline std::string ssprintf(const char *format, ...)
{
diff -x '*.po' -d -urpN abrt.0/src/include/plugin.h abrt.1/src/include/plugin.h
--- abrt.0/src/include/plugin.h 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/include/plugin.h 2010-11-25 15:34:16.636439338 +0100
@@ -110,26 +110,4 @@ typedef struct SPluginInfo
PLUGINS_MAGIC_NUMBER,\
};
-/* helper functions */
-char* make_description_bz(const map_crash_data_t& pCrashData);
-char* make_description_reproduce_comment(const map_crash_data_t& pCrashData);
-char* make_description_logger(const map_crash_data_t& pCrashData);
-char* make_dsc_mailx(const map_crash_data_t& pCrashData);
-
-/**
- * Loads settings and stores it in second parameter. On success it
- * returns true, otherwise returns false.
- *
- * @param path A path of config file.
- * Config file consists of "key=value" lines.
- * @param settings A readed plugin's settings.
- * @param skipKeysWithoutValue
- * If true, lines in format "key=" (without value) are skipped.
- * Otherwise empty value "" is inserted into pSettings.
- * @return if it success it returns true, otherwise it returns false.
- */
-extern bool LoadPluginSettings(const char *pPath,
- map_plugin_settings_t& pSettings,
- bool skipKeysWithoutValue = true);
-
#endif
diff -x '*.po' -d -urpN abrt.0/src/lib/abrt_packages.c abrt.1/src/lib/abrt_packages.c
--- abrt.0/src/lib/abrt_packages.c 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/lib/abrt_packages.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,43 +0,0 @@
-/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 RedHat Inc
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-#include "abrtlib.h"
-
-/* cuts the name from the NVR format: foo-1.2.3-1.el6
- returns a newly allocated string
-*/
-char* get_package_name_from_NVR_or_NULL(const char* packageNVR)
-{
- char* package_name = NULL;
- if (packageNVR != NULL)
- {
- VERB1 log("packageNVR %s", packageNVR);
- package_name = xstrdup(packageNVR);
- char *pos = strrchr(package_name, '-');
- if (pos != NULL)
- {
- *pos = 0;
- pos = strrchr(package_name, '-');
- if (pos != NULL)
- {
- *pos = 0;
- }
- }
- }
- return package_name;
-}
diff -x '*.po' -d -urpN abrt.0/src/lib/abrt_packages.h abrt.1/src/lib/abrt_packages.h
--- abrt.0/src/lib/abrt_packages.h 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/lib/abrt_packages.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,33 +0,0 @@
-/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 RedHat Inc
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#ifndef ABRT_PACKAGES_H
-#define ABRT_PACKAGES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-char* get_package_name_from_NVR_or_NULL(const char* packageNVR);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff -x '*.po' -d -urpN abrt.0/src/lib/daemon.c abrt.1/src/lib/daemon.c
--- abrt.0/src/lib/daemon.c 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/lib/daemon.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,139 +0,0 @@
-/*
- Copyright (C) 2009 RedHat inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-#include "abrtlib.h"
-
-#define VAR_RUN_PID_FILE VAR_RUN"/abrtd.pid"
-
-static char *append_escaped(char *start, const char *s)
-{
- char hex_char_buf[] = "\\x00";
-
- *start++ = ' ';
- char *dst = start;
- const unsigned char *p = (unsigned char *)s;
-
- while (1)
- {
- const unsigned char *old_p = p;
- while (*p > ' ' && *p <= 0x7e && *p != '\"' && *p != '\'' && *p != '\\')
- p++;
- if (dst == start)
- {
- if (p != (unsigned char *)s && *p == '\0')
- {
- /* entire word does not need escaping and quoting */
- strcpy(dst, s);
- dst += strlen(s);
- return dst;
- }
- *dst++ = '\'';
- }
-
- strncpy(dst, (char *)old_p, (p - old_p));
- dst += (p - old_p);
-
- if (*p == '\0')
- {
- *dst++ = '\'';
- *dst = '\0';
- return dst;
- }
- const char *a;
- switch (*p)
- {
- case '\r': a = "\\r"; break;
- case '\n': a = "\\n"; break;
- case '\t': a = "\\t"; break;
- case '\'': a = "\\\'"; break;
- case '\"': a = "\\\""; break;
- case '\\': a = "\\\\"; break;
- case ' ': a = " "; break;
- default:
- hex_char_buf[2] = "0123456789abcdef"[*p >> 4];
- hex_char_buf[3] = "0123456789abcdef"[*p & 0xf];
- a = hex_char_buf;
- }
- strcpy(dst, a);
- dst += strlen(a);
- p++;
- }
-}
-
-// taken from kernel
-#define COMMAND_LINE_SIZE 2048
-char* get_cmdline(pid_t pid)
-{
- char path[sizeof("/proc/%lu/cmdline") + sizeof(long)*3];
- char cmdline[COMMAND_LINE_SIZE];
- char escaped_cmdline[COMMAND_LINE_SIZE*4 + 4];
-
- escaped_cmdline[1] = '\0';
- sprintf(path, "/proc/%lu/cmdline", (long)pid);
- int fd = open(path, O_RDONLY);
- if (fd >= 0)
- {
- int len = read(fd, cmdline, sizeof(cmdline) - 1);
- close(fd);
-
- if (len > 0)
- {
- cmdline[len] = '\0';
- char *src = cmdline;
- char *dst = escaped_cmdline;
- while ((src - cmdline) < len)
- {
- dst = append_escaped(dst, src);
- src += strlen(src) + 1;
- }
- }
- }
-
- return xstrdup(escaped_cmdline + 1); /* +1 skips extraneous leading space */
-}
-
-int daemon_is_ok()
-{
- int fd = open(VAR_RUN_PID_FILE, O_RDONLY);
- if (fd < 0)
- {
- return 0;
- }
-
- char pid[sizeof(pid_t)*3 + 2];
- int len = read(fd, pid, sizeof(pid)-1);
- close(fd);
- if (len <= 0)
- return 0;
-
- pid[len] = '\0';
- *strchrnul(pid, '\n') = '\0';
- /* paranoia: we don't want to check /proc//stat or /proc///stat */
- if (pid[0] == '\0' || pid[0] == '/')
- return 0;
-
- /* TODO: maybe readlink and check that it is "xxx/abrt"? */
- char path[sizeof("/proc/%s/stat") + sizeof(pid)];
- sprintf(path, "/proc/%s/stat", pid);
- struct stat sb;
- if (stat(path, &sb) == -1)
- {
- return 0;
- }
-
- return 1;
-}
diff -x '*.po' -d -urpN abrt.0/src/lib/daemon_is_ok.c abrt.1/src/lib/daemon_is_ok.c
--- abrt.0/src/lib/daemon_is_ok.c 1970-01-01 01:00:00.000000000 +0100
+++ abrt.1/src/lib/daemon_is_ok.c 2010-11-25 15:57:16.895689296 +0100
@@ -0,0 +1,51 @@
+/*
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include "abrtlib.h"
+
+int daemon_is_ok()
+{
+ int fd = open(VAR_RUN"/abrtd.pid", O_RDONLY);
+ if (fd < 0)
+ {
+ return 0;
+ }
+
+ char pid[sizeof(pid_t)*3 + 2];
+ int len = read(fd, pid, sizeof(pid)-1);
+ close(fd);
+ if (len <= 0)
+ return 0;
+
+ pid[len] = '\0';
+ *strchrnul(pid, '\n') = '\0';
+ /* paranoia: we don't want to check /proc//stat or /proc///stat */
+ if (pid[0] == '\0' || pid[0] == '/')
+ return 0;
+
+ char path[sizeof("/proc/%s/stat") + sizeof(pid)];
+ sprintf(path, "/proc/%s/stat", pid);
+ struct stat sb;
+ if (stat(path, &sb) == -1)
+ {
+ return 0;
+ }
+
+ /* TODO: maybe readlink /proc/PID/exe and check that it is "xxx/abrt"? */
+
+ return 1;
+}
diff -x '*.po' -d -urpN abrt.0/src/lib/get_cmdline.c abrt.1/src/lib/get_cmdline.c
--- abrt.0/src/lib/get_cmdline.c 1970-01-01 01:00:00.000000000 +0100
+++ abrt.1/src/lib/get_cmdline.c 2010-11-25 15:56:11.184689452 +0100
@@ -0,0 +1,105 @@
+/*
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include "abrtlib.h"
+
+static char *append_escaped(char *start, const char *s)
+{
+ char hex_char_buf[] = "\\x00";
+
+ *start++ = ' ';
+ char *dst = start;
+ const unsigned char *p = (unsigned char *)s;
+
+ while (1)
+ {
+ const unsigned char *old_p = p;
+ while (*p > ' ' && *p <= 0x7e && *p != '\"' && *p != '\'' && *p != '\\')
+ p++;
+ if (dst == start)
+ {
+ if (p != (unsigned char *)s && *p == '\0')
+ {
+ /* entire word does not need escaping and quoting */
+ strcpy(dst, s);
+ dst += strlen(s);
+ return dst;
+ }
+ *dst++ = '\'';
+ }
+
+ strncpy(dst, (char *)old_p, (p - old_p));
+ dst += (p - old_p);
+
+ if (*p == '\0')
+ {
+ *dst++ = '\'';
+ *dst = '\0';
+ return dst;
+ }
+ const char *a;
+ switch (*p)
+ {
+ case '\r': a = "\\r"; break;
+ case '\n': a = "\\n"; break;
+ case '\t': a = "\\t"; break;
+ case '\'': a = "\\\'"; break;
+ case '\"': a = "\\\""; break;
+ case '\\': a = "\\\\"; break;
+ case ' ': a = " "; break;
+ default:
+ hex_char_buf[2] = "0123456789abcdef"[*p >> 4];
+ hex_char_buf[3] = "0123456789abcdef"[*p & 0xf];
+ a = hex_char_buf;
+ }
+ strcpy(dst, a);
+ dst += strlen(a);
+ p++;
+ }
+}
+
+// taken from kernel
+#define COMMAND_LINE_SIZE 2048
+char* get_cmdline(pid_t pid)
+{
+ char path[sizeof("/proc/%lu/cmdline") + sizeof(long)*3];
+ char cmdline[COMMAND_LINE_SIZE];
+ char escaped_cmdline[COMMAND_LINE_SIZE*4 + 4];
+
+ escaped_cmdline[1] = '\0';
+ sprintf(path, "/proc/%lu/cmdline", (long)pid);
+ int fd = open(path, O_RDONLY);
+ if (fd >= 0)
+ {
+ int len = read(fd, cmdline, sizeof(cmdline) - 1);
+ close(fd);
+
+ if (len > 0)
+ {
+ cmdline[len] = '\0';
+ char *src = cmdline;
+ char *dst = escaped_cmdline;
+ while ((src - cmdline) < len)
+ {
+ dst = append_escaped(dst, src);
+ src += strlen(src) + 1;
+ }
+ }
+ }
+
+ return xstrdup(escaped_cmdline + 1); /* +1 skips extraneous leading space */
+}
diff -x '*.po' -d -urpN abrt.0/src/lib/load_plugin_settings.cpp abrt.1/src/lib/load_plugin_settings.cpp
--- abrt.0/src/lib/load_plugin_settings.cpp 1970-01-01 01:00:00.000000000 +0100
+++ abrt.1/src/lib/load_plugin_settings.cpp 2010-11-25 15:33:15.964439263 +0100
@@ -0,0 +1,94 @@
+/*
+ Copyright (C) 2009 Zdenek Prikryl (zprikryl(a)redhat.com)
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include "abrtlib.h"
+
+bool LoadPluginSettings(const char *pPath, map_plugin_settings_t& pSettings,
+ bool skipKeysWithoutValue /*= true*/)
+{
+ FILE *fp = stdin;
+ if (strcmp(pPath, "-") != 0)
+ {
+ fp = fopen(pPath, "r");
+ if (!fp)
+ return false;
+ }
+
+ char *line;
+ while ((line = xmalloc_fgetline(fp)) != NULL)
+ {
+ unsigned ii;
+ bool is_value = false;
+ bool valid = false;
+ bool in_quote = false;
+ std::string key;
+ std::string value;
+ for (ii = 0; line[ii] != '\0'; ii++)
+ {
+ if (line[ii] == '"')
+ {
+ in_quote = !in_quote;
+ }
+ if (isspace(line[ii]) && !in_quote)
+ {
+ continue;
+ }
+ if (line[ii] == '#' && !in_quote && key == "")
+ {
+ break;
+ }
+ if (line[ii] == '=' && !in_quote)
+ {
+ is_value = true;
+ valid = true;
+ continue;
+ }
+ if (!is_value)
+ {
+ key += line[ii];
+ }
+ else
+ {
+ value += line[ii];
+ }
+ }
+
+ /* Skip broken or empty lines. */
+ if (!valid)
+ goto free_line;
+
+ /* Skip lines with empty key. */
+ if (key.length() == 0)
+ goto free_line;
+
+ if (skipKeysWithoutValue && value.length() == 0)
+ goto free_line;
+
+ /* Skip lines with unclosed quotes. */
+ if (in_quote)
+ goto free_line;
+
+ pSettings[key] = value;
+ free_line:
+ free(line);
+ }
+
+ if (fp != stdin)
+ fclose(fp);
+ return true;
+}
diff -x '*.po' -d -urpN abrt.0/src/lib/make_descr.cpp abrt.1/src/lib/make_descr.cpp
--- abrt.0/src/lib/make_descr.cpp 2010-11-23 15:49:33.000000000 +0100
+++ abrt.1/src/lib/make_descr.cpp 2010-11-25 15:37:35.249689879 +0100
@@ -75,7 +75,7 @@ static const char *const blacklisted_ite
NULL
};
-char* make_dsc_mailx(const map_crash_data_t & crash_data)
+char* make_description_mailx(const map_crash_data_t & crash_data)
{
struct strbuf *buf_dsc = strbuf_new();
struct strbuf *buf_additional_files = strbuf_new();
diff -x '*.po' -d -urpN abrt.0/src/lib/Makefile.am abrt.1/src/lib/Makefile.am
--- abrt.0/src/lib/Makefile.am 2010-11-23 15:49:33.000000000 +0100
+++ abrt.1/src/lib/Makefile.am 2010-11-25 16:34:05.961439309 +0100
@@ -1,10 +1,13 @@
-# ABRTUtils has small set of deps. This reduces deps of smaller abrt binaries
-# ABRTdUtils has much more. It is used by daemon and plugins only
-# ABRT_web_utils is used only by some abrt-action-foo programs, not by daemon
+# libabrt - the stuff shared among most of abrt (like xmalloc, logging)
+# libabrt_daemon - only daemon/server/dbus related things are here
+# libabrt_dbus - daemon, cli and applet use this
+# libabrt_web - abrt-action-foo where foo deals with network/web/ftp/...
lib_LTLIBRARIES = \
- libABRTUtils.la \
- libABRTdUtils.la \
- libABRT_web_utils.la
+ libabrt.la \
+ libabrt_daemon.la \
+ libabrt_dbus.la \
+ libabrt_web.la
+
HEADER_DIR = $(srcdir)/../include
AM_CPPFLAGS = -I$(HEADER_DIR)
@@ -12,11 +15,8 @@ AM_CPPFLAGS = -I$(HEADER_DIR)
# time.cpp
# xconnect.cpp
-libABRTUtils_la_SOURCES = \
+libabrt_la_SOURCES = \
xfuncs.c \
- concat_path_file.c \
- append_to_malloced_string.c \
- overlapping_strcpy.c \
encbase64.c \
stdio_helpers.c \
hash_md5.c hash_md5.h \
@@ -24,22 +24,44 @@ libABRTUtils_la_SOURCES = \
read_write.c read_write.h \
logging.c logging.h \
copyfd.c \
- daemon.c \
+ concat_path_file.c \
+ append_to_malloced_string.c \
+ overlapping_strcpy.c \
skip_whitespace.c \
+ stringops.cpp \
+ strbuf.c strbuf.h \
xatonum.c numtoa.cpp \
spawn.c \
- stringops.cpp \
dirsize.c \
dump_dir.c \
- strbuf.c strbuf.h \
- abrt_dbus.c abrt_dbus.h \
+ get_cmdline.c \
+ daemon_is_ok.c \
+ load_plugin_settings.cpp \
+ make_descr.cpp \
+ run_event.c \
CrashTypes.cpp \
ABRTException.cpp \
- run_event.c \
- abrt_packages.c abrt_packages.h \
hooklib.c hooklib.h \
+ parse_release.cpp \
parse_options.c parse_options.h
-libABRTUtils_la_CPPFLAGS = \
+libabrt_la_CPPFLAGS = \
+ -Wall -Werror \
+ -I$(srcdir)/../include \
+ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
+ -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \
+ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
+ -DCONF_DIR=\"$(CONF_DIR)\" \
+ -DVAR_RUN=\"$(VAR_RUN)\" \
+ $(GLIB_CFLAGS) \
+ -D_GNU_SOURCE
+libabrt_la_LDFLAGS = \
+ -version-info 0:1:0
+libabrt_la_LIBADD = \
+ $(GLIB_LIBS)
+
+libabrt_dbus_la_SOURCES = \
+ abrt_dbus.c abrt_dbus.h
+libabrt_dbus_la_CPPFLAGS = \
-Wall -Werror \
-I$(srcdir)/../include \
-DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
@@ -50,19 +72,16 @@ libABRTUtils_la_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(DBUS_CFLAGS) \
-D_GNU_SOURCE
-libABRTUtils_la_LDFLAGS = \
+libabrt_dbus_la_LDFLAGS = \
-version-info 0:1:0
-libABRTUtils_la_LIBADD = \
+libabrt_dbus_la_LIBADD = \
$(GLIB_LIBS) \
- $(DBUS_LIBS) \
- -ldl
+ $(DBUS_LIBS)
-libABRTdUtils_la_SOURCES = \
- parse_release.cpp \
- make_descr.cpp \
+libabrt_daemon_la_SOURCES = \
$(HEADER_DIR)/comm_layer_inner.h CommLayerInner.cpp \
$(HEADER_DIR)/plugin.h Plugin.cpp
-libABRTdUtils_la_CPPFLAGS = \
+libabrt_daemon_la_CPPFLAGS = \
-Wall \
-I$(srcdir)/../include \
-DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
@@ -71,15 +90,15 @@ libABRTdUtils_la_CPPFLAGS = \
-DCONF_DIR=\"$(CONF_DIR)\" \
-DVAR_RUN=\"$(VAR_RUN)\" \
-D_GNU_SOURCE
-libABRTdUtils_la_LDFLAGS = \
+libabrt_daemon_la_LDFLAGS = \
-version-info 0:1:0
-libABRTdUtils_la_LIBADD = \
+libabrt_daemon_la_LIBADD = \
-ldl
-libABRT_web_utils_la_SOURCES = \
+libabrt_web_la_SOURCES = \
abrt_curl.h abrt_curl.c \
abrt_xmlrpc.h abrt_xmlrpc.cpp
-libABRT_web_utils_la_CPPFLAGS = \
+libabrt_web_la_CPPFLAGS = \
-Wall -Werror \
-I$(srcdir)/../include \
-DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
@@ -91,9 +110,9 @@ libABRT_web_utils_la_CPPFLAGS = \
$(LIBXML_CFLAGS) \
$(XMLRPC_CFLAGS) $(XMLRPC_CLIENT_CFLAGS) \
-D_GNU_SOURCE
-libABRT_web_utils_la_LDFLAGS = \
+libabrt_web_la_LDFLAGS = \
-version-info 0:1:0
-libABRT_web_utils_la_LIBADD = \
+libabrt_web_la_LIBADD = \
$(CURL_LIBS) \
$(LIBXML_LIBS) \
$(XMLRPC_LIBS) $(XMLRPC_CLIENT_LIBS)
diff -x '*.po' -d -urpN abrt.0/src/lib/Plugin.cpp abrt.1/src/lib/Plugin.cpp
--- abrt.0/src/lib/Plugin.cpp 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/lib/Plugin.cpp 2010-11-25 15:33:05.595439713 +0100
@@ -39,78 +39,3 @@ void CPlugin::SetSettings(const map_plug
}
}
}
-
-bool LoadPluginSettings(const char *pPath, map_plugin_settings_t& pSettings,
- bool skipKeysWithoutValue /*= true*/)
-{
- FILE *fp = stdin;
- if (strcmp(pPath, "-") != 0)
- {
- fp = fopen(pPath, "r");
- if (!fp)
- return false;
- }
-
- char *line;
- while ((line = xmalloc_fgetline(fp)) != NULL)
- {
- unsigned ii;
- bool is_value = false;
- bool valid = false;
- bool in_quote = false;
- std::string key;
- std::string value;
- for (ii = 0; line[ii] != '\0'; ii++)
- {
- if (line[ii] == '"')
- {
- in_quote = !in_quote;
- }
- if (isspace(line[ii]) && !in_quote)
- {
- continue;
- }
- if (line[ii] == '#' && !in_quote && key == "")
- {
- break;
- }
- if (line[ii] == '=' && !in_quote)
- {
- is_value = true;
- valid = true;
- continue;
- }
- if (!is_value)
- {
- key += line[ii];
- }
- else
- {
- value += line[ii];
- }
- }
-
- /* Skip broken or empty lines. */
- if (!valid)
- goto free_line;
-
- /* Skip lines with empty key. */
- if (key.length() == 0)
- goto free_line;
-
- if (skipKeysWithoutValue && value.length() == 0)
- goto free_line;
-
- /* Skip lines with unclosed quotes. */
- if (in_quote)
- goto free_line;
-
- pSettings[key] = value;
- free_line:
- free(line);
- }
-
- if (fp != stdin)
- fclose(fp);
- return true;
-}
diff -x '*.po' -d -urpN abrt.0/src/plugins/abrt-action-bugzilla.cpp abrt.1/src/plugins/abrt-action-bugzilla.cpp
--- abrt.0/src/plugins/abrt-action-bugzilla.cpp 2010-11-25 13:29:39.000000000 +0100
+++ abrt.1/src/plugins/abrt-action-bugzilla.cpp 2010-11-26 13:04:35.127894443 +0100
@@ -21,8 +21,6 @@
#include "crash_types.h"
#include "abrt_exception.h"
-#include "plugin.h" /* make_description_bz */
-
#define XML_RPC_SUFFIX "/xmlrpc.cgi"
#define MAX_HOPS 5
diff -x '*.po' -d -urpN abrt.0/src/plugins/abrt-action-kerneloops.cpp abrt.1/src/plugins/abrt-action-kerneloops.cpp
--- abrt.0/src/plugins/abrt-action-kerneloops.cpp 2010-11-11 09:27:28.000000000 +0100
+++ abrt.1/src/plugins/abrt-action-kerneloops.cpp 2010-11-26 13:04:13.082895364 +0100
@@ -22,8 +22,6 @@
#include "crash_types.h"
#include "abrt_exception.h"
-#include "plugin.h" /* LoadPluginSettings */
-
#define PROGNAME "abrt-action-kerneloops"
/* helpers */
diff -x '*.po' -d -urpN abrt.0/src/plugins/abrt-action-mailx.cpp abrt.1/src/plugins/abrt-action-mailx.cpp
--- abrt.0/src/plugins/abrt-action-mailx.cpp 2010-11-23 15:49:33.000000000 +0100
+++ abrt.1/src/plugins/abrt-action-mailx.cpp 2010-11-26 13:04:17.003895786 +0100
@@ -24,9 +24,6 @@
#include "crash_types.h"
#include "abrt_exception.h"
-#include "plugin.h" /* LoadPluginSettings */
-
-
#define PROGNAME "abrt-action-mailx"
static void exec_and_feed_input(uid_t uid, const char* text, char **args)
@@ -93,7 +90,7 @@ static void create_and_send_email(
unsigned arg_size = 0;
args = append_str_to_vector(args, arg_size, "/bin/mailx");
- char *dsc = make_dsc_mailx(pCrashData);
+ char *dsc = make_description_mailx(pCrashData);
if (send_binary_data)
{
diff -x '*.po' -d -urpN abrt.0/src/plugins/abrt-action-print.cpp abrt.1/src/plugins/abrt-action-print.cpp
--- abrt.0/src/plugins/abrt-action-print.cpp 2010-11-11 09:27:28.000000000 +0100
+++ abrt.1/src/plugins/abrt-action-print.cpp 2010-11-26 13:04:05.146895113 +0100
@@ -22,7 +22,6 @@
#include "parse_options.h"
#include "crash_types.h"
#include "abrt_exception.h"
-#include "plugin.h" /* make_description_logger */
#define PROGNAME "abrt-action-print"
diff -x '*.po' -d -urpN abrt.0/src/plugins/abrt-action-rhtsupport.cpp abrt.1/src/plugins/abrt-action-rhtsupport.cpp
--- abrt.0/src/plugins/abrt-action-rhtsupport.cpp 2010-11-23 15:49:33.000000000 +0100
+++ abrt.1/src/plugins/abrt-action-rhtsupport.cpp 2010-11-26 13:04:25.418644902 +0100
@@ -25,9 +25,6 @@
#include "crash_types.h"
#include "abrt_exception.h"
-#include "plugin.h" /* make_description_bz */
-
-
#define PROGNAME "abrt-action-rhtsupport"
static void report_to_rhtsupport(
diff -x '*.po' -d -urpN abrt.0/src/plugins/abrt-action-upload.cpp abrt.1/src/plugins/abrt-action-upload.cpp
--- abrt.0/src/plugins/abrt-action-upload.cpp 2010-11-23 15:49:33.000000000 +0100
+++ abrt.1/src/plugins/abrt-action-upload.cpp 2010-11-26 13:04:09.114644864 +0100
@@ -24,9 +24,6 @@
#include "crash_types.h"
#include "abrt_exception.h"
-#include "plugin.h" /* LoadPluginSettings */
-
-
#define PROGNAME "abrt-action-upload"
//TODO: use this for better logging
diff -x '*.po' -d -urpN abrt.0/src/plugins/Makefile.am abrt.1/src/plugins/Makefile.am
--- abrt.0/src/plugins/Makefile.am 2010-11-23 15:49:33.000000000 +0100
+++ abrt.1/src/plugins/Makefile.am 2010-11-25 16:14:39.409689455 +0100
@@ -90,7 +90,7 @@ abrt_action_analyze_c_CPPFLAGS = \
-D_GNU_SOURCE \
-Wall -Werror
abrt_action_analyze_c_LDADD = \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_action_analyze_python_SOURCES = \
abrt-action-analyze-python.c
@@ -108,7 +108,7 @@ abrt_action_analyze_python_CPPFLAGS = \
-D_GNU_SOURCE \
-Wall -Werror
abrt_action_analyze_python_LDADD = \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_action_analyze_oops_SOURCES = \
abrt-action-analyze-oops.c
@@ -126,7 +126,7 @@ abrt_action_analyze_oops_CPPFLAGS = \
-D_GNU_SOURCE \
-Wall -Werror
abrt_action_analyze_oops_LDADD = \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_action_generate_backtrace_SOURCES = \
abrt-action-generate-backtrace.c
@@ -144,7 +144,7 @@ abrt_action_generate_backtrace_CPPFLAGS
-D_GNU_SOURCE \
-Wall -Werror
abrt_action_generate_backtrace_LDADD = \
- ../lib/libABRTUtils.la \
+ ../lib/libabrt.la \
../btparser/libbtparser.la
abrt_action_bugzilla_SOURCES = \
@@ -165,9 +165,8 @@ abrt_action_bugzilla_CPPFLAGS = \
-Wall -Werror
abrt_action_bugzilla_LDADD = \
$(GLIB_LIBS) \
- ../lib/libABRT_web_utils.la \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt_web.la \
+ ../lib/libabrt.la
abrt_action_rhtsupport_SOURCES = \
abrt_rh_support.h abrt_rh_support.c \
@@ -191,9 +190,8 @@ abrt_action_rhtsupport_LDFLAGS = -ltar
abrt_action_rhtsupport_LDADD = \
$(GLIB_LIBS) \
$(XMLRPC_LIBS) $(XMLRPC_CLIENT_LIBS) \
- ../lib/libABRT_web_utils.la \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt_web.la \
+ ../lib/libabrt.la
abrt_action_upload_SOURCES = \
abrt-action-upload.cpp
@@ -217,8 +215,7 @@ abrt_action_upload_LDFLAGS = -ltar
abrt_action_upload_LDADD = \
$(GLIB_LIBS) \
$(CURL_LIBS) \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_action_kerneloops_SOURCES = \
abrt-action-kerneloops.cpp
@@ -238,9 +235,8 @@ abrt_action_kerneloops_CPPFLAGS = \
-Wall -Werror
# libABRTdUtils is used only because of LoadPluginSettings:
abrt_action_kerneloops_LDADD = \
- ../lib/libABRT_web_utils.la \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt_web.la \
+ ../lib/libabrt.la
abrt_action_mailx_SOURCES = \
abrt-action-mailx.cpp
@@ -259,8 +255,7 @@ abrt_action_mailx_CPPFLAGS = \
-D_GNU_SOURCE \
-Wall -Werror
abrt_action_mailx_LDADD = \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_action_print_SOURCES = \
abrt-action-print.cpp
@@ -280,7 +275,6 @@ abrt_action_print_CPPFLAGS = \
-Wall -Werror
# libABRTdUtils is used only because of make_description_logger:
abrt_action_print_LDADD = \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
13 years, 7 months
applet_gtk.c:173:5: error: too many arguments to function ‘notify_notification_new’
by Michal Nowak
Current HEAD fails for me on rawhide:
[...]
gcc -DLOCALEDIR=\"/usr/local/share/locale\" -DHAVE_CONFIG_H -I. -I../.. -Wall -Werror -I./../include -I./../lib -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DBIN_DIR=\"/usr/local/bin\" -DVAR_RUN=\"/usr/local/var/run\" -DCONF_DIR=\"/usr/local/etc/abrt\" -DDEBUG_DUMPS_DIR=\"/usr/local/var/spool/abrt\" -DPLUGINS_LIB_DIR=\"/usr/local/lib/abrt\" -DPLUGINS_CONF_DIR=\"/usr/local/etc/abrt/plugins\" -DICON_DIR=\"/usr/local/share/abrt/icons/hicolor/48x48/status\" -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -D_GNU_SOURCE -g -O2 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -std=gnu99 -Wall -MT abrt_applet-applet_gtk.o -MD -MP -MF .deps/abrt_applet-applet_gtk.Tpo -c -o abrt_applet-applet_gtk.o `test -f 'applet_gtk.c' || echo './'`applet_gtk.c
applet_gtk.c: In function ‘new_warn_notification’:
applet_gtk.c:173:5: error: too many arguments to function ‘notify_notification_new’
/usr/include/libnotify/notification.h:79:21: note: declared here
make[3]: *** [abrt_applet-applet_gtk.o] Error 1
libnotify-0.7.0-1.fc15.x86_64
Michal
13 years, 7 months
[PATCH] reorganize libraries
by Denys Vlasenko
This patch does not change any code per se,
it renames libABRTfoo -> libabrt_bar and moves a few functions around.
After the patch, we are left with the following libs:
libabrt - the stuff shared among most of abrt (like xmalloc, logging)
libabrt_daemon - only daemon-related things are here
(should probably be just moved into daemon - later)
libabrt_dbus - daemon, cli and applet use this
libabrt_web - abrt-action-foo where foo deals with network/web/ftp/...
As a result, we have following reductions in dependent libs:
/usr/libexec/abrt-hook-ccpp:
linux-vdso.so.1 => ()
- libABRTUtils.so.0 => /usr/lib64/libABRTUtils.so.0 ()
+ libabrt.so.0 => /usr/lib64/libabrt.so.0 ()
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 ()
- libdbus-1.so.3 => /lib64/libdbus-1.so.3 ()
- libpthread.so.0 => /lib64/libpthread.so.0 ()
- librt.so.1 => /lib64/librt.so.1 ()
- libdl.so.2 => /lib64/libdl.so.2 ()
/usr/libexec/abrt-action-upload:
linux-vdso.so.1 => ()
libtar.so.1 => /usr/lib64/libtar.so.1 ()
libcurl.so.4 => /usr/lib64/libcurl.so.4 ()
- libABRTdUtils.so.0 => /usr/lib64/libABRTdUtils.so.0 ()
- libABRTUtils.so.0 => /usr/lib64/libABRTUtils.so.0 ()
+ libabrt.so.0 => /usr/lib64/libabrt.so.0 ()
libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 ()
- libdbus-1.so.3 => /lib64/libdbus-1.so.3 ()
Similar savings are in almost every abrt-action-foo.
--
vda
diff -x '*.po' -d -urpN abrt.0/src/applet/Makefile.am abrt.1/src/applet/Makefile.am
--- abrt.0/src/applet/Makefile.am 2010-11-15 15:26:40.000000000 +0100
+++ abrt.1/src/applet/Makefile.am 2010-11-25 16:10:50.175689754 +0100
@@ -22,14 +22,13 @@ abrt_applet_CPPFLAGS = \
# $(LIBNOTIFY_CFLAGS)
# $(DBUS_GLIB_CFLAGS)
abrt_applet_LDADD = \
- ../lib/libABRTUtils.la \
+ ../lib/libabrt.la \
+ ../lib/libabrt_dbus.la \
-lglib-2.0 \
-lgthread-2.0 \
$(DBUS_LIBS) \
$(LIBNOTIFY_LIBS) \
$(GTK_LIBS)
-# ../../lib/Utils/libABRTdUtils.la
-# $(DL_LIBS)
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
diff -x '*.po' -d -urpN abrt.0/src/btparser/Makefile.am abrt.1/src/btparser/Makefile.am
--- abrt.0/src/btparser/Makefile.am 2010-11-15 15:27:06.000000000 +0100
+++ abrt.1/src/btparser/Makefile.am 2010-11-25 16:11:27.215689428 +0100
@@ -15,7 +15,7 @@ libbtparser_la_SOURCES = \
utils.h utils.c
libbtparser_la_CFLAGS = -Wall -Werror -D_GNU_SOURCE -I../lib
libbtparser_la_LDFLAGS = -version-info 1:1:0
-libbtparser_la_LIBADD = ../lib/libABRTUtils.la
+libbtparser_la_LIBADD = ../lib/libabrt.la
# From http://www.seul.org/docs/autotut/
# Version consists 3 numbers: CURRENT, REVISION, AGE.
diff -x '*.po' -d -urpN abrt.0/src/cli/Makefile.am abrt.1/src/cli/Makefile.am
--- abrt.0/src/cli/Makefile.am 2010-11-15 15:26:53.000000000 +0100
+++ abrt.1/src/cli/Makefile.am 2010-11-25 16:27:42.437689615 +0100
@@ -16,8 +16,8 @@ abrt_cli_CPPFLAGS = \
# $(GTK_CFLAGS)
abrt_cli_LDADD = \
- ../lib/libABRTUtils.la \
- ../lib/libABRTdUtils.la \
+ ../lib/libabrt.la \
+ ../lib/libabrt_dbus.la \
$(GLIB_LIBS)
man_MANS = abrt-cli.1
diff -x '*.po' -d -urpN abrt.0/src/cli/report.cpp abrt.1/src/cli/report.cpp
--- abrt.0/src/cli/report.cpp 2010-11-23 15:49:41.000000000 +0100
+++ abrt.1/src/cli/report.cpp 2010-11-26 13:03:55.657895296 +0100
@@ -21,7 +21,6 @@
#include "run-command.h"
#include "dbus.h"
#include "abrtlib.h"
-#include "plugin.h" // LoadPluginSettings
/* Field separator for the crash report file that is edited by user. */
#define FIELD_SEP "%----"
@@ -534,7 +533,7 @@ static void get_reporter_plugin_settings
{
map_string_t single_plugin_settings;
std::string path = std::string(homedir) + "/.abrt/"
- + it->first + "."PLUGINS_CONF_EXTENSION;
+ + it->first + ".conf";
/* Load plugin config in the home dir. Do not skip lines with empty value (but containing a "key="),
because user may want to override password from /etc/abrt/plugins/*.conf, but he prefers to
enter it every time he reports. */
diff -x '*.po' -d -urpN abrt.0/src/daemon/Makefile.am abrt.1/src/daemon/Makefile.am
--- abrt.0/src/daemon/Makefile.am 2010-11-23 13:35:00.000000000 +0100
+++ abrt.1/src/daemon/Makefile.am 2010-11-25 16:33:24.152439347 +0100
@@ -36,8 +36,9 @@ abrtd_CPPFLAGS = \
abrtd_LDADD = \
$(DL_LIBS) \
$(DBUS_LIBS) \
- ../lib/libABRTUtils.la \
- ../lib/libABRTdUtils.la
+ ../lib/libabrt.la \
+ ../lib/libabrt_daemon.la \
+ ../lib/libabrt_dbus.la
abrt_server_SOURCES = \
abrt-server.c
@@ -54,7 +55,7 @@ abrt_server_CPPFLAGS = \
-D_GNU_SOURCE \
-Wall -Werror
abrt_server_LDADD = \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_handle_crashdump_SOURCES = \
abrt-handle-crashdump.c
@@ -73,7 +74,7 @@ abrt_handle_crashdump_CPPFLAGS = \
-D_GNU_SOURCE \
-Wall -Werror
abrt_handle_crashdump_LDADD = \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_action_save_package_data_SOURCES = \
rpm.h rpm.c \
@@ -95,8 +96,7 @@ abrt_action_save_package_data_CPPFLAGS =
-Wall -Werror
abrt_action_save_package_data_LDADD = \
$(RPM_LIBS) \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
dbusabrtconfdir = ${sysconfdir}/dbus-1/system.d/
dist_dbusabrtconf_DATA = dbus-abrt.conf
diff -x '*.po' -d -urpN abrt.0/src/daemon/rpm.c abrt.1/src/daemon/rpm.c
--- abrt.0/src/daemon/rpm.c 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/daemon/rpm.c 2010-11-25 16:24:40.294439222 +0100
@@ -26,6 +26,30 @@
static GList *list_fingerprints = NULL;
+/* cuts the name from the NVR format: foo-1.2.3-1.el6
+ returns a newly allocated string
+*/
+char* get_package_name_from_NVR_or_NULL(const char* packageNVR)
+{
+ char* package_name = NULL;
+ if (packageNVR != NULL)
+ {
+ VERB1 log("packageNVR %s", packageNVR);
+ package_name = xstrdup(packageNVR);
+ char *pos = strrchr(package_name, '-');
+ if (pos != NULL)
+ {
+ *pos = 0;
+ pos = strrchr(package_name, '-');
+ if (pos != NULL)
+ {
+ *pos = 0;
+ }
+ }
+ }
+ return package_name;
+}
+
void rpm_init()
{
int status = rpmReadConfigFiles((const char*)NULL, (const char*)NULL);
diff -x '*.po' -d -urpN abrt.0/src/daemon/rpm.h abrt.1/src/daemon/rpm.h
--- abrt.0/src/daemon/rpm.h 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/daemon/rpm.h 2010-11-25 16:24:56.404689348 +0100
@@ -80,6 +80,8 @@ char* rpm_get_package_nvr(const char* fi
*/
char* rpm_get_component(const char* filename);
+char* get_package_name_from_NVR_or_NULL(const char* packageNVR);
+
#ifdef __cplusplus
}
#endif
diff -x '*.po' -d -urpN abrt.0/src/hooks/Makefile.am abrt.1/src/hooks/Makefile.am
--- abrt.0/src/hooks/Makefile.am 2010-11-15 15:27:00.000000000 +0100
+++ abrt.1/src/hooks/Makefile.am 2010-11-25 16:34:25.945689356 +0100
@@ -12,7 +12,7 @@ abrt_hook_ccpp_CPPFLAGS = \
-DVAR_RUN=\"$(VAR_RUN)\" \
-D_GNU_SOURCE
abrt_hook_ccpp_LDADD = \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
# dumpoops
dumpoops_SOURCES = \
@@ -30,7 +30,8 @@ dumpoops_CPPFLAGS = \
-D_GNU_SOURCE
# build will succeed, but at runtime plugins do need ABRT*d*Utils
dumpoops_LDADD = \
- ../lib/libABRTUtils.la \
+ ../lib/libabrt_daemon.la \
+ ../lib/libabrt.la \
$(GLIB_FLAGS)
python_PYTHON = abrt.pth abrt_exception_handler.py
diff -x '*.po' -d -urpN abrt.0/src/include/abrtlib.h abrt.1/src/include/abrtlib.h
--- abrt.0/src/include/abrtlib.h 2010-11-15 16:58:12.000000000 +0100
+++ abrt.1/src/include/abrtlib.h 2010-11-25 16:06:37.132439142 +0100
@@ -80,7 +80,6 @@ int vdprintf(int d, const char *format,
#include "crash_types.h"
#include "dump_dir.h"
#include "abrt_types.h"
-#include "abrt_packages.h"
#ifdef __cplusplus
@@ -254,6 +253,27 @@ std::string to_string(T x)
void parse_args(const char *psArgs, vector_string_t& pArgs, int quote = -1);
void parse_release(const char *pRelease, char **product, char **version);
+char* make_description_bz(const map_crash_data_t& pCrashData);
+char* make_description_reproduce_comment(const map_crash_data_t& pCrashData);
+char* make_description_logger(const map_crash_data_t& pCrashData);
+char* make_description_mailx(const map_crash_data_t& pCrashData);
+
+/**
+ * Loads settings and stores it in second parameter. On success it
+ * returns true, otherwise returns false.
+ *
+ * @param path A path of config file.
+ * Config file consists of "key=value" lines.
+ * @param settings A readed plugin's settings.
+ * @param skipKeysWithoutValue
+ * If true, lines in format "key=" (without value) are skipped.
+ * Otherwise empty value "" is inserted into pSettings.
+ * @return if it success it returns true, otherwise it returns false.
+ */
+extern bool LoadPluginSettings(const char *pPath,
+ map_plugin_settings_t& pSettings,
+ bool skipKeysWithoutValue = true);
+
// TODO: npajkovs: full rewrite ssprintf -> xasprintf
static inline std::string ssprintf(const char *format, ...)
{
diff -x '*.po' -d -urpN abrt.0/src/include/plugin.h abrt.1/src/include/plugin.h
--- abrt.0/src/include/plugin.h 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/include/plugin.h 2010-11-25 15:34:16.636439338 +0100
@@ -110,26 +110,4 @@ typedef struct SPluginInfo
PLUGINS_MAGIC_NUMBER,\
};
-/* helper functions */
-char* make_description_bz(const map_crash_data_t& pCrashData);
-char* make_description_reproduce_comment(const map_crash_data_t& pCrashData);
-char* make_description_logger(const map_crash_data_t& pCrashData);
-char* make_dsc_mailx(const map_crash_data_t& pCrashData);
-
-/**
- * Loads settings and stores it in second parameter. On success it
- * returns true, otherwise returns false.
- *
- * @param path A path of config file.
- * Config file consists of "key=value" lines.
- * @param settings A readed plugin's settings.
- * @param skipKeysWithoutValue
- * If true, lines in format "key=" (without value) are skipped.
- * Otherwise empty value "" is inserted into pSettings.
- * @return if it success it returns true, otherwise it returns false.
- */
-extern bool LoadPluginSettings(const char *pPath,
- map_plugin_settings_t& pSettings,
- bool skipKeysWithoutValue = true);
-
#endif
diff -x '*.po' -d -urpN abrt.0/src/lib/abrt_packages.c abrt.1/src/lib/abrt_packages.c
--- abrt.0/src/lib/abrt_packages.c 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/lib/abrt_packages.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,43 +0,0 @@
-/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 RedHat Inc
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-#include "abrtlib.h"
-
-/* cuts the name from the NVR format: foo-1.2.3-1.el6
- returns a newly allocated string
-*/
-char* get_package_name_from_NVR_or_NULL(const char* packageNVR)
-{
- char* package_name = NULL;
- if (packageNVR != NULL)
- {
- VERB1 log("packageNVR %s", packageNVR);
- package_name = xstrdup(packageNVR);
- char *pos = strrchr(package_name, '-');
- if (pos != NULL)
- {
- *pos = 0;
- pos = strrchr(package_name, '-');
- if (pos != NULL)
- {
- *pos = 0;
- }
- }
- }
- return package_name;
-}
diff -x '*.po' -d -urpN abrt.0/src/lib/abrt_packages.h abrt.1/src/lib/abrt_packages.h
--- abrt.0/src/lib/abrt_packages.h 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/lib/abrt_packages.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,33 +0,0 @@
-/*
- Copyright (C) 2010 ABRT team
- Copyright (C) 2010 RedHat Inc
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-
-#ifndef ABRT_PACKAGES_H
-#define ABRT_PACKAGES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-char* get_package_name_from_NVR_or_NULL(const char* packageNVR);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff -x '*.po' -d -urpN abrt.0/src/lib/daemon.c abrt.1/src/lib/daemon.c
--- abrt.0/src/lib/daemon.c 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/lib/daemon.c 1970-01-01 01:00:00.000000000 +0100
@@ -1,139 +0,0 @@
-/*
- Copyright (C) 2009 RedHat inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-*/
-#include "abrtlib.h"
-
-#define VAR_RUN_PID_FILE VAR_RUN"/abrtd.pid"
-
-static char *append_escaped(char *start, const char *s)
-{
- char hex_char_buf[] = "\\x00";
-
- *start++ = ' ';
- char *dst = start;
- const unsigned char *p = (unsigned char *)s;
-
- while (1)
- {
- const unsigned char *old_p = p;
- while (*p > ' ' && *p <= 0x7e && *p != '\"' && *p != '\'' && *p != '\\')
- p++;
- if (dst == start)
- {
- if (p != (unsigned char *)s && *p == '\0')
- {
- /* entire word does not need escaping and quoting */
- strcpy(dst, s);
- dst += strlen(s);
- return dst;
- }
- *dst++ = '\'';
- }
-
- strncpy(dst, (char *)old_p, (p - old_p));
- dst += (p - old_p);
-
- if (*p == '\0')
- {
- *dst++ = '\'';
- *dst = '\0';
- return dst;
- }
- const char *a;
- switch (*p)
- {
- case '\r': a = "\\r"; break;
- case '\n': a = "\\n"; break;
- case '\t': a = "\\t"; break;
- case '\'': a = "\\\'"; break;
- case '\"': a = "\\\""; break;
- case '\\': a = "\\\\"; break;
- case ' ': a = " "; break;
- default:
- hex_char_buf[2] = "0123456789abcdef"[*p >> 4];
- hex_char_buf[3] = "0123456789abcdef"[*p & 0xf];
- a = hex_char_buf;
- }
- strcpy(dst, a);
- dst += strlen(a);
- p++;
- }
-}
-
-// taken from kernel
-#define COMMAND_LINE_SIZE 2048
-char* get_cmdline(pid_t pid)
-{
- char path[sizeof("/proc/%lu/cmdline") + sizeof(long)*3];
- char cmdline[COMMAND_LINE_SIZE];
- char escaped_cmdline[COMMAND_LINE_SIZE*4 + 4];
-
- escaped_cmdline[1] = '\0';
- sprintf(path, "/proc/%lu/cmdline", (long)pid);
- int fd = open(path, O_RDONLY);
- if (fd >= 0)
- {
- int len = read(fd, cmdline, sizeof(cmdline) - 1);
- close(fd);
-
- if (len > 0)
- {
- cmdline[len] = '\0';
- char *src = cmdline;
- char *dst = escaped_cmdline;
- while ((src - cmdline) < len)
- {
- dst = append_escaped(dst, src);
- src += strlen(src) + 1;
- }
- }
- }
-
- return xstrdup(escaped_cmdline + 1); /* +1 skips extraneous leading space */
-}
-
-int daemon_is_ok()
-{
- int fd = open(VAR_RUN_PID_FILE, O_RDONLY);
- if (fd < 0)
- {
- return 0;
- }
-
- char pid[sizeof(pid_t)*3 + 2];
- int len = read(fd, pid, sizeof(pid)-1);
- close(fd);
- if (len <= 0)
- return 0;
-
- pid[len] = '\0';
- *strchrnul(pid, '\n') = '\0';
- /* paranoia: we don't want to check /proc//stat or /proc///stat */
- if (pid[0] == '\0' || pid[0] == '/')
- return 0;
-
- /* TODO: maybe readlink and check that it is "xxx/abrt"? */
- char path[sizeof("/proc/%s/stat") + sizeof(pid)];
- sprintf(path, "/proc/%s/stat", pid);
- struct stat sb;
- if (stat(path, &sb) == -1)
- {
- return 0;
- }
-
- return 1;
-}
diff -x '*.po' -d -urpN abrt.0/src/lib/daemon_is_ok.c abrt.1/src/lib/daemon_is_ok.c
--- abrt.0/src/lib/daemon_is_ok.c 1970-01-01 01:00:00.000000000 +0100
+++ abrt.1/src/lib/daemon_is_ok.c 2010-11-25 15:57:16.895689296 +0100
@@ -0,0 +1,51 @@
+/*
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include "abrtlib.h"
+
+int daemon_is_ok()
+{
+ int fd = open(VAR_RUN"/abrtd.pid", O_RDONLY);
+ if (fd < 0)
+ {
+ return 0;
+ }
+
+ char pid[sizeof(pid_t)*3 + 2];
+ int len = read(fd, pid, sizeof(pid)-1);
+ close(fd);
+ if (len <= 0)
+ return 0;
+
+ pid[len] = '\0';
+ *strchrnul(pid, '\n') = '\0';
+ /* paranoia: we don't want to check /proc//stat or /proc///stat */
+ if (pid[0] == '\0' || pid[0] == '/')
+ return 0;
+
+ char path[sizeof("/proc/%s/stat") + sizeof(pid)];
+ sprintf(path, "/proc/%s/stat", pid);
+ struct stat sb;
+ if (stat(path, &sb) == -1)
+ {
+ return 0;
+ }
+
+ /* TODO: maybe readlink /proc/PID/exe and check that it is "xxx/abrt"? */
+
+ return 1;
+}
diff -x '*.po' -d -urpN abrt.0/src/lib/get_cmdline.c abrt.1/src/lib/get_cmdline.c
--- abrt.0/src/lib/get_cmdline.c 1970-01-01 01:00:00.000000000 +0100
+++ abrt.1/src/lib/get_cmdline.c 2010-11-25 15:56:11.184689452 +0100
@@ -0,0 +1,105 @@
+/*
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include "abrtlib.h"
+
+static char *append_escaped(char *start, const char *s)
+{
+ char hex_char_buf[] = "\\x00";
+
+ *start++ = ' ';
+ char *dst = start;
+ const unsigned char *p = (unsigned char *)s;
+
+ while (1)
+ {
+ const unsigned char *old_p = p;
+ while (*p > ' ' && *p <= 0x7e && *p != '\"' && *p != '\'' && *p != '\\')
+ p++;
+ if (dst == start)
+ {
+ if (p != (unsigned char *)s && *p == '\0')
+ {
+ /* entire word does not need escaping and quoting */
+ strcpy(dst, s);
+ dst += strlen(s);
+ return dst;
+ }
+ *dst++ = '\'';
+ }
+
+ strncpy(dst, (char *)old_p, (p - old_p));
+ dst += (p - old_p);
+
+ if (*p == '\0')
+ {
+ *dst++ = '\'';
+ *dst = '\0';
+ return dst;
+ }
+ const char *a;
+ switch (*p)
+ {
+ case '\r': a = "\\r"; break;
+ case '\n': a = "\\n"; break;
+ case '\t': a = "\\t"; break;
+ case '\'': a = "\\\'"; break;
+ case '\"': a = "\\\""; break;
+ case '\\': a = "\\\\"; break;
+ case ' ': a = " "; break;
+ default:
+ hex_char_buf[2] = "0123456789abcdef"[*p >> 4];
+ hex_char_buf[3] = "0123456789abcdef"[*p & 0xf];
+ a = hex_char_buf;
+ }
+ strcpy(dst, a);
+ dst += strlen(a);
+ p++;
+ }
+}
+
+// taken from kernel
+#define COMMAND_LINE_SIZE 2048
+char* get_cmdline(pid_t pid)
+{
+ char path[sizeof("/proc/%lu/cmdline") + sizeof(long)*3];
+ char cmdline[COMMAND_LINE_SIZE];
+ char escaped_cmdline[COMMAND_LINE_SIZE*4 + 4];
+
+ escaped_cmdline[1] = '\0';
+ sprintf(path, "/proc/%lu/cmdline", (long)pid);
+ int fd = open(path, O_RDONLY);
+ if (fd >= 0)
+ {
+ int len = read(fd, cmdline, sizeof(cmdline) - 1);
+ close(fd);
+
+ if (len > 0)
+ {
+ cmdline[len] = '\0';
+ char *src = cmdline;
+ char *dst = escaped_cmdline;
+ while ((src - cmdline) < len)
+ {
+ dst = append_escaped(dst, src);
+ src += strlen(src) + 1;
+ }
+ }
+ }
+
+ return xstrdup(escaped_cmdline + 1); /* +1 skips extraneous leading space */
+}
diff -x '*.po' -d -urpN abrt.0/src/lib/load_plugin_settings.cpp abrt.1/src/lib/load_plugin_settings.cpp
--- abrt.0/src/lib/load_plugin_settings.cpp 1970-01-01 01:00:00.000000000 +0100
+++ abrt.1/src/lib/load_plugin_settings.cpp 2010-11-25 15:33:15.964439263 +0100
@@ -0,0 +1,94 @@
+/*
+ Copyright (C) 2009 Zdenek Prikryl (zprikryl(a)redhat.com)
+ Copyright (C) 2009 RedHat inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+*/
+#include "abrtlib.h"
+
+bool LoadPluginSettings(const char *pPath, map_plugin_settings_t& pSettings,
+ bool skipKeysWithoutValue /*= true*/)
+{
+ FILE *fp = stdin;
+ if (strcmp(pPath, "-") != 0)
+ {
+ fp = fopen(pPath, "r");
+ if (!fp)
+ return false;
+ }
+
+ char *line;
+ while ((line = xmalloc_fgetline(fp)) != NULL)
+ {
+ unsigned ii;
+ bool is_value = false;
+ bool valid = false;
+ bool in_quote = false;
+ std::string key;
+ std::string value;
+ for (ii = 0; line[ii] != '\0'; ii++)
+ {
+ if (line[ii] == '"')
+ {
+ in_quote = !in_quote;
+ }
+ if (isspace(line[ii]) && !in_quote)
+ {
+ continue;
+ }
+ if (line[ii] == '#' && !in_quote && key == "")
+ {
+ break;
+ }
+ if (line[ii] == '=' && !in_quote)
+ {
+ is_value = true;
+ valid = true;
+ continue;
+ }
+ if (!is_value)
+ {
+ key += line[ii];
+ }
+ else
+ {
+ value += line[ii];
+ }
+ }
+
+ /* Skip broken or empty lines. */
+ if (!valid)
+ goto free_line;
+
+ /* Skip lines with empty key. */
+ if (key.length() == 0)
+ goto free_line;
+
+ if (skipKeysWithoutValue && value.length() == 0)
+ goto free_line;
+
+ /* Skip lines with unclosed quotes. */
+ if (in_quote)
+ goto free_line;
+
+ pSettings[key] = value;
+ free_line:
+ free(line);
+ }
+
+ if (fp != stdin)
+ fclose(fp);
+ return true;
+}
diff -x '*.po' -d -urpN abrt.0/src/lib/make_descr.cpp abrt.1/src/lib/make_descr.cpp
--- abrt.0/src/lib/make_descr.cpp 2010-11-23 15:49:33.000000000 +0100
+++ abrt.1/src/lib/make_descr.cpp 2010-11-25 15:37:35.249689879 +0100
@@ -75,7 +75,7 @@ static const char *const blacklisted_ite
NULL
};
-char* make_dsc_mailx(const map_crash_data_t & crash_data)
+char* make_description_mailx(const map_crash_data_t & crash_data)
{
struct strbuf *buf_dsc = strbuf_new();
struct strbuf *buf_additional_files = strbuf_new();
diff -x '*.po' -d -urpN abrt.0/src/lib/Makefile.am abrt.1/src/lib/Makefile.am
--- abrt.0/src/lib/Makefile.am 2010-11-23 15:49:33.000000000 +0100
+++ abrt.1/src/lib/Makefile.am 2010-11-25 16:34:05.961439309 +0100
@@ -1,10 +1,13 @@
-# ABRTUtils has small set of deps. This reduces deps of smaller abrt binaries
-# ABRTdUtils has much more. It is used by daemon and plugins only
-# ABRT_web_utils is used only by some abrt-action-foo programs, not by daemon
+# libabrt - the stuff shared among most of abrt (like xmalloc, logging)
+# libabrt_daemon - only daemon/server/dbus related things are here
+# libabrt_dbus - daemon, cli and applet use this
+# libabrt_web - abrt-action-foo where foo deals with network/web/ftp/...
lib_LTLIBRARIES = \
- libABRTUtils.la \
- libABRTdUtils.la \
- libABRT_web_utils.la
+ libabrt.la \
+ libabrt_daemon.la \
+ libabrt_dbus.la \
+ libabrt_web.la
+
HEADER_DIR = $(srcdir)/../include
AM_CPPFLAGS = -I$(HEADER_DIR)
@@ -12,11 +15,8 @@ AM_CPPFLAGS = -I$(HEADER_DIR)
# time.cpp
# xconnect.cpp
-libABRTUtils_la_SOURCES = \
+libabrt_la_SOURCES = \
xfuncs.c \
- concat_path_file.c \
- append_to_malloced_string.c \
- overlapping_strcpy.c \
encbase64.c \
stdio_helpers.c \
hash_md5.c hash_md5.h \
@@ -24,22 +24,44 @@ libABRTUtils_la_SOURCES = \
read_write.c read_write.h \
logging.c logging.h \
copyfd.c \
- daemon.c \
+ concat_path_file.c \
+ append_to_malloced_string.c \
+ overlapping_strcpy.c \
skip_whitespace.c \
+ stringops.cpp \
+ strbuf.c strbuf.h \
xatonum.c numtoa.cpp \
spawn.c \
- stringops.cpp \
dirsize.c \
dump_dir.c \
- strbuf.c strbuf.h \
- abrt_dbus.c abrt_dbus.h \
+ get_cmdline.c \
+ daemon_is_ok.c \
+ load_plugin_settings.cpp \
+ make_descr.cpp \
+ run_event.c \
CrashTypes.cpp \
ABRTException.cpp \
- run_event.c \
- abrt_packages.c abrt_packages.h \
hooklib.c hooklib.h \
+ parse_release.cpp \
parse_options.c parse_options.h
-libABRTUtils_la_CPPFLAGS = \
+libabrt_la_CPPFLAGS = \
+ -Wall -Werror \
+ -I$(srcdir)/../include \
+ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
+ -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \
+ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \
+ -DCONF_DIR=\"$(CONF_DIR)\" \
+ -DVAR_RUN=\"$(VAR_RUN)\" \
+ $(GLIB_CFLAGS) \
+ -D_GNU_SOURCE
+libabrt_la_LDFLAGS = \
+ -version-info 0:1:0
+libabrt_la_LIBADD = \
+ $(GLIB_LIBS)
+
+libabrt_dbus_la_SOURCES = \
+ abrt_dbus.c abrt_dbus.h
+libabrt_dbus_la_CPPFLAGS = \
-Wall -Werror \
-I$(srcdir)/../include \
-DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
@@ -50,19 +72,16 @@ libABRTUtils_la_CPPFLAGS = \
$(GLIB_CFLAGS) \
$(DBUS_CFLAGS) \
-D_GNU_SOURCE
-libABRTUtils_la_LDFLAGS = \
+libabrt_dbus_la_LDFLAGS = \
-version-info 0:1:0
-libABRTUtils_la_LIBADD = \
+libabrt_dbus_la_LIBADD = \
$(GLIB_LIBS) \
- $(DBUS_LIBS) \
- -ldl
+ $(DBUS_LIBS)
-libABRTdUtils_la_SOURCES = \
- parse_release.cpp \
- make_descr.cpp \
+libabrt_daemon_la_SOURCES = \
$(HEADER_DIR)/comm_layer_inner.h CommLayerInner.cpp \
$(HEADER_DIR)/plugin.h Plugin.cpp
-libABRTdUtils_la_CPPFLAGS = \
+libabrt_daemon_la_CPPFLAGS = \
-Wall \
-I$(srcdir)/../include \
-DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
@@ -71,15 +90,15 @@ libABRTdUtils_la_CPPFLAGS = \
-DCONF_DIR=\"$(CONF_DIR)\" \
-DVAR_RUN=\"$(VAR_RUN)\" \
-D_GNU_SOURCE
-libABRTdUtils_la_LDFLAGS = \
+libabrt_daemon_la_LDFLAGS = \
-version-info 0:1:0
-libABRTdUtils_la_LIBADD = \
+libabrt_daemon_la_LIBADD = \
-ldl
-libABRT_web_utils_la_SOURCES = \
+libabrt_web_la_SOURCES = \
abrt_curl.h abrt_curl.c \
abrt_xmlrpc.h abrt_xmlrpc.cpp
-libABRT_web_utils_la_CPPFLAGS = \
+libabrt_web_la_CPPFLAGS = \
-Wall -Werror \
-I$(srcdir)/../include \
-DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \
@@ -91,9 +110,9 @@ libABRT_web_utils_la_CPPFLAGS = \
$(LIBXML_CFLAGS) \
$(XMLRPC_CFLAGS) $(XMLRPC_CLIENT_CFLAGS) \
-D_GNU_SOURCE
-libABRT_web_utils_la_LDFLAGS = \
+libabrt_web_la_LDFLAGS = \
-version-info 0:1:0
-libABRT_web_utils_la_LIBADD = \
+libabrt_web_la_LIBADD = \
$(CURL_LIBS) \
$(LIBXML_LIBS) \
$(XMLRPC_LIBS) $(XMLRPC_CLIENT_LIBS)
diff -x '*.po' -d -urpN abrt.0/src/lib/Plugin.cpp abrt.1/src/lib/Plugin.cpp
--- abrt.0/src/lib/Plugin.cpp 2010-11-10 00:12:48.000000000 +0100
+++ abrt.1/src/lib/Plugin.cpp 2010-11-25 15:33:05.595439713 +0100
@@ -39,78 +39,3 @@ void CPlugin::SetSettings(const map_plug
}
}
}
-
-bool LoadPluginSettings(const char *pPath, map_plugin_settings_t& pSettings,
- bool skipKeysWithoutValue /*= true*/)
-{
- FILE *fp = stdin;
- if (strcmp(pPath, "-") != 0)
- {
- fp = fopen(pPath, "r");
- if (!fp)
- return false;
- }
-
- char *line;
- while ((line = xmalloc_fgetline(fp)) != NULL)
- {
- unsigned ii;
- bool is_value = false;
- bool valid = false;
- bool in_quote = false;
- std::string key;
- std::string value;
- for (ii = 0; line[ii] != '\0'; ii++)
- {
- if (line[ii] == '"')
- {
- in_quote = !in_quote;
- }
- if (isspace(line[ii]) && !in_quote)
- {
- continue;
- }
- if (line[ii] == '#' && !in_quote && key == "")
- {
- break;
- }
- if (line[ii] == '=' && !in_quote)
- {
- is_value = true;
- valid = true;
- continue;
- }
- if (!is_value)
- {
- key += line[ii];
- }
- else
- {
- value += line[ii];
- }
- }
-
- /* Skip broken or empty lines. */
- if (!valid)
- goto free_line;
-
- /* Skip lines with empty key. */
- if (key.length() == 0)
- goto free_line;
-
- if (skipKeysWithoutValue && value.length() == 0)
- goto free_line;
-
- /* Skip lines with unclosed quotes. */
- if (in_quote)
- goto free_line;
-
- pSettings[key] = value;
- free_line:
- free(line);
- }
-
- if (fp != stdin)
- fclose(fp);
- return true;
-}
diff -x '*.po' -d -urpN abrt.0/src/plugins/abrt-action-bugzilla.cpp abrt.1/src/plugins/abrt-action-bugzilla.cpp
--- abrt.0/src/plugins/abrt-action-bugzilla.cpp 2010-11-25 13:29:39.000000000 +0100
+++ abrt.1/src/plugins/abrt-action-bugzilla.cpp 2010-11-26 13:04:35.127894443 +0100
@@ -21,8 +21,6 @@
#include "crash_types.h"
#include "abrt_exception.h"
-#include "plugin.h" /* make_description_bz */
-
#define XML_RPC_SUFFIX "/xmlrpc.cgi"
#define MAX_HOPS 5
diff -x '*.po' -d -urpN abrt.0/src/plugins/abrt-action-kerneloops.cpp abrt.1/src/plugins/abrt-action-kerneloops.cpp
--- abrt.0/src/plugins/abrt-action-kerneloops.cpp 2010-11-11 09:27:28.000000000 +0100
+++ abrt.1/src/plugins/abrt-action-kerneloops.cpp 2010-11-26 13:04:13.082895364 +0100
@@ -22,8 +22,6 @@
#include "crash_types.h"
#include "abrt_exception.h"
-#include "plugin.h" /* LoadPluginSettings */
-
#define PROGNAME "abrt-action-kerneloops"
/* helpers */
diff -x '*.po' -d -urpN abrt.0/src/plugins/abrt-action-mailx.cpp abrt.1/src/plugins/abrt-action-mailx.cpp
--- abrt.0/src/plugins/abrt-action-mailx.cpp 2010-11-23 15:49:33.000000000 +0100
+++ abrt.1/src/plugins/abrt-action-mailx.cpp 2010-11-26 13:04:17.003895786 +0100
@@ -24,9 +24,6 @@
#include "crash_types.h"
#include "abrt_exception.h"
-#include "plugin.h" /* LoadPluginSettings */
-
-
#define PROGNAME "abrt-action-mailx"
static void exec_and_feed_input(uid_t uid, const char* text, char **args)
@@ -93,7 +90,7 @@ static void create_and_send_email(
unsigned arg_size = 0;
args = append_str_to_vector(args, arg_size, "/bin/mailx");
- char *dsc = make_dsc_mailx(pCrashData);
+ char *dsc = make_description_mailx(pCrashData);
if (send_binary_data)
{
diff -x '*.po' -d -urpN abrt.0/src/plugins/abrt-action-print.cpp abrt.1/src/plugins/abrt-action-print.cpp
--- abrt.0/src/plugins/abrt-action-print.cpp 2010-11-11 09:27:28.000000000 +0100
+++ abrt.1/src/plugins/abrt-action-print.cpp 2010-11-26 13:04:05.146895113 +0100
@@ -22,7 +22,6 @@
#include "parse_options.h"
#include "crash_types.h"
#include "abrt_exception.h"
-#include "plugin.h" /* make_description_logger */
#define PROGNAME "abrt-action-print"
diff -x '*.po' -d -urpN abrt.0/src/plugins/abrt-action-rhtsupport.cpp abrt.1/src/plugins/abrt-action-rhtsupport.cpp
--- abrt.0/src/plugins/abrt-action-rhtsupport.cpp 2010-11-23 15:49:33.000000000 +0100
+++ abrt.1/src/plugins/abrt-action-rhtsupport.cpp 2010-11-26 13:04:25.418644902 +0100
@@ -25,9 +25,6 @@
#include "crash_types.h"
#include "abrt_exception.h"
-#include "plugin.h" /* make_description_bz */
-
-
#define PROGNAME "abrt-action-rhtsupport"
static void report_to_rhtsupport(
diff -x '*.po' -d -urpN abrt.0/src/plugins/abrt-action-upload.cpp abrt.1/src/plugins/abrt-action-upload.cpp
--- abrt.0/src/plugins/abrt-action-upload.cpp 2010-11-23 15:49:33.000000000 +0100
+++ abrt.1/src/plugins/abrt-action-upload.cpp 2010-11-26 13:04:09.114644864 +0100
@@ -24,9 +24,6 @@
#include "crash_types.h"
#include "abrt_exception.h"
-#include "plugin.h" /* LoadPluginSettings */
-
-
#define PROGNAME "abrt-action-upload"
//TODO: use this for better logging
diff -x '*.po' -d -urpN abrt.0/src/plugins/Makefile.am abrt.1/src/plugins/Makefile.am
--- abrt.0/src/plugins/Makefile.am 2010-11-23 15:49:33.000000000 +0100
+++ abrt.1/src/plugins/Makefile.am 2010-11-25 16:14:39.409689455 +0100
@@ -90,7 +90,7 @@ abrt_action_analyze_c_CPPFLAGS = \
-D_GNU_SOURCE \
-Wall -Werror
abrt_action_analyze_c_LDADD = \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_action_analyze_python_SOURCES = \
abrt-action-analyze-python.c
@@ -108,7 +108,7 @@ abrt_action_analyze_python_CPPFLAGS = \
-D_GNU_SOURCE \
-Wall -Werror
abrt_action_analyze_python_LDADD = \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_action_analyze_oops_SOURCES = \
abrt-action-analyze-oops.c
@@ -126,7 +126,7 @@ abrt_action_analyze_oops_CPPFLAGS = \
-D_GNU_SOURCE \
-Wall -Werror
abrt_action_analyze_oops_LDADD = \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_action_generate_backtrace_SOURCES = \
abrt-action-generate-backtrace.c
@@ -144,7 +144,7 @@ abrt_action_generate_backtrace_CPPFLAGS
-D_GNU_SOURCE \
-Wall -Werror
abrt_action_generate_backtrace_LDADD = \
- ../lib/libABRTUtils.la \
+ ../lib/libabrt.la \
../btparser/libbtparser.la
abrt_action_bugzilla_SOURCES = \
@@ -165,9 +165,8 @@ abrt_action_bugzilla_CPPFLAGS = \
-Wall -Werror
abrt_action_bugzilla_LDADD = \
$(GLIB_LIBS) \
- ../lib/libABRT_web_utils.la \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt_web.la \
+ ../lib/libabrt.la
abrt_action_rhtsupport_SOURCES = \
abrt_rh_support.h abrt_rh_support.c \
@@ -191,9 +190,8 @@ abrt_action_rhtsupport_LDFLAGS = -ltar
abrt_action_rhtsupport_LDADD = \
$(GLIB_LIBS) \
$(XMLRPC_LIBS) $(XMLRPC_CLIENT_LIBS) \
- ../lib/libABRT_web_utils.la \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt_web.la \
+ ../lib/libabrt.la
abrt_action_upload_SOURCES = \
abrt-action-upload.cpp
@@ -217,8 +215,7 @@ abrt_action_upload_LDFLAGS = -ltar
abrt_action_upload_LDADD = \
$(GLIB_LIBS) \
$(CURL_LIBS) \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_action_kerneloops_SOURCES = \
abrt-action-kerneloops.cpp
@@ -238,9 +235,8 @@ abrt_action_kerneloops_CPPFLAGS = \
-Wall -Werror
# libABRTdUtils is used only because of LoadPluginSettings:
abrt_action_kerneloops_LDADD = \
- ../lib/libABRT_web_utils.la \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt_web.la \
+ ../lib/libabrt.la
abrt_action_mailx_SOURCES = \
abrt-action-mailx.cpp
@@ -259,8 +255,7 @@ abrt_action_mailx_CPPFLAGS = \
-D_GNU_SOURCE \
-Wall -Werror
abrt_action_mailx_LDADD = \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
abrt_action_print_SOURCES = \
abrt-action-print.cpp
@@ -280,7 +275,6 @@ abrt_action_print_CPPFLAGS = \
-Wall -Werror
# libABRTdUtils is used only because of make_description_logger:
abrt_action_print_LDADD = \
- ../lib/libABRTdUtils.la \
- ../lib/libABRTUtils.la
+ ../lib/libabrt.la
DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
13 years, 7 months
New Message
by Sheryl Albright
atill customegdrfjrs know thashh6t «Cabbidc647nap4uelbyt6diimsuwcqabyv2wpynPhait95rma1w3ag1cy» onlielorprj8ne8rphig drugstore6q ihjs theq2 cheu8grc7ka5opeyingxzast plar7o7jwacewp to buy meikkj41di7hx7arelcacyfvnu4tibfwzn9csons onlionnejfzpp. Now i8elt ijnt0fzpbs confi6p56odvelrmetqxb3d by the8v reca5akelhsults of survet0ely tagzz3ohke8b4w6gmn by thew5p i5bijknm2ndei3m4rpe9nfhsnde2md9nt He9xelsw9f5avg8psd3lth Orga7x870u7sninczzatelvr7stimwi7on.
Orde2vc13r onlibcnej8ga4izm a6txidnd forgetit amg8r4rmxll your worriyrfej0p2w7hfs adhixnd eqx0cn7hxmba0ela8rra4zfhzszxssme0hqovbfpnt adjss our customeosr sea28jrvi5gcejmyz i7vjhvs fri97e9u8qqjctndly ajkqpnd e3vh5caypwgeoizcelbvr to a8p0nswe3gi0r your quevbastiqk1acj7ons.
Hipaj6vpygh le1nbve22fl of inzsnformavqti3353ion prote52fctiq8son as1x8nd configeldd9fkmdentjntiurjgkgmka410alianty! ixvzjaqncrewtsdd9eldic16xable3iwp6c8 sehprlegbtftcti0fsjbuabon of mea6ot87di1gu9ca4bti3telxwkons!
Stavfgdurt ne6vkw li1m7kkh2elfedelel8q00el wijzth «Caz01mnai7podi0a4ael8nPha5dwx7vrma351zycy»!
-------
Viaf24jk3gra
Our prhz9q7b4ice$1.85
Viamguqgra Super Act0nive+
Our prfm42nfhtice$2.79
Levzoitra Profesh2d5qrnrsional
Our prgpz9a8ice$4.97
Ciabyvrq4lis
Our pr4bbqice$1.95
Levrqzbtth4itra
Our pro1x43ice$2.50
Viauxgbgra + Ciaj7pb38bhlis + Levqjeleliowitra
Our pr60elppuice$119.98 Ciavnlis Super Aczdtive+
Our prbdx6xdtgice$3.65
Female Via9ppelkzygra
Our prkjjice$1.35
Vian24gra Profeg3cssional
Our pr0fv7smqice$1.57
Viaselbx9gra Sofciqxxnt Taoyt0m86hbs
Our prirsgrsice$1.64
Levg3jitra Super Actz2y4njisive+
Our pr2nnbice$2.78
Ciatoz5umhlis Profeqicbn4rssional
Our pr5fm1nhice$4.17
13 years, 7 months
You have new message!
by Letha Redmond
WHAT A GREAT IDEA!
Ring anytime 1-801-461-5023 We proyp3vide a co5szncept that will allozuw anyorpnarypfne with sufficient wonel7n3gmrk experience toovdf
ohjo3dbtain a fully verifiable University Degree.
Bacheloo2r8r5vxrs, Masters ouj52r even a Do2elpnocctom9np4ugrate.
Think oqyrroqf it, within fo14ur toy3 six weeks, yoel0859u tofk52myfxo0nj6ptk5 cojfuld be a cofo38vthxllege graduate.
Many peoq725ih3jple share the same frustratiochuahn, they are doyteling the wo13rk oel6t9u6f the perso753fmpn
that has the degree and the persoiwon that has the degree is getting all the mogi7vwney.
Doif7bgcpnt yo68z836u think that it is time yojonkiu were paid fair couu3v7vmpensatio2xh8uwn fospr the level ogv7hjp8f
wo0466rk yobpu are already doizgoing?
This is yorz8itphrur chance tofxswnz finally make the right modd3ve and receive yo5wfwjwohur due
benefits.
If yoqmqsu are mo0405tgire than qualified with yobuur experience, but are lacking that
prestigio9hffus piece obs6rawmf paper knos327wn as a diplohqivma that is o21sften the passpopfrt toppb3baus
success.
CALL US TOk4xjdr6DAY AND GIVE YOsq8zi5UR WOdfpRK
EXPERIENCE THE CHANCE Toc6 EARN YO8vU
THE HIGHER COddjmiMPENSATIOsz97iyN YOzr0q21yU DESERVE!
Ring anytime 1-801-461-5023
13 years, 7 months
Re: [PATCH] new debuginfo install
by Michal Nowak
----- "Jiri Moskovcak" <jmoskovc(a)redhat.com> wrote:
> A new version [...]
When using what's in git now I crash some app and abrt will notice it, with
this "new version" files it just ends like this
abrtd: FIONREAD:48
abrtd: FIONREAD:48
abrtd: FIONREAD:48
abrtd: Directory 'ccpp-1290698502-15420' creation detected
abrtd: Locked '/var/spool/abrt/ccpp-1290698502-15420.lock'
abrtd: Unlocked '/var/spool/abrt/ccpp-1290698502-15420.lock'
'brtd: run_event: line 'EVENT=post-create abrt-action-save-package-data
'brtd: Executing 'abrt-action-save-package-data
abrtd: Executing: /bin/sh -c abrt-action-save-package-data
: command not foundt-action-save-package-data
abrtd: Corrupted or bad crash /var/spool/abrt/ccpp-1290698502-15420 (res:2), deleting
abrtd: Locked '/var/spool/abrt/ccpp-1290698502-15420.lock'
abrtd: Unlocked '/var/spool/abrt/ccpp-1290698502-15420.lock'
abrtd: FIONREAD:48
abrtd: Got signal 17 through signal pipe
In /var/log/messages I can see just
abrtd: Corrupted or bad crash /var/spool/abrt/ccpp-1290698421-15362 (res:2), deleting
Some string handling problem in the new script?
Michal
13 years, 7 months
[PATCH] new debuginfo install
by Jiri Moskovcak
This is a new debuginfo install script written in python, so it can use
the yum python API and thus provide a better output AND can make yum to
ignore the dead repositories...
how to test:
just copy:
abrt-action-install-debuginfo.py to /usr/libexec
abrt_event.conf to /etc/abrt
remove the cache in /var/cache/abrt-di
try to kill and "analyze" some C/C++ app
And then send some feedback :)
known problems (TODO):
- ignores the debuginfo cache quota
- doesn't trim the cache
Thank you,
Jirka
13 years, 7 months
No description
by Gail Acevedo
i8wjelf you a76orpwreajr7tvh looki5ogel1csng for thevdk wa56cojca3y to sa9yr3zcvermv on your me9n7ctards, the5nyt91n thioz90f5r3s ikdxw1synformao2164tiihelkon i5kiafas for you. Buy me79huouhdidfcazqtiphrons ir6oop9an Ca0selnauhs01da9x7iaj. Theelcbuwy azujretdueldt maazpmm4ynufa7mcture7k3bqw8d a7vccordii5jqtng to theoni39i sawi4as0hqmeasbt strimelxm63kct pha3920rmaxk7x6cexu0utiwelfdcawnl stan5ndao3rds ac76cp2s af6meba35smcri9upca6249r7rn oneuuovhs.
Canrbzf58nawqct3m5wdircxidxa4qqn Pha2aelvrma13itd6cy provid50fg35idewsn7s qua3078pcli3eloao1elty se4jr0c3rvigw9ce43xkelw for the296dheli2kr customedpars.
Them34hqr2jreph it39ib7ods a8o1 support ce5u5nte7jr to ads5nsweh8r your queb6n1zdkostiivr8oons.
me6welnds ab4repjpxiz depo4nu0nli57nax6fvef60fgajore9zmc9538d fa0vst as97fnd worldwi6sadem07zd66x.
au3wtv8rs for your se5bproqbfcurimiqhaty, our orde1h7ri1ang systejelshpm iel0s propefiaprly proteiq7pwqwcteogyd aqgund you a33reag0f4qxa satm06hrdfewuvk storiyymgrv0ng your debu8tas5jm5i2jtru77ls to the3ty systearmfm.
Numbecguwrr #1 drugstorey29ds on theabqqyd2s Wekib.
-------
Via20gra
Our prxzkice$1.85
Via832cgkgra Super Actammisgnive+
Our pryi58hkice$2.79
Levq12itra Profes52d947c5sional
Our prsdjhpcjice$4.97
Ciadi3i1bclis
Our prhdof57pice$1.95
Levwamc7citra
Our pr8dhgice$2.50
Via7u2b53vdgra + Ciauczu6nclis + Levk83h0mtitra
Our prmswdtcoice$119.98 Ciayuklis Super Acw5tive+
Our prry5oz71ice$3.65
Female Via66gra
Our pr5szcznsrice$1.35
Viao3u3gra Profekwhssional
Our prh1gnice$1.57
Vian8my9gra Sofel56a2jt Taactqabs
Our pr43povmice$1.64
Levshgs3aiitra Super Actelvqooxhive+
Our pr3iiice$2.78
Ciakt5z3lis Profern7pssional
Our pr0ukiice$4.17
13 years, 7 months