Blob Blame Raw
From 684a5fcce536e628c339119accd04d42e1f27152 Mon Sep 17 00:00:00 2001
From: Jakub Filak <jfilak@redhat.com>
Date: Thu, 27 Nov 2014 12:45:04 +0100
Subject: [PATCH] vmcore: catch IOErrors and OSErrors

Perhaps some temporary data cleaner removed problem directory while the hook
was still using in.

Resolves: rhbz#1077241

Signed-off-by: Jakub Filak <jfilak@redhat.com>
---
 src/hooks/abrt_harvest_vmcore.py.in | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/hooks/abrt_harvest_vmcore.py.in b/src/hooks/abrt_harvest_vmcore.py.in
index 17e2be8..c6a7e6b 100644
--- a/src/hooks/abrt_harvest_vmcore.py.in
+++ b/src/hooks/abrt_harvest_vmcore.py.in
@@ -272,8 +272,16 @@ def harvest_vmcore():
             except OSError:
                 sys.stderr.write("Unable to delete '%s'. Ignoring\n" % f_full)
 
-        # Let abrtd know what type of problem it is:
-        create_abrtd_info(destdirnew)
+        try:
+            # Let abrtd know what type of problem it is:
+            create_abrtd_info(destdirnew)
+        except EnvironmentError as ex:
+            sys.stderr.write("Unable to create problem directory info: " + str(ex))
+            try:
+                shutil.rmtree(destdirnew)
+            except Exception as ex:
+                sys.stderr.write("Unable to remove incomplete problem directory: " + str(ex))
+            continue
 
         # chown -R 0:0
         change_owner_rec(destdirnew)
-- 
1.9.3