Andrew Schwartzmeyer created MESOS-8646:
-------------------------------------------

             Summary: `internal::windows::get_handle_follow` has incorrect 
sharing permissions
                 Key: MESOS-8646
                 URL: https://issues.apache.org/jira/browse/MESOS-8646
             Project: Mesos
          Issue Type: Bug
    Affects Versions: 1.5.0
            Reporter: Andrew Schwartzmeyer
            Assignee: John Kordich
             Fix For: 1.6.0, 1.5.1


When implementing {{os::realpath}}, we needed to use 
{{GetFinalPathNameByHandle}} to properly resolve symlinks, which requires an 
actual {{HANDLE}} to the file. For the sharing permissions, we set 
{{FILE_SHARE_READ,  // Just reading this file, allow others to do the same.}}, 
thinking this correct because we only needed read permissions, and were 
otherwise willing to share the file.

However, this is incorrect, as we need to share the file with other processes 
that may be writing or even trying to delete the file. So these sharing 
permissions should be {{FILE_SHARE_READ | FILE_SHARE_WRITE | 
FILE_SHARE_DELETE}}. Note that we still open the file only for reading with 
{{GENERIC_READ}}.

This causes bugs when Mesos tries to get the realpath of files that may be 
"busy" elsewhere, such as log files or stderr/stdout files (which are open and 
being written to).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to