----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/68804/#review210424 -----------------------------------------------------------
Can you please add a simple test case? Just update `FsTest.SYMLINK_Symlink` to read back the symlink is fine. 3rdparty/stout/tests/os/filesystem_tests.cpp 3rdparty/stout/include/stout/os/posix/readlink.hpp Lines 24 (patched) <https://reviews.apache.org/r/68804/#comment295089> For consistency, we should have a Windows version that does: ``` Try<std::string> readlink(const std::string& path) = delete; ``` 3rdparty/stout/include/stout/os/posix/readlink.hpp Lines 27 (patched) <https://reviews.apache.org/r/68804/#comment295088> To detect truncation we should do something like this: ``` char temp[PATH_MAX + 1]; ssize_t len = ::readlink(path.c_str(), temp, sizeof(temp)); if (len == -1) { return ErrnoError(); } // Name is truncated and not NUL-terminated. if (len >= sizeof(temp)) { return ErrnoError(ENAMETOOLONG); } return std::string(temp); ``` - James Peach On Nov. 7, 2018, 9:22 p.m., Jason Lai wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/68804/ > ----------------------------------------------------------- > > (Updated Nov. 7, 2018, 9:22 p.m.) > > > Review request for mesos, 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 `os::readlink` for reading value of a POSIX symbolic link. > > > Diffs > ----- > > 3rdparty/stout/include/stout/os/posix/readlink.hpp PRE-CREATION > > > Diff: https://reviews.apache.org/r/68804/diff/2/ > > > Testing > ------- > > > Thanks, > > Jason Lai > >
