mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Schwartzmeyer <>
Subject Re: Review Request 64181: Windows: Fixed `os::rmdir` bugs.
Date Thu, 30 Nov 2017 03:25:53 GMT

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

(Updated Nov. 29, 2017, 7:25 p.m.)

Review request for mesos, Akash Gupta, John Kordich, and Joseph Wu.


One more clean up.

Repository: mesos


The biggest bug with `os::rmdir` was the race condition that appeared on
Windows. There is now method to delete a file on Windows synchronously.
Furthermore, the `RemoveDirectory` API requires that the directory
actually be empty; that is, it does contain files that are marked for
deletion but not yet deleted. Avoiding this race condition requires
waiting for the file to be deleted, not just marked for deletion.

This was accomplished by simplifying the `recursive_remove_directory`
code so that the base recursion case deletes files and symlinks, and
adding a wait in the depth-first search after each recursion.

Furthermore, `os::rmdir` was incorrectly calling `os::realpath`. The
specification of `os::rmdir` states that it expects an absolute path.
The error condition is that the path is not a directory. A symlink to a
directory is not a directory, so do not follow semantics are required.

In the non-recursive case, a stray ANSI CRT function was still in-use,
instead of a long-path aware Unicode Windows API.

Diffs (updated)

  3rdparty/stout/include/stout/internal/windows/longpath.hpp eb62dd6d4cb726de310a962c07ce5620e2939d17

  3rdparty/stout/include/stout/os/windows/rm.hpp 73ebcec92ecb3bb110a9039214c895f72201434d

  3rdparty/stout/include/stout/os/windows/rmdir.hpp 76b74f853393c08020d3b713bcd0f9ce12032acd





1 second wait seems to be long enough.


Andrew Schwartzmeyer

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