diff --git a/utils/apparmor/aa.py b/utils/apparmor/aa.py index df3e2e9d2..762b286f1 100644 --- a/utils/apparmor/aa.py +++ b/utils/apparmor/aa.py @@ -1627,7 +1627,10 @@ def read_profiles(ui_msg=False, skip_profiles=()): aaui.UI_Info("skipping profile %s" % full_file) continue else: - read_profile(full_file, True) + try: + read_profile(full_file, True) + except AppArmorException as e: + aaui.UI_Info("skipping unparseable profile %s (%s)" % (full_file, e.value)) def read_inactive_profiles(skip_profiles=()): diff --git a/utils/test/test-logprof.py b/utils/test/test-logprof.py index 9800bb2d3..ae9742a00 100644 --- a/utils/test/test-logprof.py +++ b/utils/test/test-logprof.py @@ -81,7 +81,10 @@ class TestLogprof(AATest): for line in jlog: if line.startswith('o '): # read from stdout - output = self.process.stdout.readline().decode("utf-8").strip() + while True: + output = self.process.stdout.readline().decode("utf-8").strip() + if "skipping unparseable" not in output: + break self.assertEqual(output, line[2:]) elif line.startswith('i '): # send to stdin @@ -124,7 +127,10 @@ class TestLogprof(AATest): self.process = self._startLogprof(auditlog, 'allow-all') for line in slog: - output = self.process.stdout.readline().decode("utf-8").strip() + while True: + output = self.process.stdout.readline().decode("utf-8").strip() + if not output.startswith("skipping unparseable"): + break self.assertEqual(output, line) # give logprof some time to write the updated profile and terminate self.process.wait(timeout=0.3)