<div dir="ltr"><div><div><div><div>Hello,<br><br></div><div>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 time).<br><br></div><div>Note: This patch just fixes the randomness, the cause of crash is fixed by "Add profile_storage()" patch which initialises thing as necessary.<br>  <br></div>The following patch:<br></div>- Brings the return to the correct indentation<br></div>- Adds a sorted call over the set keys of hat in the profile<br><br>=== modified file 'utils/apparmor/cleanprofile.py'<br>--- utils/apparmor/cleanprofile.py      2015-04-26 19:54:38 +0000<br>+++ utils/apparmor/cleanprofile.py      2015-06-07 16:48:49 +0000<br>@@ -48,7 +48,7 @@<br>         #Process every hat in the profile individually<br>         file_includes = list(self.profile.filelist[self.profile.filename]['include'].keys())<br>         deleted = 0<br>-        for hat in self.profile.aa[program].keys():<br>+        for hat in sorted(self.profile.aa[program].keys()):<br>             #The combined list of includes from profile and the file<br>             includes = list(self.profile.aa[program][hat]['include'].keys()) + file_includes<br> <br>@@ -76,7 +76,7 @@<br>             deleted += delete_path_duplicates(self.profile.aa[program][hat], self.other.aa[program][hat], 'allow', self.same_file)<br>             deleted += delete_path_duplicates(self.profile.aa[program][hat], self.other.aa[program][hat], 'deny', self.same_file)<br> <br>-            return deleted<br>+        return deleted<br> <br> def delete_path_duplicates(profile, profile_other, allow, same_profile=True):<br>     deleted = []<br><br></div><div>Thanks.<br><br></div><div>Regards,<br><br></div><div>Kshitij Gupta<br></div></div>