[apparmor] [utils][patch]Fix indentation for return command in cleanprofile.py

Kshitij Gupta kgupta8592 at gmail.com
Sun Jun 7 16:56:32 UTC 2015


As discovered by cboltz there was a strange random behaviour of crashing by
aa-cleanprof. After a fun bughunt we traced it to 4 extra white spaces
before the return statement. The patch also adds a sorted call on the key
set to make things more deterministic (for when we have to bughunt next

Note: This patch just fixes the randomness, the cause of crash is fixed by
"Add profile_storage()" patch which initialises thing as necessary.

The following patch:
- Brings the return to the correct indentation
- Adds a sorted call over the set keys of hat in the profile

=== modified file 'utils/apparmor/cleanprofile.py'
--- utils/apparmor/cleanprofile.py      2015-04-26 19:54:38 +0000
+++ utils/apparmor/cleanprofile.py      2015-06-07 16:48:49 +0000
@@ -48,7 +48,7 @@
         #Process every hat in the profile individually
         file_includes =
         deleted = 0
-        for hat in self.profile.aa[program].keys():
+        for hat in sorted(self.profile.aa[program].keys()):
             #The combined list of includes from profile and the file
             includes =
list(self.profile.aa[program][hat]['include'].keys()) + file_includes

@@ -76,7 +76,7 @@
             deleted +=
self.other.aa[program][hat], 'allow', self.same_file)
             deleted +=
self.other.aa[program][hat], 'deny', self.same_file)

-            return deleted
+        return deleted

 def delete_path_duplicates(profile, profile_other, allow,
     deleted = []



Kshitij Gupta
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20150607/62e8ba73/attachment-0001.html>

More information about the AppArmor mailing list