> On Feb. 9, 2015, 12:07 p.m., Ian Downes wrote: > > 3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp, line 405 > > <https://reviews.apache.org/r/30609/diff/2/?file=853657#file853657line405> > > > > this is leaking the implementation, both that it's using stat and that > > it's using lstat in particular. Why not just have size(path) do the right > > thing, e.g., follow the link if it's a symlink, and return an error if it's > > something for which it doesn't make sense? > > Bernd Mathiske wrote: > What would be a good name that conveys that in case of a link we just > want the link's size and not the referenced file's size? How can we make it > so that a user realizes what this does without reading the implementation? > Absent other suggestions, and not using lstat, I am proposing "ownsize". > > Reporting the referenced file's size is the wrong thing in my use case. > Thanks for pointing that out in a prior review! I do not have any use right > now for the "size()" variant that follows the link.
Ahh, apologies, I was stuck on the more common need to get the size of the linked file and didn't register that you did want the size of the link. - Ian ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/30609/#review71686 ----------------------------------------------------------- On Feb. 10, 2015, 3:19 a.m., Bernd Mathiske wrote: > > ----------------------------------------------------------- > This is an automatically generated e-mail. To reply, visit: > https://reviews.apache.org/r/30609/ > ----------------------------------------------------------- > > (Updated Feb. 10, 2015, 3:19 a.m.) > > > Review request for mesos, Adam B, Benjamin Hindman, Till Toenshoff, and > Timothy Chen. > > > Bugs: MESOS-2072 > https://issues.apache.org/jira/browse/MESOS-2072 > > > Repository: mesos > > > Description > ------- > > This returns a file's size as reported by lstat(). (Not stat(). It is desired > that in case of a link, the size of the link, not the size of the referenced > file, is returned.) > > > Diffs > ----- > > 3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp > 8a4fda97ee29c185471a69f60803efc193cbe922 > 3rdparty/libprocess/3rdparty/stout/tests/os_tests.cpp > 8a2d445c2edaa70da0e7b50e14ef88b2d9224a16 > > Diff: https://reviews.apache.org/r/30609/diff/ > > > Testing > ------- > > Wrote a simple test that creates a file and tests its size, and also checks > if a non-existing file yields an error. > > > Thanks, > > Bernd Mathiske > >