[apparmor] [patch] fix "dictionary changed size during iteration" in cleanprof.py delete_net_duplicates()
Christian Boltz
apparmor at cboltz.de
Wed Sep 3 23:45:52 UTC 2014
Hello,
this patch fixes "dictionary changed size during iteration" in
cleanprof.py delete_net_duplicates().
Full backtrace:
# python3 aa-mergeprof /etc/apparmor.d/bin.ping /etc/apparmor.d/bin.ping
Traceback (most recent call last):
File "aa-mergeprof", line 695, in <module>
main()
File "aa-mergeprof", line 53, in main
mergeprofiles.clear_common()
File "aa-mergeprof", line 126, in clear_common
deleted += user_base.compare_profiles()
File "/home/cb/apparmor/HEAD-CLEAN/utils/apparmor/cleanprofile.py", line 43, in compare_profiles
deleted += self.remove_duplicate_rules(profile)
File "/home/cb/apparmor/HEAD-CLEAN/utils/apparmor/cleanprofile.py", line 77, in remove_duplicate_rules
deleted += delete_net_duplicates(self.profile.aa[program][hat]['allow']['netdomain'], self.other.aa[program][hat]['allow']['netdomain'], self.same_file)
File "/home/cb/apparmor/HEAD-CLEAN/utils/apparmor/cleanprofile.py", line 147, in delete_net_duplicates
for sock_type in netrules_other['rule'][fam].keys():
RuntimeError: dictionary changed size during iteration
=== modified file 'utils/apparmor/cleanprofile.py'
--- utils/apparmor/cleanprofile.py 2014-02-12 23:54:00 +0000
+++ utils/apparmor/cleanprofile.py 2014-09-03 23:41:11 +0000
@@ -144,7 +144,7 @@
netrules_other['rule'].pop(fam)
deleted += 1
else:
- for sock_type in netrules_other['rule'][fam].keys():
+ for sock_type in list(netrules_other['rule'][fam].keys()):
if netrules['rule'].get(fam, False):
if netrules['rule'][fam].get(sock_type, False):
if not same_profile:
Regards,
Christian Boltz
--
The goal is simple: no more gnome related bugs in the 12.2 release :)
(ok, we ARE optimists). [Dominique Leuenberger in opensuse-factory]
More information about the AppArmor
mailing list