On 09/22/2010 01:05 AM, Denys Vlasenko wrote:
This patch splits off abrtd's package/component/description
generation into a separate tool:
# abrt-action-save-package-data -z
abrt-action-save-package-data: invalid option -- 'z'
Usage: abrt-action-save-package-data -d DIR [-vs]
Query package database and save package name, component,
and description
Options:
-d DIR Crash dump directory
-v Verbose
-s Log to syslog
This also allows for debugging and regression testing of
abrt-action-save-package-data - it can be simply run
from command-line.
Also it provides a better fault isolation - crash in
abrt-action-save-package-data does not take down abrtd.
Same goes for isolation of memory leaks - old code actually
had leaks on a rarely used error path. New code doesn't,
but if it would have, it wouldn't matter, since the process
is short-lived.
Run tested.
Please review.
+ dsc = xstrdup("Crashed executable does not belong to any installed
package");
+ goto reopen_dd_and_save;
...
...
...
+ reopen_dd_and_save:
+ dd = dd_init();
+ if (!dd_opendir(dd, dump_dir_name))
+ {
+ dd_close(dd);
+ result = 1;
+ goto ret;
+ }
I'm not a fan of goto in this context. goto as jump to the end of function is pretty
good, but this ;).
+ /*
+ Checking the MD5 sum requires to run prelink to "un-prelink" the
+ binaries - this is considered potential security risk so we don't
+ use it, until we find some non-intrusive way
+
+ Delete?
+ */
+ /*
+ if (!CheckHash(package_short_name.c_str(), executable))
+ {
+ error_msg("Executable '%s' seems to be modified, "
+ "doesn't match one from package
'%s'",
+ executable, package_short_name.c_str());
+ result = 1;
+ goto ret;
+ }
+ */
yes, it's not a problem dig it from git again.
+abrt_action_save_package_data_SOURCES = \
+ rpm.h rpm.c \
+ Settings.h Settings.cpp \
+ abrt-action-save-package-data.cpp
+abrt_action_save_package_data_CPPFLAGS = \
+ -I$(srcdir)/../../inc \
+ -I$(srcdir)/../../lib/utils \
+ -DBIN_DIR=\"$(bindir)\" \
+ -DVAR_RUN=\"$(VAR_RUN)\" \
+ -DCONF_DIR=\"$(CONF_DIR)\" \
+ -DLOCALSTATEDIR='"$(localstatedir)"' \pacakge
^^^ typo
When I see function 200 lines long. I'm the guy at the position 8.
(
http://www.pakzilla.com/2007/09/05/programmers-life-cartoon/)
--
Nikola