On 09/08/2014 01:28 PM, Jan Chaloupka wrote:
> default is used as a keyword for defining default group permissions. Having 
> "default" as a group name (with double quotes "), parsing is successfull. 
> Howerver, using default without double quotes, parsing fails. This patch 
> modifies parsing rule and lex for default group name without double quotes.
> 
> Tested on:
> 
> default {
>       perm {
>               task {
>                       uid = root;
>                       gid = rgel6610;
>                       fperm = 770;
>               }
>               admin {
>                       uid = root;
>                       gid = root;
>                       dperm = 775;
>                       fperm = 744;
>               }
>       }
> }
> 
> group default {
>         cpuset {
>                 cpuset.mems = 0;
>                 cpuset.cpus = 0;
>         }
> }
> 
> 
> Signed-off-by: Jan Chaloupka <jchal...@redhat.com>

Acked-By: Jan Safranek <jsafr...@redhat.com>

> ---
>  src/lex.l   |    2 +-
>  src/parse.y |   16 +++++++++++++---
>  2 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/src/lex.l b/src/lex.l
> index d7bf575..ecd212c 100644
> --- a/src/lex.l
> +++ b/src/lex.l
> @@ -42,7 +42,7 @@ jmp_buf parser_error_env;
>  "group"              {return GROUP;}
>  "namespace"  {return NAMESPACE;}
>  "template"   {return TEMPLATE;}
> -"default"    {return DEFAULT;}
> +"default"    {yylval.name = strdup(yytext); return DEFAULT;}
>  [a-zA-Z0-9_\-\/\.\,\%\@\\]+ {yylval.name = strdup(yytext); return ID;}
>  \"[^"]*\" {yylval.name = strdup(yytext+1); 
> yylval.name[strlen(yylval.name)-1] = '\0'; return ID; }
>  .    {return yytext[0];}
> diff --git a/src/parse.y b/src/parse.y
> index 9adbc0e..98f7699 100644
> --- a/src/parse.y
> +++ b/src/parse.y
> @@ -45,9 +45,9 @@ int yywrap(void)
>       int val;
>       struct cgroup_dictionary *values;
>  }
> -%type <name> ID
> +%type <name> ID DEFAULT
>  %type <val> mountvalue_conf mount task_namevalue_conf admin_namevalue_conf
> -%type <val> admin_conf task_conf task_or_admin group_conf group start
> +%type <val> admin_conf task_conf task_or_admin group_conf group start 
> group_name
>  %type <val> namespace namespace_conf default default_conf
>  %type <values> namevalue_conf
>  %type <val> template template_conf
> @@ -99,7 +99,7 @@ default_conf
>       }
>       ;
>  
> -group   :       GROUP ID '{' group_conf '}'
> +group   :       GROUP group_name '{' group_conf '}'
>       {
>               $$ = $4;
>               if ($$) {
> @@ -119,6 +119,16 @@ group   :       GROUP ID '{' group_conf '}'
>       }
>          ;
>  
> +group_name
> +     :       ID
> +     {
> +             $$ = $1;
> +     }
> +     |       DEFAULT
> +     {
> +             $$ = $1;
> +     }
> +
>  group_conf
>          :       ID '{' namevalue_conf '}'
>       {
> 


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to