Lexicographically sort perms in rules output of searchpolicy.py

Bug: 238394904
Test: atest seamendc-test && atest CtsSecurityHostTestCases
Change-Id: I841e7d5cf3616d692dcd5b749544268bcbab76c2
This commit is contained in:
Sandro 2022-07-19 13:52:26 +00:00
parent d5098f99a9
commit 6e7e003344

View file

@ -78,10 +78,10 @@ rules = []
for r in TERules:
if len(r.perms) > 1:
rules.append("allow " + r.sctx + " " + r.tctx + ":" + r.tclass + " { " +
" ".join(r.perms) + " };")
" ".join(sorted(r.perms)) + " };")
else:
rules.append("allow " + r.sctx + " " + r.tctx + ":" + r.tclass + " " +
" ".join(r.perms) + ";")
" ".join(sorted(r.perms)) + ";")
for r in sorted(rules):
print(r)