Also adds the same prefix to analyze-ccpp-local. Signed-off-by: Petr Kubat <pku...@redhat.com> --- src/plugins/Makefile.am | 9 ++++- src/plugins/abrt-action-analyze-ccpp-local | 47 ---------------------- src/plugins/abrt-action-analyze-ccpp-local.in | 47 ++++++++++++++++++++++ .../abrt-action-install-debuginfo-to-abrt-cache.c | 13 +++--- 4 files changed, 62 insertions(+), 54 deletions(-) delete mode 100755 src/plugins/abrt-action-analyze-ccpp-local create mode 100644 src/plugins/abrt-action-analyze-ccpp-local.in
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index c0c0745..58fe725 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -92,7 +92,7 @@ EXTRA_DIST = \ abrt-gdb-exploitable \ https-utils.h \ post_report.xml.in \ - abrt-action-analyze-ccpp-local + abrt-action-analyze-ccpp-local.in confdir = $(CONF_DIR) dist_conf_DATA = \ @@ -250,6 +250,7 @@ abrt_action_install_debuginfo_to_abrt_cache_CPPFLAGS = \ -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -D_GNU_SOURCE \ + -DCONF_PREFIX=\"$(prefix)\" \ $(LIBREPORT_CFLAGS) \ -Wall -Wwrite-strings \ -fPIE @@ -313,6 +314,12 @@ endif DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ +DISTCLEANFILES = abrt-action-analyze-ccpp-local + abrt-action-perform-ccpp-analysis: abrt-action-perform-ccpp-analysis.in sed -e s,\@libexecdir\@,$(libexecdir),g \ $< >$@ + +abrt-action-analyze-ccpp-local: abrt-action-analyze-ccpp-local.in + sed -e s,\@LIBEXEC_DIR\@,$(libexecdir),g \ + $< >$@ diff --git a/src/plugins/abrt-action-analyze-ccpp-local b/src/plugins/abrt-action-analyze-ccpp-local deleted file mode 100755 index ef0976e..0000000 --- a/src/plugins/abrt-action-analyze-ccpp-local +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -INSTALL_DI=true -WITH_BODHI=true -# if bz is set to false it also disables bodhi, because it needs it's result -WITH_BUGZILLA=true -for opt in "$@"; do - if [ x"$opt" = x"--without-di" ]; then - INSTALL_DI=false - fi - - if [ x"$opt" = x"--without-bz" ]; then - WITH_BUGZILLA=false - fi - - if [ x"$opt" = x"--without-bodhi" ]; then - WITH_BODHI=false - fi -done - -if $INSTALL_DI; then - # On some systems debuginfo install needs root privileges. - # Running a suided-to-abrt wrapper would make - # debuginfo install fail even for root. - # Therefore, if we are root, we don't use the wrapper. - if [ x"`id -u`" = x"0" ]; then - abrt-action-analyze-core --core=coredump -o build_ids && abrt-action-install-debuginfo --size_mb=4096 - else - abrt-action-analyze-core --core=coredump -o build_ids && /usr/libexec/abrt-action-install-debuginfo-to-abrt-cache --size_mb=4096 - fi - rm -f build_ids -fi - -if [ $? = 0 ]; then - abrt-action-generate-backtrace && - abrt-action-analyze-backtrace - if [ "$?" == "0" ]; then - if $WITH_BUGZILLA; then - bug_id=$(reporter-bugzilla -h "`cat duphash`") - if $WITH_BODHI; then - if test -n "$bug_id"; then - abrt-bodhi -r -b $bug_id - fi - fi - fi - fi -fi diff --git a/src/plugins/abrt-action-analyze-ccpp-local.in b/src/plugins/abrt-action-analyze-ccpp-local.in new file mode 100644 index 0000000..de131c8 --- /dev/null +++ b/src/plugins/abrt-action-analyze-ccpp-local.in @@ -0,0 +1,47 @@ +#!/bin/sh + +INSTALL_DI=true +WITH_BODHI=true +# if bz is set to false it also disables bodhi, because it needs it's result +WITH_BUGZILLA=true +for opt in "$@"; do + if [ x"$opt" = x"--without-di" ]; then + INSTALL_DI=false + fi + + if [ x"$opt" = x"--without-bz" ]; then + WITH_BUGZILLA=false + fi + + if [ x"$opt" = x"--without-bodhi" ]; then + WITH_BODHI=false + fi +done + +if $INSTALL_DI; then + # On some systems debuginfo install needs root privileges. + # Running a suided-to-abrt wrapper would make + # debuginfo install fail even for root. + # Therefore, if we are root, we don't use the wrapper. + if [ x"`id -u`" = x"0" ]; then + abrt-action-analyze-core --core=coredump -o build_ids && abrt-action-install-debuginfo --size_mb=4096 + else + abrt-action-analyze-core --core=coredump -o build_ids && @LIBEXEC_DIR@/abrt-action-install-debuginfo-to-abrt-cache --size_mb=4096 + fi + rm -f build_ids +fi + +if [ $? = 0 ]; then + abrt-action-generate-backtrace && + abrt-action-analyze-backtrace + if [ "$?" == "0" ]; then + if $WITH_BUGZILLA; then + bug_id=$(reporter-bugzilla -h "`cat duphash`") + if $WITH_BODHI; then + if test -n "$bug_id"; then + abrt-bodhi -r -b $bug_id + fi + fi + fi + fi +fi diff --git a/src/plugins/abrt-action-install-debuginfo-to-abrt-cache.c b/src/plugins/abrt-action-install-debuginfo-to-abrt-cache.c index b642070..c00fb3a 100644 --- a/src/plugins/abrt-action-install-debuginfo-to-abrt-cache.c +++ b/src/plugins/abrt-action-install-debuginfo-to-abrt-cache.c @@ -112,12 +112,13 @@ int main(int argc, char **argv) } while (*p); #endif /* Set safe PATH */ -// TODO: honor configure --prefix here by adding it to PATH -// (otherwise abrt-action-install-debuginfo would fail to spawn abrt-action-trim-files): - if (u == 0) - putenv((char*) "PATH=/usr/sbin:/sbin:/usr/bin:/bin"); - else - putenv((char*) "PATH=/usr/bin:/bin"); + // Adding configure --prefix to the PATH so that + // abrt-action-install-debuginfo doesn't fail when spawning + // abrt-action-trim-files + char path_env[] = "PATH=/usr/sbin:/sbin:/usr/bin:/bin:" CONF_PREFIX "/bin:" CONF_PREFIX "/sbin"; + if (u != 0) + strcpy(path_env, "PATH=/usr/bin:/bin:" CONF_PREFIX "/bin"); + putenv(path_env); } execvp(EXECUTABLE, argv); -- 1.8.3.1