Public bug reported: Python 3.12 got more strict about quoting in strings that often impacts regular expressions, and pyflakes on the apparmor apport hooks reports:
$ pyflakes3 debian/apport/source_apparmor.py debian/apport/source_apparmor.py:61: SyntaxWarning: invalid escape sequence '\(' sec_re = re.compile('audit\(|apparmor|selinux|security', re.IGNORECASE) We should use a raw string for this, like so: diff --git a/debian/apport/source_apparmor.py b/debian/apport/source_apparmor.py index 33c6a7e0b..2437d0cd4 100644 --- a/debian/apport/source_apparmor.py +++ b/debian/apport/source_apparmor.py @@ -58,7 +58,7 @@ def add_info(report, ui): attach_file(report, '/proc/version_signature', 'ProcVersionSignature') attach_file(report, '/proc/cmdline', 'ProcKernelCmdline') - sec_re = re.compile('audit\(|apparmor|selinux|security', re.IGNORECASE) + sec_re = re.compile(r'audit\(|apparmor|selinux|security', re.IGNORECASE) report['KernLog'] = recent_kernlog(sec_re) # DBus messages are reported to syslog dbus_sec_re = re.compile('dbus.* apparmor', re.IGNORECASE) The intent here is to match logs with the strings 'audit(', 'apparmor', 'selinux', or 'security' ** Affects: apparmor (Ubuntu) Importance: Undecided Status: New -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to apparmor in Ubuntu. https://bugs.launchpad.net/bugs/2076150 Title: apparmor apport python plugin: "invalid escape sequence '\('" Status in apparmor package in Ubuntu: New Bug description: Python 3.12 got more strict about quoting in strings that often impacts regular expressions, and pyflakes on the apparmor apport hooks reports: $ pyflakes3 debian/apport/source_apparmor.py debian/apport/source_apparmor.py:61: SyntaxWarning: invalid escape sequence '\(' sec_re = re.compile('audit\(|apparmor|selinux|security', re.IGNORECASE) We should use a raw string for this, like so: diff --git a/debian/apport/source_apparmor.py b/debian/apport/source_apparmor.py index 33c6a7e0b..2437d0cd4 100644 --- a/debian/apport/source_apparmor.py +++ b/debian/apport/source_apparmor.py @@ -58,7 +58,7 @@ def add_info(report, ui): attach_file(report, '/proc/version_signature', 'ProcVersionSignature') attach_file(report, '/proc/cmdline', 'ProcKernelCmdline') - sec_re = re.compile('audit\(|apparmor|selinux|security', re.IGNORECASE) + sec_re = re.compile(r'audit\(|apparmor|selinux|security', re.IGNORECASE) report['KernLog'] = recent_kernlog(sec_re) # DBus messages are reported to syslog dbus_sec_re = re.compile('dbus.* apparmor', re.IGNORECASE) The intent here is to match logs with the strings 'audit(', 'apparmor', 'selinux', or 'security' To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/2076150/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp