[apparmor] [PATCH 8/9] Convert FLAGS_MODE start condition to a generic list of values start cond

Seth Arnold seth.arnold at gmail.com
Wed Dec 28 04:32:32 UTC 2011


On Tue, Dec 27, 2011 at 7:01 PM, John Johansen
<john.johansen at canonical.com> wrote:
> Signed-off-by: John Johansen <john.johansen at canonical.com>
> ---
>  parser/parser_lex.l  |   41 ++++++++++++++++++++++++-----------------
>  parser/parser_misc.c |    2 --
>  parser/parser_yacc.y |   21 +++++++++------------
>  3 files changed, 33 insertions(+), 31 deletions(-)
>
> diff --git a/parser/parser_lex.l b/parser/parser_lex.l
> index 1d59f43..fc787c2 100644
> --- a/parser/parser_lex.l
> +++ b/parser/parser_lex.l
> @@ -180,11 +180,13 @@ MODES             {MODE_CHARS}+
>  WS             [[:blank:]]
>  NUMBER         [[:digit:]]+
>  ID             [^ \t\n"!,]|(,[^ \t\n"!])
> +LIST_VALUE_ID  [^ \t\n"!,()]|([^ \t\n"!(),])
>  POST_VAR_ID    [^ =\+\t\n"!,]|(,[^ =\+\t\n"!])

The added regexps look like they should compile identically to me:

 [^ \t\n"!,()]
([^ \t\n"!(),])

I think you probably meant to mimic the lines above and below it and move
the comma outside the square brackets, like this instead:

+LIST_VALUE_ID  [^ \t\n"!,()]|(,[^ \t\n"!()])

(Though I'd probably be happier if all three lines were re-written
like this:

IDH [^ \t\n"!,()]
ID IDH|(,IDH)
LIST_VALUE_ID IDH|(,IDH)
POST_VAR_IDH [^ =\+\t\n"!,]
POST_VAR_ID POST_VAR_IDH|(,POST_VAR_IDH)

_IDH variants for "helper"; nearly doubling the lines vs making sure a
single comma is added to the first portion unchanged...)



More information about the AppArmor mailing list