----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/56906/ -----------------------------------------------------------
(Updated Feb. 27, 2017, 4:46 p.m.) Review request for mesos and Anand Mazumdar. Changes ------- Changed to a less-invasive approach, of just changing one continuation of the `FilesProcess` with some extra validation logic. This results in a much smaller patch overall, and less duplication. Summary (updated) ----------------- Dealt with a corner case in the ReadFile API. Repository: mesos Description ------- The canonical integer type used when dealing with files in Posix is an `off_t`, or a signed 64-bit integer. In our `FilesProcess`, we actually use a `size_t`, an unsigned 64-bit integer, to represent file offsets and lengths. This opens up the potential for passing in negative values (in 2's complement, an unsigned value greater than 2^63 - 1 becomes a negative value when casted to a signed value) for the offset and length. In the current code, this leads to a discrepancy in return values when a caller uses the `/files/read` endpoint versus the `ReadFile` V1 API: Calling `/files/read?offset=9223372036854775808` (2^63) will return a `400 Bad Request`. Performing the equivalent call via `ReadFile` will instead return a `200 OK`, with no data actually read. Diffs (updated) ----- src/files/files.cpp 8327f8002fbfa3be77a4bbe4aa83a73d0f170f7a src/tests/api_tests.cpp 24f31ff133185a3224f9edaf8b8532d5630b34c2 src/tests/files_tests.cpp 6c6353e406249f021803e83909415e9908ded28c Diff: https://reviews.apache.org/r/56906/diff/ Testing (updated) ------- make check src/mesos-tests --gtest_filter="*FilesTest*:*MasterAPITest*" Thanks, Joseph Wu
