setroubleshoot-3.3.22-2

- Log plugin exception traceback when log level is DEBUG
- sepolicy.info() returns a generator, not a list (#1784564)
This commit is contained in:
Petr Lautrbach 2020-01-11 21:06:38 +01:00
parent 2751df1935
commit 61171038c2
3 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From 2b40f9e254ee2514a5ca113620b6761c0a1d2ae6 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Sat, 11 Jan 2020 10:19:25 +0100
Subject: [PATCH] framework: sepolicy.info() returns a generator, not a list
Fixes:
$ sealert -a ./short.log
100% done'generator' object is not subscriptable
---
framework/src/setroubleshoot/audit_data.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/framework/src/setroubleshoot/audit_data.py b/framework/src/setroubleshoot/audit_data.py
index 66986a7adfb0..6f0e1e8166ac 100644
--- a/framework/src/setroubleshoot/audit_data.py
+++ b/framework/src/setroubleshoot/audit_data.py
@@ -713,7 +713,7 @@ class AVC:
types = wtypes
for t in types:
if t in all_attributes:
- wtypes.extend(info(ATTRIBUTE, t)[0]["types"])
+ wtypes.extend(next(info(ATTRIBUTE, t))["types"])
for t in wtypes:
if t in all_types:
--
2.23.0

View File

@ -0,0 +1,40 @@
From fc7aad6d9df91eba2445eac53e09372d844f5fd3 Mon Sep 17 00:00:00 2001
From: Petr Lautrbach <plautrba@redhat.com>
Date: Sat, 11 Jan 2020 20:34:22 +0100
Subject: [PATCH] framework: Log plugin exception traceback when log level is
DEBUG
Use the following setting to enable traceback logging when there's a 'Plugin
Exception'.
/etc/setroubleshoot/setroubleshoot.conf:
[sealert_log]
level = debug
---
framework/src/setroubleshoot/analyze.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/framework/src/setroubleshoot/analyze.py b/framework/src/setroubleshoot/analyze.py
index e16a47a3791f..43b2484be353 100644
--- a/framework/src/setroubleshoot/analyze.py
+++ b/framework/src/setroubleshoot/analyze.py
@@ -33,6 +33,7 @@ from gi.repository import GObject, GLib
import os
import time
import threading
+import traceback
from stat import *
import sys
from functools import cmp_to_key
@@ -213,6 +214,8 @@ class Analyze(object):
except Exception as e:
print(e, file=sys.stderr)
syslog.syslog(syslog.LOG_ERR, "Plugin Exception %s " % plugin.analysis_id)
+ (v1, v2, v3) = sys.exc_info()
+ log_debug(join(traceback.format_tb(v3)))
self.plugins.remove(plugin)
report_receiver.report_problem(siginfo)
--
2.23.0

View File

@ -4,11 +4,14 @@
Summary: Helps troubleshoot SELinux problems
Name: setroubleshoot
Version: 3.3.22
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+
URL: https://pagure.io/setroubleshoot
Source0: https://releases.pagure.org/setroubleshoot/%{name}-%{version}.tar.gz
Source1: %{name}.tmpfiles
# git format-patch -N setroubleshoot-3.3.22 -- framework
Patch0001: 0001-framework-sepolicy.info-returns-a-generator-not-a-li.patch
Patch0002: 0002-framework-Log-plugin-exception-traceback-when-log-le.patch
BuildRequires: gcc
BuildRequires: libcap-ng-devel
BuildRequires: intltool gettext python3 python3-devel
@ -194,6 +197,10 @@ SELinux troubleshoot legacy applet
%{_bindir}/seappletlegacy
%changelog
* Sat Jan 11 2020 Petr Lautrbach <plautrba@redhat.com> - 3.3.22-2
- Log plugin exception traceback when log level is DEBUG
- sepolicy.info() returns a generator, not a list (#1784564)
* Thu Jan 2 2020 Petr Lautrbach <plautrba@redhat.com> - 3.3.22-1
- sepolicy.info() returns a generator, not a list (#1784564)