<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Oct 5, 2017 at 11:21 AM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Peter Collingbourne via Phabricator via llvm-commits<br>
<span class=""><<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a>> writes:<br>
<br>
<br>
> +  while (1) {<br>
> +    auto EC = rename_internal(FromHandle, To, true);<br>
</span>> +    if (!EC || EC != errc::permission_denied)<br>
> +      return EC;<br>
...<br>
> +    // The destination file probably exists and is currently open in another<br>
> +    // process. Rename it to move it out of the way of the source file. Use<br>
> +    // FILE_FLAG_DELETE_ON_CLOSE to arrange for the destination file to be<br>
> +    // deleted when the other process closes it.<br>
<br>
This only happens if the file is open without FILE_SHARE_DELETE mode, no?<br></blockquote><div><br></div><div>I observed that it could also happen if the destination file is memory mapped (i.e. another process has a MemoryBuffer open on the file). In that case we cannot delete it directly, we have to rename it.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
When do we expect to hit that? If only when a virus scanner is running,<br>
shouldn't we just sleep and wait for it to close it?<br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">-- <div>Peter</div></div></div>
</div></div>