* Jan Safranek <[email protected]> [2009-02-19 14:45:38]:

> Hello,
> 
> there is a bug in the cgconfig.conf parser. Let's have following piece 
> of config:
> 
> group_test {
>      cpuset {
>          cpuset.cpus = 0;
>          cpuset.mems = 0;
>      }
> }
>

I am surprised that we have this BUG, but the solution should be
straight forward since we parse multiple lines for perm (tasks and
admin).
 
> Looking at the parser of name/value pairs in parse.y, the beginning 
> looks OK (standalone 'name=value;'):
> 
>       namevalue_conf
>          :       ID '=' ID ';'
>          {
>                  $1 = realloc($1, strlen($1) + strlen($3) + 2);
>                  $1 = strncat($1, " ", strlen(" "));
>                  $$ = strncat($1, $3, strlen($3));
>                  free($3);
>          }
> 
> But when two name/value pairs are specified, only the second one is 
> used! $1 is not stored anywhere and gets lost:
> 
>          |       namevalue_conf ID '=' ID ';'
>          {
>                  $2 = realloc($2, strlen($2) + strlen($4) + 2);
>                  $2 = strncat($2, " ", strlen(" "));
>                  $$ = strncat($2, $4, strlen($4));
>                  free($4);
>          }
> 
> The cgconfigparser sets only the second value and it does not display 
> any warning.
> 
> I am afraid I am no yacc/bison guru and can't even say in what structure 
> the name/value pairs should be stored. A list? Or a string 
> "name=value;name2=value2"? For the second proposal I can create a patch, 
>    but it looks ugly to me to parse 'name = value;\n\tname2 = value2;\n' 
> into 'name=value;name2=value2' and parse it again in 
> cgroup_config_parse_controller_options().
>

That is ugly, ideally the way we have the parser we should call
parse_controller_options for each line. Let me check the code. 

-- 
        Balbir

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Libcg-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to