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

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