mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Clemmer <>
Subject Review Request 50673: Made semantics of `os::rmdir` consistent between POSIX and Windows.
Date Mon, 01 Aug 2016 21:24:56 GMT

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

Review request for mesos, Daniel Pravat and Joseph Wu.

Bugs: MESOS-5942

Repository: mesos


This commit will fix 2 known bugs in the Windows implementation of
`os::rmdir`, as chronicled in MESOS-5942, namely:

1. Calling `os::rmdir` with a file argument (rather than a directory)
   and the `recursive` parameter set to `true` will fail on Windows,
   but succeed on POSIX.

The POSIX semantics of `os::rmdir` are a union of `rm -r` and `::rmdir`,
the behavior of which depends on the arguments the caller passes in. If
the formal parameter `recursive` is set to `true`, then the semantics
are meant to be`rm -r`; if `false`, the semantics are meant to be

The implications of this are somewhat subtle: `::rmdir` will error out
if you try to delete (e.g.) regular files, while `rm -r` will happily
delete them.

On Windows, we currently always have `::rmdir`-style semantics, in that
we if you pass a path that points at a file to `os::rmdir`, it will not
delete that file.

This commit will reverse this, and move make the Windows implementation
semantically identical to the POSIX implementation (at least in this

2. Recursively deleting nested directories fails on windows when
   `removeRoot` is set to `false`.

Currently if you set the `removeRoot` parameter to `false`, the Windows
implementation of `os::rmdir` will fail to delete a directory inside a
directory. The reason is that we are propagating the `removeRoot` flag
to the recursive calls to `os::rmdir`. The implication of this is that
the recursive call will *not* delete the nested directory (since
`removeRoot` is `false`).

This commit will fix this by setting `removeRoot` to `true` in recursive
calls to `os::rmdir`.


  3rdparty/stout/include/stout/os/windows/rmdir.hpp b74bf7153a15435ce424880df84901c349dee216

  3rdparty/stout/tests/os/rmdir_tests.cpp ffe234baac305e26b5a29cffcdd310350d10167e 




Alex Clemmer

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