doczkal / rpms / abrt

Forked from rpms/abrt 4 years ago
Clone

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

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