Blame SOURCES/0207-vmcore-catch-IOErrors-and-OSErrors.patch

b225ea
From 530cee09dd84565552ade0bdf08b40f900bef8f1 Mon Sep 17 00:00:00 2001
b225ea
From: Jakub Filak <jfilak@redhat.com>
b225ea
Date: Thu, 27 Nov 2014 12:45:04 +0100
b225ea
Subject: [PATCH] vmcore: catch IOErrors and OSErrors
b225ea
b225ea
Perhaps some temporary data cleaner removed problem directory while the hook
b225ea
was still using in.
b225ea
b225ea
Resolves: rhbz#1311100
b225ea
b225ea
Signed-off-by: Jakub Filak <jfilak@redhat.com>
b225ea
---
b225ea
 src/hooks/abrt_harvest_vmcore.py.in | 12 ++++++++++--
b225ea
 1 file changed, 10 insertions(+), 2 deletions(-)
b225ea
b225ea
diff --git a/src/hooks/abrt_harvest_vmcore.py.in b/src/hooks/abrt_harvest_vmcore.py.in
b225ea
index 17e2be8..c6a7e6b 100644
b225ea
--- a/src/hooks/abrt_harvest_vmcore.py.in
b225ea
+++ b/src/hooks/abrt_harvest_vmcore.py.in
b225ea
@@ -272,8 +272,16 @@ def harvest_vmcore():
b225ea
             except OSError:
b225ea
                 sys.stderr.write("Unable to delete '%s'. Ignoring\n" % f_full)
b225ea
 
b225ea
-        # Let abrtd know what type of problem it is:
b225ea
-        create_abrtd_info(destdirnew)
b225ea
+        try:
b225ea
+            # Let abrtd know what type of problem it is:
b225ea
+            create_abrtd_info(destdirnew)
b225ea
+        except EnvironmentError as ex:
b225ea
+            sys.stderr.write("Unable to create problem directory info: " + str(ex))
b225ea
+            try:
b225ea
+                shutil.rmtree(destdirnew)
b225ea
+            except Exception as ex:
b225ea
+                sys.stderr.write("Unable to remove incomplete problem directory: " + str(ex))
b225ea
+            continue
b225ea
 
b225ea
         # chown -R 0:0
b225ea
         change_owner_rec(destdirnew)
b225ea
-- 
b225ea
1.8.3.1
b225ea