[apparmor] create-apparmor.vim.py - create_file_rule

John Johansen john.johansen at canonical.com
Sun May 27 09:00:52 UTC 2012


On 05/25/2012 04:21 PM, Christian Boltz wrote:
> Hello,
> 
> Am Mittwoch, 9. Mai 2012 schrieb Christian Boltz:
>> as mentioned in the UDS chat, I'd like to have a create_file_rule
>> function in create-apparmor.vim.py.
>>
>> Unfortunately Python is not one of the P* languages I "speak", which
>> means I can't implement this myself :-( or at least I'd need more time
>> for reading a "python for beginners" tutorial than for writhing code
>> ;-)
> 
> LinuxTag has some advantages - for example, you meet people who can help 
> with python :-)
> 
> The attached patch moves the generation of file rules from 
> apparmor.vim.in to create-apparmor.vim.py. It also adds support for
> - filenames in quotes
> - reverse syntax (permissions first)
> 
> The patch also removes an outdated $Id header in apparmor.vim.in and
> updates the copyright year.
> 
> Note: If you want to compare apparmor.vim with the "old" apparmor.vim, 
> temporarily comment out the "filename with quotes" and the two "reverse 
> syntax" lines in create_file_rule().
> 
> 
> The code looks good to me and seems to work (I tested with some 
> profiles, but didn't test all corner cases), but maybe it isn't the 
> best-looking python code on the world ;-)  (it's the first python I ever 
> wrote...)  I'm always happy about improvements. However, I'd prefer to 
> do it incremental - in other words: first commit this patch and then 
> apply a "cleanup" patch. That makes checking the changes easier.
> 
Hey Christian,

I skimmed it but my Python skills aren't much better than yours. I don't
have any problems with you committing this and then committing changes on
top of it.

I will ask you to wait a couple days before checking it in.  We are about
to branch off 2.8 and release it, further fixes will have to come in the
2.8.1 release.

Once that is done you can check this into head and it can be part of 2.9,
along with the other stuff that is backed up waiting like jeff's network
debug patches.



More information about the AppArmor mailing list