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

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