From: pebenito@ieee.org (Chris PeBenito) Date: Mon, 13 Feb 2017 19:42:12 -0500 Subject: [refpolicy] [PATCH] capability sorting In-Reply-To: <2272A259-6997-48B9-9DF4-E3BF457E23C4@coker.com.au> References: <37190070.fYifpz0EYe@russell.coker.com.au> <311d8934-76e2-75fd-8ff3-8bbb3f7c573e@ieee.org> <2272A259-6997-48B9-9DF4-E3BF457E23C4@coker.com.au> Message-ID: <9cd6c679-6a58-5acd-e242-4b2210385408@ieee.org> To: refpolicy@oss.tresys.com List-Id: refpolicy.oss.tresys.com On 02/12/17 20:59, Russell Coker wrote: > I'm just pendant about such things. > > But it does make it easier to compare policy by looking at it if things are in the same order. If you have 2 lists of capabilities and one has an extra item it can take a minute if they are in random order. True, but I don't plan on enforcing that it stays that way in the style guide, so I don't know that it's worth applying. > On 13 February 2017 5:58:38 am LHDT, Chris PeBenito wrote: >> On 02/12/17 04:23, Russell Coker via refpolicy wrote: >>> The attached patch (gzip compressed due to list size limits) sorts >> the >>> capabilities in alphabetical order which is also the order from the >> system >>> include files. >>> >>> I used the below perl script to sort the capabilities and both >> inspected and >>> tested the result. >> >> I'm ok with the change, but I'm not clear why you made it. If it is >> what you understood from the style guide, I really need to clarify it, >> since this type of alphabetical sorting isn't required. >> >> >>> #!/usr/bin/perl >>> use strict; >>> >>> while() >>> { >>> if($_ =~ /capability.*{/) >>> { >>> chomp; >>> my @line = split /{/,$_; >>> my @end = split /}/,$line[1]; >>> my $capabilities = join(' ', sort split / /,$end[0]); >>> print "$line[0]\{$capabilities }$end[1]\n"; >>> } >>> else >>> { >>> print $_; >>> } >>> } >>> >>> >>> >>> _______________________________________________ >>> refpolicy mailing list >>> refpolicy at oss.tresys.com >>> http://oss.tresys.com/mailman/listinfo/refpolicy >>> > -- Chris PeBenito