libreport/0003-report-client-provide-cpio-log-when-unpacking-fails.patch
Matej Habrnal b5a180b66f Translations update and several bug fixes
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
2015-05-20 14:34:41 +02:00

53 lines
2.0 KiB
Diff

From d87be387a8d3ab91d5771a479fff4f144d1fd97e Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Wed, 22 Apr 2015 14:51:24 +0200
Subject: [PATCH] report client: provide cpio log when unpacking fails
Related to rhbz#1169774 rhbz#1213485 rhbz#1036918
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
src/client-python/reportclient/debuginfo.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/client-python/reportclient/debuginfo.py b/src/client-python/reportclient/debuginfo.py
index 44521d0..24bece3 100644
--- a/src/client-python/reportclient/debuginfo.py
+++ b/src/client-python/reportclient/debuginfo.py
@@ -27,6 +27,7 @@ import time
import errno
import shutil
from subprocess import Popen
+import tempfile
from reportclient import (_, log1, log2, RETURN_OK, RETURN_FAILURE,
RETURN_CANCEL_BY_USER, verbose, ask_yes_no,
@@ -127,17 +128,21 @@ def unpack_rpm(package_full_path, files, tmp_dir, destdir, exact_files=False):
file_patterns += "." + filename + " "
cpio_args = ["cpio", "-idu", file_patterns.strip()]
- with open("/dev/null", "w") as null:
+ with tempfile.NamedTemporaryFile(prefix='abrt-unpacking-', dir='/tmp',
+ delete=False) as log_file:
+ log_file_name = log_file.name
cpio = Popen(cpio_args, cwd=destdir, bufsize=-1,
- stdin=unpacked_cpio, stdout=null, stderr=null)
+ stdin=unpacked_cpio, stdout=log_file, stderr=log_file)
retcode = cpio.wait()
if retcode == 0:
log1("files extracted OK")
#print _("Removing temporary cpio file")
+ os.unlink(log_file_name)
os.unlink(unpacked_cpio_path)
else:
- print(_("Can't extract files from '{0}'").format(unpacked_cpio_path))
+ print(_("Can't extract files from '{0}'. For more information see '{1}'")
+ .format(unpacked_cpio_path, log_file_name))
return RETURN_FAILURE
def clean_up(tmp_dir):
--
2.4.1