You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Joseph Wu (JIRA)" <ji...@apache.org> on 2017/03/25 04:13:42 UTC

[jira] [Assigned] (MESOS-7300) Mesos failed to build on Windows due to error C2440: 'return': cannot convert from 'Error' to 'bool'

     [ https://issues.apache.org/jira/browse/MESOS-7300?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joseph Wu reassigned MESOS-7300:
--------------------------------

       Resolution: Fixed
         Assignee: Andrew Schwartzmeyer
    Fix Version/s: 1.3.0

{code}
commit 1de39e676a0dc5f78eeff303cb0eba5467168b9f
Author: Andrew Schwartzmeyer <an...@schwartzmeyer.com>
Date:   Fri Mar 24 21:07:30 2017 -0700

    Windows: Fixed return of bad types in stat.hpp.
    
    Commit 5f159cdcb introduced `return Error(...)` logic to functions
    which return `bool`, not `Try<bool>`, which broke the Windows build.
    
    Furthermore, in the instances of `isdir` and `isfile`, erroring
    when asked to not follow a symlink is not correct. The semantics
    of symlinks provide clear answers to `isdir` and `isfile` when the
    target is a link, and is not being followed (it is neither a regular
    file nor a directory).
    
    We explicitly match the POSIX semantics for `isfile` where `S_IFREG`
    returns `false` for symbolic links.
    
    For the functions `mode` and `dev`, which return types wrapped by `Try`,
    we should only error if asked not to follow symlinks, and the target is
    actually a symlink. If it is not a symlink to begin with, we should not
    prematurely error. If it is a symlink, we should error because there is
    no equivalent of `lstat` on Windows to obtain `st_mode` or `st_dev` of a
    symlink itself.
    
    Review: https://reviews.apache.org/r/57926/
{code}

> Mesos failed to build on Windows due to error C2440: 'return': cannot convert from 'Error' to 'bool'
> ----------------------------------------------------------------------------------------------------
>
>                 Key: MESOS-7300
>                 URL: https://issues.apache.org/jira/browse/MESOS-7300
>             Project: Mesos
>          Issue Type: Bug
>          Components: build
>         Environment: Windows Server 2012 R2 + VS2015 Update 3
>            Reporter: Karen Huang
>            Assignee: Andrew Schwartzmeyer
>            Priority: Blocker
>             Fix For: 1.3.0
>
>
> I try to build Mesos (master branch revision 322300f) with VS2015 Update 3 on Windows. It failed to build with the following error:
> D:\Mesos\src\3rdparty\stout\include\stout/os/windows/stat.hpp(41): error C2440: 'return': cannot convert from 'Error' to 'bool' (compiling source file D:\Mesos\src\3rdparty\libprocess\src\time.cpp) [D:\Mesos\build_x64\3rdparty\libprocess\src\process-0.0.1.vcxproj]
> D:\Mesos\src\3rdparty\stout\include\stout/os/windows/stat.hpp(59): error C2440: 'return': cannot convert from 'Error' to 'bool' (compiling source file D:\Mesos\src\3rdparty\libprocess\src\time.cpp) [D:\Mesos\build_x64\3rdparty\libprocess\src\process-0.0.1.vcxproj]
> This issue starts to be reproduce form master branch revision "82e4077" (https://github.com/apache/mesos/commit/82e4077ceb40e84c2796be43f1448eec0bfd7c69#diff-76a72473075f57f8d0d3b3bf6f150672)
> I presume this is a issue in your source code. The function "inline bool isdir(  const std::string& path, const FollowSymlink follow = FOLLOW_SYMLINK)"
> needs a bool type return value. But the return value type of "Error("Non-following stat not supported for '" + path + "'")" is not bool.
> In D:\Mesos\src\3rdparty\stout\include\stout\os\windows\stat.hpp file:
> inline bool isdir(
>     const std::string& path,
>     const FollowSymlink follow = FOLLOW_SYMLINK)
> {
>   struct _stat s;
>   if (follow == DO_NOT_FOLLOW_SYMLINK) {
>       return Error("Non-following stat not supported for '" + path + "'");
>   }
>   if (::_stat(path.c_str(), &s) < 0) {
>     return false;
>   }
>   return S_ISDIR(s.st_mode);
> }
> In D:\Mesos\src\3rdparty\stout\include\stout\errorbase.hpp file:
> class Error
> {
> public:
>   explicit Error(const std::string& _message) : message(_message) {}
>   const std::string message;
> };



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)