[ABRT PATCH] added option to bypass di install closes #618
by Jiri Moskovcak
Signed-off-by: Jiri Moskovcak <jmoskovc(a)redhat.com>
---
src/plugins/abrt-action-analyze-ccpp-local | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/plugins/abrt-action-analyze-ccpp-local b/src/plugins/abrt-action-analyze-ccpp-local
index 0c5ab34..1c36f15 100755
--- a/src/plugins/abrt-action-analyze-ccpp-local
+++ b/src/plugins/abrt-action-analyze-ccpp-local
@@ -1,9 +1,18 @@
#! /bin/sh
-if [ "`id -u`x" == "0x" ]; then
- abrt-action-analyze-core --core=coredump | abrt-action-install-debuginfo --ids=- --size_mb=4096
-else
- abrt-action-analyze-core --core=coredump | /usr/libexec/abrt-action-install-debuginfo-to-abrt-cache --ids=- --size_mb=4096
-fi;
+
+INSTALL_DI=true
+for opt in "$@"; do
+ if [ $opt = "--without-di" ]; then
+ INSTALL_DI=false
+ fi;
+done
+if $INSTALL_DI; then
+ if [ "`id -u`x" == "0x" ]; then
+ abrt-action-analyze-core --core=coredump | abrt-action-install-debuginfo --ids=- --size_mb=4096
+ else
+ abrt-action-analyze-core --core=coredump | /usr/libexec/abrt-action-install-debuginfo-to-abrt-cache --ids=- --size_mb=4096
+ fi
+fi
if [ "$?x" == "0x" ]; then
abrt-action-generate-backtrace &&
--
1.8.1.4
11 years, 2 months
[LIBREPORT PATCH] - don't suid before running yum related to rhbz#759443
by Jiri Moskovcak
Signed-off-by: Jiri Moskovcak <jmoskovc(a)redhat.com>
---
src/client-python/debuginfo.py | 62 +++++++++++++++++++++++++++++++++---------
1 file changed, 49 insertions(+), 13 deletions(-)
diff --git a/src/client-python/debuginfo.py b/src/client-python/debuginfo.py
index 98dbec6..30b893c 100644
--- a/src/client-python/debuginfo.py
+++ b/src/client-python/debuginfo.py
@@ -22,9 +22,32 @@ def unmute_stdout():
else:
print "ERR: unmute called without mute?"
+def ensure_abrt_uid(fn):
+ import pwd
+ current_uid = os.getuid()
+ current_gid = os.getgid()
+ abrt = pwd.getpwnam("abrt")
+
+ # if we're are already running as abrt, don't do anything
+ if abrt.pw_uid == current_uid and abrt.pw_gid == current_gid:
+ return fn
+
+ def wrapped(*args, **kwargs):
+ # switch to abrt
+ os.setegid(abrt.pw_gid)
+ os.seteuid(abrt.pw_uid)
+ # extract the files as abrt:abrt
+ fn(*args, **kwargs)
+ # switch back to whatever we were
+ os.seteuid(current_uid)
+ os.setegid(current_gid)
+
+ return wrapped
+
# TODO: unpack just required debuginfo and not entire rpm?
# ..that can lead to: foo.c No such file and directory
# files is not used...
+@ensure_abrt_uid
def unpack_rpm(package_file_name, files, tmp_dir, destdir, keeprpm, exact_files=False):
package_full_path = tmp_dir + "/" + package_file_name
log1("Extracting %s to %s", package_full_path, destdir)
@@ -36,8 +59,11 @@ def unpack_rpm(package_file_name, files, tmp_dir, destdir, keeprpm, exact_files=
except IOError, ex:
print _("Can't write to '{0}': {1}").format(unpacked_cpio_path, ex)
return RETURN_FAILURE
+
+ error_out = open("rpm2cpio.err",'w+')
rpm2cpio = Popen(["rpm2cpio", package_full_path],
- stdout = unpacked_cpio, bufsize = -1)
+ stdout = unpacked_cpio, stderr=error_out, bufsize = -1)
+ error_out.close()
retcode = rpm2cpio.wait()
if retcode == 0:
@@ -164,6 +190,23 @@ class DebugInfoDownload(YumBase):
exit(1)
unmute_stdout()
+ @ensure_abrt_uid
+ def setup_tmp_dirs(self):
+ if not os.path.exists(self.tmpdir):
+ try:
+ os.makedirs(self.tmpdir)
+ except OSError, ex:
+ print "Can't create tmpdir: %s" % ex
+ return RETURN_FAILURE
+ if not os.path.exists(self.cachedir):
+ try:
+ os.makedirs(self.cachedir)
+ except OSError, ex:
+ print "Can't create cachedir: %s" % ex
+ return RETURN_FAILURE
+
+ return RETURN_OK
+
# return value will be used as exitcode. So 0 = ok, !0 - error
def download(self, files, download_exact_files=False):
""" @files - """
@@ -288,18 +331,11 @@ class DebugInfoDownload(YumBase):
repo.cache = 0
remote = pkg.returnSimple('relativepath')
local = os.path.basename(remote)
- if not os.path.exists(self.tmpdir):
- try:
- os.makedirs(self.tmpdir)
- except OSError, ex:
- print "Can't create tmpdir: %s" % ex
- return RETURN_FAILURE
- if not os.path.exists(self.cachedir):
- try:
- os.makedirs(self.cachedir)
- except OSError, ex:
- print "Can't create cachedir: %s" % ex
- return RETURN_FAILURE
+ retval = self.setup_tmp_dirs()
+ # continue only if the tmp dirs are ok
+ if retval != RETURN_OK:
+ return retval
+
local = os.path.join(self.tmpdir, local)
pkg.localpath = local # Hack: to set the localpath we want
err = self.downloadPkgs(pkglist=[pkg])
--
1.8.1.2
11 years, 2 months
[LIBREPORT PATCH 1/3] workflows: correct an event name for reporting to Fedora in anaconda config
by Jakub Filak
- closes rhbz#917684
Signed-off-by: Jakub Filak <jfilak(a)redhat.com>
---
src/workflows/anaconda_event.conf | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/workflows/anaconda_event.conf b/src/workflows/anaconda_event.conf
index fda7239..f71aebd 100644
--- a/src/workflows/anaconda_event.conf
+++ b/src/workflows/anaconda_event.conf
@@ -1,2 +1,2 @@
-EVENT=workflow_AnacondaBugzilla type=anaconda
-EVENT=workflow_AnacondaUpload type=anaconda
\ No newline at end of file
+EVENT=workflow_AnacondaFedora type=anaconda
+EVENT=workflow_AnacondaUpload type=anaconda
--
1.8.1.4
11 years, 2 months