summaryrefslogtreecommitdiffstats
path: root/recipes-mac/AppArmor/files/0001-fail.py-handle-missing-cgitb.patch
diff options
context:
space:
mode:
authorMikko Rapeli <mikko.rapeli@linaro.org>2024-12-20 16:04:27 +0200
committerArmin Kuster <akuster808@gmail.com>2024-12-27 11:28:23 -0500
commit5c98ff10a65534dffd2e6426ea8f5592f3957a2d (patch)
tree427e73570dda450869b5f2212787640422cb72ef /recipes-mac/AppArmor/files/0001-fail.py-handle-missing-cgitb.patch
parent93cc0c48fe241578d85140bb820de801f0cf2d12 (diff)
downloadmeta-security-5c98ff10a65534dffd2e6426ea8f5592f3957a2d.tar.gz
apparmor: update from 3.1.3 to 4.0.3
Fixes python 3.13 support though needed one more patch which is also submitted upstream. oeqa runtime test passes on qemuarm and qemuarm64. Did not fix ptest compilation. Changes: https://apparmor.net/news/release-4.0.2/ https://gitlab.com/apparmor/apparmor/-/releases/v4.0.3 Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org> Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'recipes-mac/AppArmor/files/0001-fail.py-handle-missing-cgitb.patch')
-rw-r--r--recipes-mac/AppArmor/files/0001-fail.py-handle-missing-cgitb.patch74
1 files changed, 74 insertions, 0 deletions
diff --git a/recipes-mac/AppArmor/files/0001-fail.py-handle-missing-cgitb.patch b/recipes-mac/AppArmor/files/0001-fail.py-handle-missing-cgitb.patch
new file mode 100644
index 0000000..28c1d9e
--- /dev/null
+++ b/recipes-mac/AppArmor/files/0001-fail.py-handle-missing-cgitb.patch
@@ -0,0 +1,74 @@
1From 434e34bb510b4cab04e64cd5b21d635c6be8c8ea Mon Sep 17 00:00:00 2001
2From: Mikko Rapeli <mikko.rapeli@linaro.org>
3Date: Fri, 29 Nov 2024 13:46:32 +0000
4Subject: [PATCH] fail.py: handle missing cgitb
5
6It's no longer in python standard library starting
7at version 3.13. Fixes:
8
9root@qemuarm64:~# aa-complain /etc/apparmor.d/*
10Traceback (most recent call last):
11 File "/usr/sbin/aa-complain", line 18, in <module>
12 from apparmor.fail import enable_aa_exception_handler
13 File "/usr/lib/python3.13/site-packages/apparmor/fail.py", line 12, in <module>
14 import cgitb
15ModuleNotFoundError: No module named 'cgitb'
16
17Signed-off-by: Mikko Rapeli <mikko.rapeli@linaro.org>
18---
19 utils/apparmor/fail.py | 25 +++++++++++++++----------
20 1 file changed, 15 insertions(+), 10 deletions(-)
21
22Upstream-Status: Backport
23
24diff --git a/utils/apparmor/fail.py b/utils/apparmor/fail.py
25index ece6efc4..a71ceb66 100644
26--- a/utils/apparmor/fail.py
27+++ b/utils/apparmor/fail.py
28@@ -8,7 +8,11 @@
29 #
30 # ------------------------------------------------------------------
31
32-import cgitb
33+try:
34+ import cgitb
35+except ImportError:
36+ cgitb = None
37+ pass
38 import sys
39 import traceback
40 from tempfile import NamedTemporaryFile
41@@ -32,20 +36,21 @@ def handle_exception(*exc_info):
42 print('', file=sys.stderr)
43 error(ex.value)
44 else:
45- with NamedTemporaryFile('w', prefix='apparmor-bugreport-', suffix='.txt', delete=False) as file:
46- cgitb_hook = cgitb.Hook(display=1, file=file, format='text', context=10)
47- cgitb_hook.handle(exc_info)
48-
49- file.write('Please consider reporting a bug at https://gitlab.com/apparmor/apparmor/-/issues\n')
50- file.write('and attach this file.\n')
51+ if cgitb:
52+ with NamedTemporaryFile('w', prefix='apparmor-bugreport-', suffix='.txt', delete=False) as file:
53+ cgitb_hook = cgitb.Hook(display=1, file=file, format='text', context=10)
54+ cgitb_hook.handle(exc_info)
55+ file.write('Please consider reporting a bug at https://gitlab.com/apparmor/apparmor/-/issues\n')
56+ file.write('and attach this file.\n')
57
58 print(''.join(traceback.format_exception(*exc_info)), file=sys.stderr)
59- print('', file=sys.stderr)
60 print('An unexpected error occurred!', file=sys.stderr)
61 print('', file=sys.stderr)
62- print('For details, see %s' % file.name, file=sys.stderr)
63+ if cgitb:
64+ print('For details, see %s' % file.name, file=sys.stderr)
65 print('Please consider reporting a bug at https://gitlab.com/apparmor/apparmor/-/issues', file=sys.stderr)
66- print('and attach this file.', file=sys.stderr)
67+ if cgitb:
68+ print('and attach this file.', file=sys.stderr)
69
70
71 def enable_aa_exception_handler():
72--
732.43.0
74