[apparmor] [patch] fix leading whitespace in "(V)iew changes" and cleanup profile writing

Steve Beattie steve at nxnw.org
Sat Nov 15 00:39:31 UTC 2014


On Fri, Nov 14, 2014 at 02:33:04AM +0100, Christian Boltz wrote:
> Hello,
> 
> funny things while working on the rule class, part $big_number:
> 
> The diff displayed by (V)iew changes in aa-logprof lacks leading 
> whitespace because it bases the whitespace on the indention level of the 
> closing "}".
> 
> Besides that, it uses different values for the indention level for newly 
> added rule types than for existing rule types. (For example, if a 
> profile already had a network rule, added network rules will get a 
> different indention level.) However you won't notice this because
> currently it doesn't indent the rules at all ;-)
> 
> This patch fixes serialize_profile_from_old_profile() in aa.py so that 
> it always uses the correct indention level.
> 
> 
> Also clean up and simplify how the profile is written in the end (when 
> matching RE_PROFILE_END) - we already have "write_methods", so we can
> just re-use it instead of "manually" calling one write_* function after 
> the other. Unfortunately dicts don't keep their original order, 
> therefore I had to introduce "default_write_order" (any better idea?)
> 
> 
> Finally, add some missing rule types to "segments" to avoid key errors.

Acked-by: Steve Beattie <steve at nxnw.org>. Thanks.


-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20141114/2d4e013e/attachment.pgp>


More information about the AppArmor mailing list