[apparmor] [patch] Make profile flags more whitespace tolerant

Christian Boltz apparmor at cboltz.de
Sun Jul 5 18:22:36 UTC 2015


Hello,

Am Sonntag, 5. Juli 2015 schrieb Steve Beattie:
> No changes to utils/test/test-regex_matches.py to confirm that the
> regex works as expected?

The existing tests continue to work, but right, it's a good idea to add 
another test with less usual whitespace around the flags.

Here we go:


[patch] Add tests for RE_PROFILE_START and parse_profile_start_line() with unusual whitespace around flags


[ 68-test-profile-start-flags-with-whitespace.diff ]

=== modified file utils/test/test-regex_matches.py
--- utils/test/test-regex_matches.py    2015-07-05 20:14:53.103843582 +0200
+++ utils/test/test-regex_matches.py    2015-07-05 20:17:25.187675634 +0200
@@ -417,6 +417,7 @@
         ('   /foo (complain) {',          { 'plainprofile': '/foo',    'namedprofile': None,          'attachment': None,     'flags': 'complain', 'comment': None }),
         ('   /foo flags=(complain) {',    { 'plainprofile': '/foo',    'namedprofile': None,          'attachment': None,     'flags': 'complain', 'comment': None }),
         ('   /foo (complain) { # x',      { 'plainprofile': '/foo',    'namedprofile': None,          'attachment': None,     'flags': 'complain', 'comment': '# x'}),
+        ('   /foo flags = ( complain ){#',{ 'plainprofile': '/foo',    'namedprofile': None,          'attachment': None,     'flags': ' complain ', 'comment': '#'}),
 
         ('   /foo {',                     { 'plainprofile': '/foo',     'namedprofile': None,   'leadingspace': '   ' }),
         ('/foo {',                        { 'plainprofile': '/foo',     'namedprofile': None,   'leadingspace': ''    }),
@@ -437,6 +438,7 @@
         ('   profile "foo bar" /foo {',   { 'profile': 'foo bar', 'profile_keyword': True,  'plainprofile': None, 'namedprofile': 'foo bar','attachment': '/foo', 'flags': None,    'comment': None }),
         ('   /foo (complain) {',          { 'profile': '/foo',    'profile_keyword': False, 'plainprofile': '/foo', 'namedprofile': None,   'attachment': None,   'flags': 'complain', 'comment': None }),
         ('   /foo flags=(complain) {',    { 'profile': '/foo',    'profile_keyword': False, 'plainprofile': '/foo', 'namedprofile': None,   'attachment': None,   'flags': 'complain', 'comment': None }),
+        ('   /foo flags = ( complain ){', { 'profile': '/foo',    'profile_keyword': False, 'plainprofile': '/foo', 'namedprofile': None,   'attachment': None,   'flags': ' complain ', 'comment': None }),
         ('   /foo (complain) { # x',      { 'profile': '/foo',    'profile_keyword': False, 'plainprofile': '/foo', 'namedprofile': None,   'attachment': None,   'flags': 'complain', 'comment': '# x'}),
 
         ('   /foo {',                     { 'profile': '/foo',    'plainprofile': '/foo', 'namedprofile': None,  'leadingspace': '   ' }),





Regards,

Christian Boltz
-- 
install by booting the rescue-cd, partition your system manually, then
use the obs build script to populate the target file sytem, configure
everything by hand and reboot afterwards. But it's a bit tedious to do
so and if I'd file a droprequest for yast2-installation, I'm quite sure
many people would be unhappy. [Stefan Seyfried in opensuse-factory]




More information about the AppArmor mailing list