mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Klaus Ma <klaus1982...@gmail.com>
Subject Re: Review Request 49223: Fixed Value parsing code to only accept the canonical formats.
Date Thu, 21 Jul 2016 14:40:25 GMT


> On July 21, 2016, 7:44 a.m., Benjamin Mahler wrote:
> > src/common/values.cpp, lines 589-594
> > <https://reviews.apache.org/r/49223/diff/6/?file=1445258#file1445258line589>
> >
> >     Do we still need this? Seems to me that we want to do the following:
> >     
> >     ```
> >     // Ranges. E.g. [1-2,4-5]
> >     if (strings::startsWith(temp, "[")) {
> >       if (!strings::endsWith(temp, "]")) {
> >         return Error("Missing a closing bracket");
> >       }
> >     
> >       ...
> >     }
> >     
> >     if (strings::startsWith(temp, "{")) {
> >       if (!strings::endsWith(temp, "}")) {
> >         return Error("Missing a closing brace");
> >       }
> >       
> >       ..
> >     }
> >     ```
> >     
> >     Also, why is this looking at parentheses? I only see brackets (ranges) and braces
(set) being used.

I think this is not necessary. Removed.


> On July 21, 2016, 7:44 a.m., Benjamin Mahler wrote:
> > src/common/values.cpp, line 611
> > <https://reviews.apache.org/r/49223/diff/6/?file=1445258#file1445258line611>
> >
> >     Looks like you want a strings::split here? strings::tokenize will ignore empty
fields:
> >     
> >     ```
> >     // Using tokenize makes these two equivalent.
> >     [1-2,,,,5-6]
> >     [1-2,5-6]
> >     ```
> >     
> >     Can you add a test that we don't allow the extra commas since it's not the canonical
format?
> >     
> >     Also, why did you keep tokenizing on newlines? AFAICT they are not part of the
canonical format?

Replaced tokenize with split, also add related test cases.


- Klaus


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/49223/#review143028
-----------------------------------------------------------


On July 21, 2016, 10:38 p.m., Klaus Ma wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/49223/
> -----------------------------------------------------------
> 
> (Updated July 21, 2016, 10:38 p.m.)
> 
> 
> Review request for mesos and Benjamin Mahler.
> 
> 
> Bugs: MESOS-5739
>     https://issues.apache.org/jira/browse/MESOS-5739
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Fixed Value parsing code to only accept the canonical formats.
> NOTES: This patch isn't doing a complete validation against 
> the canonical format yet: the set entries is not validated as
> conforming to the Values.Text format yet.
> 
> 
> Diffs
> -----
> 
>   src/common/values.cpp 7b8a8ea00bd4bd1a82c33be4438c26b2731b1dd8 
>   src/tests/values_tests.cpp cc17b675d5d3768685b44a1cea64264dcbca80ba 
>   src/v1/values.cpp ff1926f9ab26c3ac3ab62b6df3ce305f5d12f12e 
> 
> Diff: https://reviews.apache.org/r/49223/diff/
> 
> 
> Testing
> -------
> 
> make && make check
> 
> 
> Thanks,
> 
> Klaus Ma
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message