commit 658a17d73e0b0df4b533efa38634420c9b97ba66 Author: Petr Lautrbach Date: Tue Jul 7 07:38:31 2015 +0200 semanage: Use OrderedDict for list of fcontexts semanage-fcontext shows which file contexts are defined and do a sort which does not follow real order. It could be confusing for users therefore we need to use OrderedDict and preserve the order. Resolves: rhbz#1206769 diff --git a/semanage/seobject/__init__.py b/semanage/seobject/__init__.py index 08bf736..1e0bbfc 100644 --- a/semanage/seobject/__init__.py +++ b/semanage/seobject/__init__.py @@ -2003,7 +2003,9 @@ class fcontextRecords(semanageRecords): self.flist += fclocal - ddict = {} + from collections import OrderedDict + ddict = OrderedDict() + for fcontext in self.flist: expr = semanage_fcontext_get_expr(fcontext) ftype = semanage_fcontext_get_type(fcontext) @@ -2020,7 +2022,6 @@ class fcontextRecords(semanageRecords): l = [] fcon_dict = self.get_all(True) keys = list(fcon_dict.keys()) - keys.sort() for k in keys: if fcon_dict[k]: l.append("-a -f %s -t %s '%s'" % (file_type_str_to_option[k[1]], fcon_dict[k][2], k[0])) @@ -2034,7 +2035,6 @@ class fcontextRecords(semanageRecords): fcon_dict = self.get_all(locallist) keys = list(fcon_dict.keys()) if len(keys) != 0: - keys.sort() if heading: print("%-50s %-18s %s\n" % (_("SELinux fcontext"), _("type"), _("Context"))) for k in keys: