[llvm-commits] [llvm] r156380 - /llvm/trunk/lib/Support/Windows/PathV2.inc

NAKAMURA Takumi geek4civic at gmail.com
Sat May 12 17:57:50 PDT 2012


Anton and Bill,

I propose if r156380 (and r156381 in Lit) could be merged into release_31.

r156380 can avoid sprious false alarms in Clang tests with Lit.
Then, r156381 could be applied. It rewinds Lit win32 tweaks to release_30.

They affect only Win32 hosts and *resolve regressions since release_30.*
I am sorry, I had to confirm if builds would be fine with them, two patches.
It was the reason why I would not propose them in earlier stage.

FYI, my builders are applying them locally (and has been good).

Please consider to merge two of them, thank you.

...Takumi

2012/5/8 NAKAMURA Takumi <geek4civic at gmail.com>:
> Author: chapuni
> Date: Tue May  8 09:31:46 2012
> New Revision: 156380
>
> URL: http://llvm.org/viewvc/llvm-project?rev=156380&view=rev
> Log:
> Windows/PathV2.inc: Retry rename() for (maximum) 2 seconds.
>
> Files might be opend by system scanners (eg. file indexer, virus scanner, &c).
>
> Modified:
>    llvm/trunk/lib/Support/Windows/PathV2.inc
>
> Modified: llvm/trunk/lib/Support/Windows/PathV2.inc
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/PathV2.inc?rev=156380&r1=156379&r2=156380&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Support/Windows/PathV2.inc (original)
> +++ llvm/trunk/lib/Support/Windows/PathV2.inc Tue May  8 09:31:46 2012
> @@ -301,11 +301,21 @@
>   if (error_code ec = UTF8ToUTF16(f, wide_from)) return ec;
>   if (error_code ec = UTF8ToUTF16(t, wide_to)) return ec;
>
> -  if (!::MoveFileExW(wide_from.begin(), wide_to.begin(),
> -                     MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING))
> -    return windows_error(::GetLastError());
> +  error_code ec = error_code::success();
> +  for (int i = 0; i < 2000; i++) {
> +    if (::MoveFileExW(wide_from.begin(), wide_to.begin(),
> +                      MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING))
> +      return error_code::success();
> +    ec = windows_error(::GetLastError());
> +    if (ec != windows_error::access_denied)
> +      break;
> +    // Retry MoveFile() at ACCESS_DENIED.
> +    // System scanners (eg. indexer) might open the source file when
> +    // It is written and closed.
> +    ::Sleep(1);
> +  }
>
> -  return error_code::success();
> +  return ec;
>  }
>
>  error_code resize_file(const Twine &path, uint64_t size) {
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list