Hello,

On Sat, Nov 8, 2014 at 9:25 PM, Christian Boltz <[email protected]> wrote:

> Hello,
>
> Am Samstag, 8. November 2014 schrieb Kshitij Gupta:
> > On Sat, Nov 8, 2014 at 3:56 AM, Christian Boltz wrote:
> > > +        comment = ' %s' % matches.group('comment').strip()
> >
> > Would the superfluous spaces be better dealt in the regex RE_EOL by
> > ignoring them from comment group?
> > That would save us many such calls.
>
> Indeed, good idea!
>
> Here's the follow-up patch to let RE_EOL strip whitespace from the
> comment:
>
> === modified file 'utils/apparmor/aa.py'
> --- utils/apparmor/aa.py        2014-11-08 15:47:39 +0000
> +++ utils/apparmor/aa.py        2014-11-08 15:53:23 +0000
> @@ -2613,7 +2613,7 @@
>  ## Profile parsing Regex
>  RE_AUDIT_DENY           =
> '^\s*(?P<audit>audit\s+)?(?P<allow>allow\s+|deny\s+)?'  # line start,
> optionally: leading whitespace, <audit> and <allow>/deny
>  RE_OWNER                = '(?P<owner>owner\s+)?'  # optionally: <owner>
> -RE_EOL                  = '\s*(?P<comment>#.*)?$'  # optional whitespace,
> optional <comment>, end of the line
> +RE_EOL                  = '\s*(?P<comment>#.*?)?\s*$'  # optional
> whitespace, optional <comment>, optional whitespace, end of the line
>  RE_COMMA_EOL            = '\s*,' + RE_EOL # optional whitespace, comma +
> RE_EOL
>
>  RE_PROFILE_START        =
> re.compile('^\s*("?(/.+?)"??|(profile\s+"?(.+?)"??))\s+((flags=)?\((.+)\)\s+)?\{'
> + RE_EOL)
>
>
>
>
Thanks for the quick follow-up patch. :-)

Acked-by: Kshitij Gupta <[email protected]>.

Regards,

Kshitij Gupta

Regards,
>
> Christian Boltz
> --
> Key Signing Party? Was ist denn das?
> Kultiges Zusammensitzen und gemeinsames Murmeln magischer Zahlen.
> -- Gert Döring, FdI 95
>
>
> --
> AppArmor mailing list
> [email protected]
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/apparmor
>
-- 
AppArmor mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/apparmor

Reply via email to