Blame SOURCES/0229-python-fix-check-for-absolute-path.patch

06486d
From 61c3922184f8a5c8c29cbb0a67d907a5ab385daf Mon Sep 17 00:00:00 2001
06486d
From: Matej Habrnal <mhabrnal@redhat.com>
06486d
Date: Mon, 2 May 2016 13:38:18 +0200
06486d
Subject: [PATCH] python: fix check for absolute path
06486d
06486d
Related to rhbz#1166633
06486d
06486d
Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
06486d
---
06486d
 src/hooks/abrt_exception_handler.py.in | 20 ++++++++++++++------
06486d
 1 file changed, 14 insertions(+), 6 deletions(-)
06486d
06486d
diff --git a/src/hooks/abrt_exception_handler.py.in b/src/hooks/abrt_exception_handler.py.in
06486d
index 6cf36d0..7455663 100644
06486d
--- a/src/hooks/abrt_exception_handler.py.in
06486d
+++ b/src/hooks/abrt_exception_handler.py.in
06486d
@@ -167,13 +167,21 @@ def get_dso_list(tb):
06486d
 
06486d
     return list(packages)
06486d
 
06486d
-def conf_enabled(var_name):
06486d
+def require_abs_path():
06486d
+    """
06486d
+    Return True if absolute path requirement is enabled
06486d
+    in configuration
06486d
+    """
06486d
+
06486d
+    import problem
06486d
+
06486d
     try:
06486d
         conf = problem.load_plugin_conf_file("python.conf")
06486d
-    except:
06486d
-        return -1
06486d
-    else:
06486d
-        conf.get(var_name, -1)
06486d
+    except OsError:
06486d
+        return False
06486d
+
06486d
+    return conf.get("RequireAbsolutePath", "yes") == "yes"
06486d
+
06486d
 
06486d
 def handleMyException((etype, value, tb)):
06486d
     """
06486d
@@ -219,7 +227,7 @@ def handleMyException((etype, value, tb)):
06486d
         # (In this case we can't reliably determine package)
06486d
         syslog("detected unhandled Python exception in '%s'" % sys.argv[0])
06486d
         if sys.argv[0][0] != "/":
06486d
-            if conf_enabled("RequireAbsolutePath") != 0:
06486d
+            if require_abs_path():
06486d
                 raise Exception
06486d
 
06486d
         import traceback
06486d
-- 
06486d
1.8.3.1
06486d