mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Hopcroft" <>
Subject Re: Review Request 39803: Windows: Implemented stout/os/stat.hpp`.
Date Wed, 04 Nov 2015 18:08:29 GMT

This is an automatically generated e-mail. To reply, visit:

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 26)

    Good comment!

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 32)

    I wonder if there is any good way of protecting ourselves from breaking changes associated
with _REPARSE_DATA_BUFFER. Perhaps you should consider setting WINVER in windows.hpp. Then
you could add a static_assert on the value of WINVER in this header.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 33)

    Consider adding one-line comments for each field.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 45)

    One line comment for this field is important since the length is in bytes, not WCHARS.
Same for line 55.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 49)

    Are you sure these buffers of size 1 are correct? I'm assuming that the remainder of the
buffer follows the _REPARSE_DATA_BUFFER in the block of memory.
    I would add a comment explaining this.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 51)

    Recommend putting a blank line before this comment to that it is absolutely clear which
struct it refers to.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 71)

    Who actually uses this struct. The reason I ask is that it has wstrings inside instead
of strings. Will the user be forced to do the conversion? Perhaps you should be doing the
conversion for them here.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 73)

    Be aware the std::wstring can throw exceptions. If stout has a strong no-exception guarantee,
you should review the code paths to make sure that this exception is caught somewhere inside
of stout.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 75)

    If this struct is part of the API, it should have better documentation. One cannot know
what flags is without reading the implementation in this file.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 84)

    Should check for return value of  INVALID_FILE_ATTRIBUTES or add an explanatory comment
if the code on line 85 correctly handles this case.
    In general, your logic should not make any assumptions on what INVALID_FILE_ATTRIBUTES
actually equals.
    Oh - I see - you check for INVALID_FILE_ATTRIBUTES on line 89. In general line 85 is bad
form because reparseBitSet is only valid when attributes != INVALID_FILE_ATTRIBUTES. Recommend
writing code so that reparseBitSet is valid during its entire lifetime.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 87)

    And get rid of this comment. It assumes that INVALID_FILE_ATTRIBUTES == -1, which may
not always be true. This comment shouldn't be necessary if you rework the logic per my comment
on line 84.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 104)

    Divide by sizeof(WCHAR). Same goes for lines 106, 111, and 113.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 108)

    I prefer "data.SymbolicLinkReparseBuffer.PathBuffer + printNameStartIndex", but some might
consider this a religious or stylistic difference. My opinion is that you shouldn't dereference
the pointer ([]) if you are then going to take its address.
    Same goes for line 115.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 145)

    "or a file" not "of a file"

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 147)

    Could you track down a more definitive source to quote?
    Also, perhaps you could get Microsoft to create a work item for updating MSDN.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 152)

    The ternary operator has precedence that is sometimes confusing to some programmers. Recommend
using parens to make grouping explicit.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 165)

    Finish this.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 168)

    Consider using some sort of RAII auto-handle that closes when it goes out of scope.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 199)

    Recommend using RAII pattern (e.g. std::unique_ptr) to eliminate leaking of reparsePointData
in the presense of exceptions or logic errors.
    Since this is C++ code, recommend using new [] instead of malloc/free.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 201)

    Consider swapping lines 199 and 201. Make allocation take reparsePointDataSize as a parameter.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 202)

    Consider naming this "ignored" instead of "junk"

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 218)

    Again, it is bad form to have the free() in two places (here and line 223). Use std::unique_ptr.

3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp (line 219)

    Implement this.

3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/stat.hpp (line 125)

    It is probably good practice to include information about the site of the error. First
idea is to just adopt a convention of prefixing each method with "functionName:". Better idea
is to modify error.hpp so that ErrnoError() becomes a macro that prepends the file name and
line number.
    This comment applies to all of your functions.

3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/stat.hpp (line 128)

    Might want to static_assert that _USE_32BIT_TIME_T is not defined. Probably sound advice
for _UNICODE and _MBCS as well. Perhaps these static asserts should go in windows.hpp? If
you put them there, add a comment saying why the asserts are necessary (e.g. "Implementation
of mtime() assumes ...")

3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/stat.hpp (line 152)

    Have you checked all of the return types to ensure they are what you think they are? Windows
has a lot of #ifdefs for these types and it is possible that an unexpected cast could cause
problems. I would look at the definition of each field type in _stat and add static asserts
where necessary to ensure the type is what you think it is. Another possibility is that your
functions return types like "unsigned int" and perform the casting from s.st_dev directly
in your function.

3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/stat.hpp (line 164)

    According to the Windows documentation, "The inode, and therefore st_ino, has no meaning
in the FAT, HPFS, or NTFS file systems." Will this be a problem?

- Michael Hopcroft

On Nov. 1, 2015, 1:31 a.m., Alex Clemmer wrote:
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> -----------------------------------------------------------
> (Updated Nov. 1, 2015, 1:31 a.m.)
> Review request for mesos, Artem Harutyunyan, Michael Hopcroft, Joris Van Remoortere,
and Joseph Wu.
> Repository: mesos
> Description
> -------
> Windows: Implemented stout/os/stat.hpp`.
> Diffs
> -----
>   3rdparty/libprocess/3rdparty/stout/include/ 67b142bbc2d80f40a1e893cc5813d58dd2aa8381

>   3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/reparsepoint.hpp
>   3rdparty/libprocess/3rdparty/stout/include/stout/internal/windows/symlink.hpp PRE-CREATION

>   3rdparty/libprocess/3rdparty/stout/include/stout/os/windows/stat.hpp 675b2e712358a55b3580026936890eaf80e5af71

>   3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp 1a7037d64afeedc340258c92067e95d1d3caa027

> Diff:
> Testing
> -------
> `make check` from autotools on Ubuntu 15.
> `make check` from CMake on OS X 10.10.
> Ran `check` project in VS on Windows 10.
> Thanks,
> Alex Clemmer

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message