From c175e414c8fe43713dd7c47bb90fe19f531d607e Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Tue, 15 Aug 2023 12:40:39 +0200 Subject: [PATCH] Fix compability with Python < 3.9 str.removeprefix() was introduced in Python 3.9. Replace it with backwards-compatible code. --- utils/apparmor/logparser.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/apparmor/logparser.py b/utils/apparmor/logparser.py index 293af7d9d..b9de2fbab 100644 --- a/utils/apparmor/logparser.py +++ b/utils/apparmor/logparser.py @@ -191,8 +191,8 @@ class ReadLog: return elif e['class'] and e['class'] == 'namespace': - if e['denied_mask'].startswith('userns'): - self.hashlog[aamode][full_profile]['userns'][e['denied_mask'].removeprefix('userns_')] = True + if e['denied_mask'].startswith('userns_'): + self.hashlog[aamode][full_profile]['userns'][ e['denied_mask'][7:] ] = True # [7:] removes the 'userns_' prefix return elif e['class'] and e['class'].endswith('mqueue'):