diff --git a/utils/apparmor/rule/include.py b/utils/apparmor/rule/include.py index f7736b115..07551c10a 100644 --- a/utils/apparmor/rule/include.py +++ b/utils/apparmor/rule/include.py @@ -138,7 +138,7 @@ class IncludeRule(BaseRule): files = [] if os.path.isdir(full_path): - for path in os.listdir(full_path): + for path in sorted(os.listdir(full_path)): if is_skippable_file(path): continue diff --git a/utils/test/test-include.py b/utils/test/test-include.py index a7d22948b..a64a39105 100644 --- a/utils/test/test-include.py +++ b/utils/test/test-include.py @@ -360,7 +360,7 @@ class IncludeFullPathsTest(AATest): os.mkdir(empty_dir, 0o755) tests = [ - # @@ will be replaced with self.profile_dir; if multiple entries, need to be sorted + # @@ will be replaced with self.profile_dir ('include ', ['@@/abstractions/base'] ), # ('include "foo"', ['@@/foo'] ), # TODO: adjust logic to honor quoted vs. magic paths (and allow quoted relative paths in re_match_include_parse()) ('include "/foo/bar"', ['/foo/bar'] ), @@ -376,7 +376,7 @@ class IncludeFullPathsTest(AATest): exp2.append(path.replace('@@', self.profile_dir)) obj = IncludeRule._parse(params) - self.assertEqual(sorted(obj.get_full_paths(self.profile_dir)), exp2) + self.assertEqual(obj.get_full_paths(self.profile_dir), exp2) ## --- tests for IncludeRuleset --- #