----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/65812/#review203430 -----------------------------------------------------------
3rdparty/stout/include/stout/os/posix/realpath.hpp Lines 51 (patched) <https://reviews.apache.org/r/65812/#comment285647> Any reason we need this parameter here? Can we just remove this parameter, and use `os::PATH_SEPARATOR` below? 3rdparty/stout/include/stout/os/posix/realpath.hpp Lines 65 (patched) <https://reviews.apache.org/r/65812/#comment285648> No need for period for error messages. 3rdparty/stout/include/stout/os/posix/realpath.hpp Lines 88 (patched) <https://reviews.apache.org/r/65812/#comment285678> No need to specify `_separator`? 3rdparty/stout/include/stout/os/posix/realpath.hpp Lines 98-99 (patched) <https://reviews.apache.org/r/65812/#comment285685> Hum, consider this case: ``` path="/rootfs/bar" root="/rootfs" ``` I was expecting the correct result to be `"/rootfs/bar"` (if I understand your function parameter correctly, if not, can you add more description for the parameters?) Assuming that there's a symlink in the rootfs `/rootfs/rootfs -> /foo` (symlink). When we process `"rootfs"` here (i.e., `component`), `normalizedPath == "/rootfs"`, and `fullPath == "/rootfs/rootfs"`. Since `/rootfs/rootfs` is a symlink, `linkPath` will be `"/foo"`. `"unprocessed"` will become `"/foo/bar"`. Maybe the parameter `path` is scoped in the `root`? If that's the case, can you improve the function comments with more examples? 3rdparty/stout/include/stout/os/posix/realpath.hpp Lines 99 (patched) <https://reviews.apache.org/r/65812/#comment285681> no need to specify `_separator` for both functions. They're the default value 3rdparty/stout/include/stout/os/posix/realpath.hpp Lines 102-107 (patched) <https://reviews.apache.org/r/65812/#comment285682> you can use `os::stat::islink` here 3rdparty/stout/include/stout/os/posix/realpath.hpp Lines 108-112 (patched) <https://reviews.apache.org/r/65812/#comment285683> Let's add a stout helper `os::readlink`: ``` Try<string> readlink(const string& path); ``` 3rdparty/stout/include/stout/os/posix/realpath.hpp Lines 130 (patched) <https://reviews.apache.org/r/65812/#comment285679> Ditto. No need for `_separator` - Jie Yu On May 17, 2018, 1:07 a.m., Jason Lai wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/65812/ > ----------------------------------------------------------- > > (Updated May 17, 2018, 1:07 a.m.) > > > Review request for mesos, Anish Gupta, Eric Chung, Gilbert Song, Jie Yu, > James Peach, and Zhitao Li. > > > Bugs: MESOS-8257 > https://issues.apache.org/jira/browse/MESOS-8257 > > > Repository: mesos > > > Description > ------- > > Added an overloaded version of `os::realpath` to stout. > > The new `os::realpath` function is used for evaluating real path > within a scoped root directory. > > > Diffs > ----- > > 3rdparty/stout/include/stout/os/posix/realpath.hpp > 31352cefc5b8d0ccd9af8f6dabdec4a959fded32 > > > Diff: https://reviews.apache.org/r/65812/diff/6/ > > > Testing > ------- > > > Thanks, > > Jason Lai > >