You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Benjamin Bannier <be...@mesosphere.io> on 2018/01/25 06:32:54 UTC
Re: Review Request 65322: Made `numify` less dependent on
`boost::lexical_cast` failure behavior.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65322/
-----------------------------------------------------------
(Updated Jan. 25, 2018, 7:32 a.m.)
Review request for mesos, Benno Evers, Till Toenshoff, and Cong Wang.
Bugs: MESOS-8484
https://issues.apache.org/jira/browse/MESOS-8484
Repository: mesos
Description
-------
Previously we relied on Boost to never successfully parse hexadecimal
numbers, and only performed rejection of hexadecimal floating point
numbers before entering our custom parser for hexadecimal numbers.
This was not reliable as on some platforms `boost::lexical_cast` ended
up successfully parsing literals of hexadecimal floating point numbers
leading us to never rejecting hexadecimal floating point numbers.
This patch moves the rejection of hexadecimal floating point numbers
to a point before attempting a parse with `boost::lexical_cast`. While
this decouples us in some regards from Boost's parsing behavior, we
also might end up performing more work than needed. Should this become
a concern we should revisit and optimize the implementation here.
Diffs
-----
3rdparty/stout/include/stout/numify.hpp 6db9a78145b7e90cc975786ca83f7acb7fdc3e0a
Diff: https://reviews.apache.org/r/65322/diff/1/
Testing
-------
`make check` on a collection of Linux, macos and Windows setups in internal CI.
Thanks,
Benjamin Bannier
Re: Review Request 65322: Made `numify` less dependent on
`boost::lexical_cast` failure behavior.
Posted by Benjamin Bannier <be...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65322/
-----------------------------------------------------------
(Updated Jan. 25, 2018, 5:17 p.m.)
Review request for mesos, Benno Evers, Till Toenshoff, and Cong Wang.
Changes
-------
Addressed comments from Till.
Bugs: MESOS-8484
https://issues.apache.org/jira/browse/MESOS-8484
Repository: mesos
Description
-------
Previously we relied on Boost to never successfully parse hexadecimal
numbers, and only performed rejection of hexadecimal floating point
numbers before entering our custom parser for hexadecimal numbers.
This was not reliable as on some platforms `boost::lexical_cast` ended
up successfully parsing literals of hexadecimal floating point numbers
leading us to never rejecting hexadecimal floating point numbers.
This patch moves the rejection of hexadecimal floating point numbers
to a point before attempting a parse with `boost::lexical_cast`. While
this decouples us in some regards from Boost's parsing behavior, we
also might end up performing more work than needed. Should this become
a concern we should revisit and optimize the implementation here.
Diffs (updated)
-----
3rdparty/stout/include/stout/numify.hpp 6db9a78145b7e90cc975786ca83f7acb7fdc3e0a
Diff: https://reviews.apache.org/r/65322/diff/3/
Changes: https://reviews.apache.org/r/65322/diff/2-3/
Testing
-------
`make check` on a collection of Linux, macos and Windows setups in internal CI.
Thanks,
Benjamin Bannier
Re: Review Request 65322: Made `numify` less dependent on
`boost::lexical_cast` failure behavior.
Posted by Mesos Reviewbot Windows <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65322/#review196262
-----------------------------------------------------------
PASS: Mesos patch 65322 was successfully built and tested.
Reviews applied: `['65322']`
All the build artifacts available at: http://dcos-win.westus.cloudapp.azure.com/mesos-build/review/65322
- Mesos Reviewbot Windows
On Jan. 25, 2018, 2:32 p.m., Benjamin Bannier wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65322/
> -----------------------------------------------------------
>
> (Updated Jan. 25, 2018, 2:32 p.m.)
>
>
> Review request for mesos, Benno Evers, Till Toenshoff, and Cong Wang.
>
>
> Bugs: MESOS-8484
> https://issues.apache.org/jira/browse/MESOS-8484
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Previously we relied on Boost to never successfully parse hexadecimal
> numbers, and only performed rejection of hexadecimal floating point
> numbers before entering our custom parser for hexadecimal numbers.
> This was not reliable as on some platforms `boost::lexical_cast` ended
> up successfully parsing literals of hexadecimal floating point numbers
> leading us to never rejecting hexadecimal floating point numbers.
>
> This patch moves the rejection of hexadecimal floating point numbers
> to a point before attempting a parse with `boost::lexical_cast`. While
> this decouples us in some regards from Boost's parsing behavior, we
> also might end up performing more work than needed. Should this become
> a concern we should revisit and optimize the implementation here.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/numify.hpp 6db9a78145b7e90cc975786ca83f7acb7fdc3e0a
>
>
> Diff: https://reviews.apache.org/r/65322/diff/2/
>
>
> Testing
> -------
>
> `make check` on a collection of Linux, macos and Windows setups in internal CI.
>
>
> Thanks,
>
> Benjamin Bannier
>
>
Re: Review Request 65322: Made `numify` less dependent on
`boost::lexical_cast` failure behavior.
Posted by Mesos Reviewbot Windows <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65322/#review196259
-----------------------------------------------------------
PASS: Mesos patch 65322 was successfully built and tested.
Reviews applied: `['65322']`
All the build artifacts available at: http://dcos-win.westus.cloudapp.azure.com/mesos-build/review/65322
- Mesos Reviewbot Windows
On Jan. 25, 2018, 2:32 p.m., Benjamin Bannier wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65322/
> -----------------------------------------------------------
>
> (Updated Jan. 25, 2018, 2:32 p.m.)
>
>
> Review request for mesos, Benno Evers, Till Toenshoff, and Cong Wang.
>
>
> Bugs: MESOS-8484
> https://issues.apache.org/jira/browse/MESOS-8484
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Previously we relied on Boost to never successfully parse hexadecimal
> numbers, and only performed rejection of hexadecimal floating point
> numbers before entering our custom parser for hexadecimal numbers.
> This was not reliable as on some platforms `boost::lexical_cast` ended
> up successfully parsing literals of hexadecimal floating point numbers
> leading us to never rejecting hexadecimal floating point numbers.
>
> This patch moves the rejection of hexadecimal floating point numbers
> to a point before attempting a parse with `boost::lexical_cast`. While
> this decouples us in some regards from Boost's parsing behavior, we
> also might end up performing more work than needed. Should this become
> a concern we should revisit and optimize the implementation here.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/numify.hpp 6db9a78145b7e90cc975786ca83f7acb7fdc3e0a
>
>
> Diff: https://reviews.apache.org/r/65322/diff/2/
>
>
> Testing
> -------
>
> `make check` on a collection of Linux, macos and Windows setups in internal CI.
>
>
> Thanks,
>
> Benjamin Bannier
>
>
Re: Review Request 65322: Made `numify` less dependent on
`boost::lexical_cast` failure behavior.
Posted by Till Toenshoff <to...@me.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65322/#review196260
-----------------------------------------------------------
Fix it, then Ship it!
3rdparty/stout/include/stout/numify.hpp
Lines 32 (patched)
<https://reviews.apache.org/r/65322/#comment275807>
s/number/numbers/
3rdparty/stout/include/stout/numify.hpp
Lines 33 (patched)
<https://reviews.apache.org/r/65322/#comment275808>
s/seem/seems/
s/macos/macOS/
3rdparty/stout/include/stout/numify.hpp
Lines 35 (patched)
<https://reviews.apache.org/r/65322/#comment275809>
s/number/numbers/
- Till Toenshoff
On Jan. 25, 2018, 2:32 p.m., Benjamin Bannier wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65322/
> -----------------------------------------------------------
>
> (Updated Jan. 25, 2018, 2:32 p.m.)
>
>
> Review request for mesos, Benno Evers, Till Toenshoff, and Cong Wang.
>
>
> Bugs: MESOS-8484
> https://issues.apache.org/jira/browse/MESOS-8484
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Previously we relied on Boost to never successfully parse hexadecimal
> numbers, and only performed rejection of hexadecimal floating point
> numbers before entering our custom parser for hexadecimal numbers.
> This was not reliable as on some platforms `boost::lexical_cast` ended
> up successfully parsing literals of hexadecimal floating point numbers
> leading us to never rejecting hexadecimal floating point numbers.
>
> This patch moves the rejection of hexadecimal floating point numbers
> to a point before attempting a parse with `boost::lexical_cast`. While
> this decouples us in some regards from Boost's parsing behavior, we
> also might end up performing more work than needed. Should this become
> a concern we should revisit and optimize the implementation here.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/numify.hpp 6db9a78145b7e90cc975786ca83f7acb7fdc3e0a
>
>
> Diff: https://reviews.apache.org/r/65322/diff/2/
>
>
> Testing
> -------
>
> `make check` on a collection of Linux, macos and Windows setups in internal CI.
>
>
> Thanks,
>
> Benjamin Bannier
>
>
Re: Review Request 65322: Made `numify` less dependent on
`boost::lexical_cast` failure behavior.
Posted by Benjamin Bannier <be...@mesosphere.io>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65322/
-----------------------------------------------------------
(Updated Jan. 25, 2018, 3:32 p.m.)
Review request for mesos, Benno Evers, Till Toenshoff, and Cong Wang.
Changes
-------
Addressed comments from Benno.
Bugs: MESOS-8484
https://issues.apache.org/jira/browse/MESOS-8484
Repository: mesos
Description
-------
Previously we relied on Boost to never successfully parse hexadecimal
numbers, and only performed rejection of hexadecimal floating point
numbers before entering our custom parser for hexadecimal numbers.
This was not reliable as on some platforms `boost::lexical_cast` ended
up successfully parsing literals of hexadecimal floating point numbers
leading us to never rejecting hexadecimal floating point numbers.
This patch moves the rejection of hexadecimal floating point numbers
to a point before attempting a parse with `boost::lexical_cast`. While
this decouples us in some regards from Boost's parsing behavior, we
also might end up performing more work than needed. Should this become
a concern we should revisit and optimize the implementation here.
Diffs (updated)
-----
3rdparty/stout/include/stout/numify.hpp 6db9a78145b7e90cc975786ca83f7acb7fdc3e0a
Diff: https://reviews.apache.org/r/65322/diff/2/
Changes: https://reviews.apache.org/r/65322/diff/1-2/
Testing
-------
`make check` on a collection of Linux, macos and Windows setups in internal CI.
Thanks,
Benjamin Bannier
Re: Review Request 65322: Made `numify` less dependent on
`boost::lexical_cast` failure behavior.
Posted by Benjamin Bannier <be...@mesosphere.io>.
> On Jan. 25, 2018, 2:18 p.m., Benno Evers wrote:
> > 3rdparty/stout/include/stout/numify.hpp
> > Lines 34 (patched)
> > <https://reviews.apache.org/r/65322/diff/1/?file=1946053#file1946053line34>
> >
> > Its not your comment, but this point sounds like a red herring to me: We're always parsing strings here, so the it shouldn't matter what the rules for permissible floating-point literals are.
I agree, it also does not matter what some standard has to say about hex number formats; we are parsing a string here. I trimmed this comment.
> On Jan. 25, 2018, 2:18 p.m., Benno Evers wrote:
> > 3rdparty/stout/include/stout/numify.hpp
> > Lines 43 (patched)
> > <https://reviews.apache.org/r/65322/diff/1/?file=1946053#file1946053line43>
> >
> > Why 'maybe'? I'd suggest
> >
> > ```
> > bool isHex = strings::startsWith(s, "0x") || ...;
> > ```
I used `maybe` since this is only a heuristic which would e.g., match a string like `0x XYZ` as well which is not a literal of a hex number.
- Benjamin
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65322/#review196239
-----------------------------------------------------------
On Jan. 25, 2018, 3:32 p.m., Benjamin Bannier wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65322/
> -----------------------------------------------------------
>
> (Updated Jan. 25, 2018, 3:32 p.m.)
>
>
> Review request for mesos, Benno Evers, Till Toenshoff, and Cong Wang.
>
>
> Bugs: MESOS-8484
> https://issues.apache.org/jira/browse/MESOS-8484
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Previously we relied on Boost to never successfully parse hexadecimal
> numbers, and only performed rejection of hexadecimal floating point
> numbers before entering our custom parser for hexadecimal numbers.
> This was not reliable as on some platforms `boost::lexical_cast` ended
> up successfully parsing literals of hexadecimal floating point numbers
> leading us to never rejecting hexadecimal floating point numbers.
>
> This patch moves the rejection of hexadecimal floating point numbers
> to a point before attempting a parse with `boost::lexical_cast`. While
> this decouples us in some regards from Boost's parsing behavior, we
> also might end up performing more work than needed. Should this become
> a concern we should revisit and optimize the implementation here.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/numify.hpp 6db9a78145b7e90cc975786ca83f7acb7fdc3e0a
>
>
> Diff: https://reviews.apache.org/r/65322/diff/2/
>
>
> Testing
> -------
>
> `make check` on a collection of Linux, macos and Windows setups in internal CI.
>
>
> Thanks,
>
> Benjamin Bannier
>
>
Re: Review Request 65322: Made `numify` less dependent on
`boost::lexical_cast` failure behavior.
Posted by Benno Evers <be...@mesosphere.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65322/#review196239
-----------------------------------------------------------
Fix it, then Ship it!
3rdparty/stout/include/stout/numify.hpp
Lines 34 (patched)
<https://reviews.apache.org/r/65322/#comment275787>
Its not your comment, but this point sounds like a red herring to me: We're always parsing strings here, so the it shouldn't matter what the rules for permissible floating-point literals are.
3rdparty/stout/include/stout/numify.hpp
Lines 43 (patched)
<https://reviews.apache.org/r/65322/#comment275784>
Why 'maybe'? I'd suggest
```
bool isHex = strings::startsWith(s, "0x") || ...;
```
3rdparty/stout/include/stout/numify.hpp
Line 32 (original), 55 (patched)
<https://reviews.apache.org/r/65322/#comment275788>
Strictly speaking, since boost is just using `std::istream::operator>>` for numbers anyways, we could just not use boost here at all and just use the code in the `try`-block for everything.
3rdparty/stout/include/stout/numify.hpp
Line 53 (original), 65 (patched)
<https://reviews.apache.org/r/65322/#comment275786>
Not too important, but it took me a while to understand what this note is trying to say. Would suggest changing to something like:
```
Negating `result` is safe even if T is an unsigned integer type, because the C++ standard defines the result to be modulo 2^n in that case.
```
- Benno Evers
On Jan. 25, 2018, 6:32 a.m., Benjamin Bannier wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65322/
> -----------------------------------------------------------
>
> (Updated Jan. 25, 2018, 6:32 a.m.)
>
>
> Review request for mesos, Benno Evers, Till Toenshoff, and Cong Wang.
>
>
> Bugs: MESOS-8484
> https://issues.apache.org/jira/browse/MESOS-8484
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Previously we relied on Boost to never successfully parse hexadecimal
> numbers, and only performed rejection of hexadecimal floating point
> numbers before entering our custom parser for hexadecimal numbers.
> This was not reliable as on some platforms `boost::lexical_cast` ended
> up successfully parsing literals of hexadecimal floating point numbers
> leading us to never rejecting hexadecimal floating point numbers.
>
> This patch moves the rejection of hexadecimal floating point numbers
> to a point before attempting a parse with `boost::lexical_cast`. While
> this decouples us in some regards from Boost's parsing behavior, we
> also might end up performing more work than needed. Should this become
> a concern we should revisit and optimize the implementation here.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/numify.hpp 6db9a78145b7e90cc975786ca83f7acb7fdc3e0a
>
>
> Diff: https://reviews.apache.org/r/65322/diff/1/
>
>
> Testing
> -------
>
> `make check` on a collection of Linux, macos and Windows setups in internal CI.
>
>
> Thanks,
>
> Benjamin Bannier
>
>
Re: Review Request 65322: Made `numify` less dependent on
`boost::lexical_cast` failure behavior.
Posted by Mesos Reviewbot Windows <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/65322/#review196220
-----------------------------------------------------------
PASS: Mesos patch 65322 was successfully built and tested.
Reviews applied: `['65322']`
All the build artifacts available at: http://dcos-win.westus.cloudapp.azure.com/mesos-build/review/65322
- Mesos Reviewbot Windows
On Jan. 25, 2018, 6:32 a.m., Benjamin Bannier wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/65322/
> -----------------------------------------------------------
>
> (Updated Jan. 25, 2018, 6:32 a.m.)
>
>
> Review request for mesos, Benno Evers, Till Toenshoff, and Cong Wang.
>
>
> Bugs: MESOS-8484
> https://issues.apache.org/jira/browse/MESOS-8484
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Previously we relied on Boost to never successfully parse hexadecimal
> numbers, and only performed rejection of hexadecimal floating point
> numbers before entering our custom parser for hexadecimal numbers.
> This was not reliable as on some platforms `boost::lexical_cast` ended
> up successfully parsing literals of hexadecimal floating point numbers
> leading us to never rejecting hexadecimal floating point numbers.
>
> This patch moves the rejection of hexadecimal floating point numbers
> to a point before attempting a parse with `boost::lexical_cast`. While
> this decouples us in some regards from Boost's parsing behavior, we
> also might end up performing more work than needed. Should this become
> a concern we should revisit and optimize the implementation here.
>
>
> Diffs
> -----
>
> 3rdparty/stout/include/stout/numify.hpp 6db9a78145b7e90cc975786ca83f7acb7fdc3e0a
>
>
> Diff: https://reviews.apache.org/r/65322/diff/1/
>
>
> Testing
> -------
>
> `make check` on a collection of Linux, macos and Windows setups in internal CI.
>
>
> Thanks,
>
> Benjamin Bannier
>
>