Skip to contentSkip to conversation

capability sorting

PATCH New Russell Coker 2 participants 7 messages Feb 12, 2017 – Feb 15, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 capability sorting

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.

#!/usr/bin/perl
use strict;

while(<STDIN>)
{
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 $_;

}
}

Signature · 9 lines
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: capability.diff.gz
Type: application/gzip
Size: 19488 bytes
Desc: not available
Url : http://oss.tresys.com/pipermail/refpolicy/attachments/20170212/c0b72289/attachment-0001.bin 
#1 lore raw

PATCH 1/1 capability sorting

Quoted 6 lines · Russell Coker via refpolicy

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.

Quoted 26 lines

#!/usr/bin/perl
use strict;

while(<STDIN>)
{
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

Signature · 1 line
Chris PeBenito
#2 lore raw

PATCH 1/1 capability sorting

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.

Quoted 42 lines · Chris PeBenito
Quoted 1 line · Russell Coker via refpolicy

The attached patch (gzip compressed due to list size limits) sorts

the

Quoted 1 line

capabilities in alphabetical order which is also the order from the

system

Quoted 3 lines

include files.

I used the below perl script to sort the capabilities and both

inspected and

Quoted 1 line

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.

Quoted 26 lines

#!/usr/bin/perl
use strict;

while(<STDIN>)
{
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

Signature · 1 line
Sent from my Nexus 6P with K-9 Mail.
#3 lore raw

PATCH 1/1 capability sorting

Quoted 3 lines · Russell Coker

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.

Quoted 44 lines · Chris PeBenito
Quoted 42 lines · Russell Coker via refpolicy
Quoted 1 line

The attached patch (gzip compressed due to list size limits) sorts

the

Quoted 1 line

capabilities in alphabetical order which is also the order from the

system

Quoted 3 lines

include files.

I used the below perl script to sort the capabilities and both

inspected and

Quoted 1 line

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.

Quoted 26 lines

#!/usr/bin/perl
use strict;

while(<STDIN>)
{
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

Signature · 1 line
Chris PeBenito
#4 lore raw

PATCH 1/1 capability sorting

They said the same when I first submitted a patch to remove whitespace at the end of lines. ;)

Capabilities are different from all the other object classes. There's no other object class with as many permissions that can each be usefully set independently.

Quoted 58 lines · Chris PeBenito via refpolicy
Quoted 3 lines · Russell Coker

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.

Quoted 1 line

On 13 February 2017 5:58:38 am LHDT, Chris PeBenito

Quoted 5 lines · <[email protected]> wrote:
Quoted 5 lines · Russell Coker via refpolicy
Quoted 1 line

The attached patch (gzip compressed due to list size limits) sorts

the

Quoted 1 line

capabilities in alphabetical order which is also the order from the

system

Quoted 8 lines
Quoted 8 lines
Quoted 3 lines

include files.

I used the below perl script to sort the capabilities and both

inspected and

Quoted 1 line

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,

Quoted 30 lines
Quoted 29 lines

since this type of alphabetical sorting isn't required.

Quoted 26 lines

#!/usr/bin/perl
use strict;

while(<STDIN>)
{
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

Signature · 1 line
Sent from my Nexus 6P with K-9 Mail.
#5 lore raw

PATCH 1/1 capability sorting

In reply to Chris PeBenito
Quoted 8 lines · AEDT Chris PeBenito
Quoted 5 lines · Russell Coker

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.

The patch I sent changes 230 instances to be alphabetically sorted. It will take a long time for any significant portion of them to have the wrong order by random policy changes. This is a once a decade change.

Signature · 2 lines
My Main Blog         http://etbe.coker.com.au/
My Documents Blog    http://doc.coker.com.au/
#6 lore raw

PATCH 1/1 capability sorting

In reply to Russell Coker
Quoted 3 lines · Russell Coker via refpolicy

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.

Merged.

Quoted 29 lines

I used the below perl script to sort the capabilities and both inspected and tested the result.

#!/usr/bin/perl
use strict;

while(<STDIN>)
{
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

Signature · 1 line
Chris PeBenito