[
https://issues.apache.org/jira/browse/MESOS-5237?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Park reassigned MESOS-5237:
-----------------------------------
Assignee: Michael Park
> The windows version of `os::access` has differing behavior than the POSIX
> version.
> ----------------------------------------------------------------------------------
>
> Key: MESOS-5237
> URL: https://issues.apache.org/jira/browse/MESOS-5237
> Project: Mesos
> Issue Type: Bug
> Components: stout
> Reporter: Michael Park
> Assignee: Michael Park
> Labels: mesosphere,, windows
>
> The POSIX version of {{os::access}} looks like this:
> {code}
> inline Try<bool> access(const std::string& path, int how)
> {
> if (::access(path.c_str(), how) < 0) {
> if (errno == EACCES) {
> return false;
> } else {
> return ErrnoError();
> }
> }
> return true;
> }
> {code}
> Compare this to the Windows version of {{os::access}} which looks like this
> following:
> {code}
> inline Try<bool> access(const std::string& fileName, int how)
> {
> if (::_access(fileName.c_str(), how) != 0) {
> return ErrnoError("access: Could not access path '" + fileName + "'");
> }
> return true;
> }
> {code}
> As we can see, the case where {{errno}} is set to {{EACCES}} is handled
> differently between the 2 functions.
> We can actually consolidate the 2 functions by simply using the POSIX
> version. The challenge is that on POSIX, we should use {{::access}} and
> {{_::access}} on Windows. Note however, that this problem is already solved,
> as we have an implementation of {{::access}} for Windows in
> {{3rdparty/libprocess/3rdparty/stout/include/stout/windows.hpp}} which simply
> defers to {{::_access}}.
> Thus, I propose to simply consolidate the 2 implementations.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)