Hi Takumi,<div><br></div><div>Well, my patch was only for Unix so it isn't surprising it hits cygwin.</div><div><br></div><div>Presumably the cygwin version of unique_file() needs a similar fix, but someone who uses cygwin will have to contribute that.</div>
<div><br></div><div> - Daniel</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Nov 26, 2012 at 9:30 PM, NAKAMURA Takumi <span dir="ltr"><<a href="mailto:geek4civic@gmail.com" target="_blank">geek4civic@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Daniel, FYI, I met infinite loop on cygwin (regardless of this) :D<br>
<br>
open("/dev/fd/1-foobar") caused not ENOENT, but EEXIST.<br>
<br>
I suppressed dev-fd-fs on cygwin in clang r168676.<br>
<br>
nvm, I shall do.<br>
<br>
...Takumi<br>
<br>
2012/11/16 Daniel Dunbar <<a href="mailto:daniel@zuster.org">daniel@zuster.org</a>>:<br>
<div class="HOEnZb"><div class="h5">> Author: ddunbar<br>
> Date: Thu Nov 15 14:24:52 2012<br>
> New Revision: 168081<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=168081&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=168081&view=rev</a><br>
> Log:<br>
> PathV2: Fix a possible infinite loop.<br>
><br>
>  - The code could infinite loop trying to create unique files, if the directory<br>
>    containing the unique file exists, but open() calls on non-existent files in<br>
>    the path return ENOENT. This is true on the /dev/fd filesystem, for example.<br>
><br>
>  - Will add a clang side test case for this.<br>
><br>
> Modified:<br>
>     llvm/trunk/lib/Support/Unix/PathV2.inc<br>
><br>
> Modified: llvm/trunk/lib/Support/Unix/PathV2.inc<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/PathV2.inc?rev=168081&r1=168080&r2=168081&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/PathV2.inc?rev=168081&r1=168080&r2=168081&view=diff</a><br>

> ==============================================================================<br>
> --- llvm/trunk/lib/Support/Unix/PathV2.inc (original)<br>
> +++ llvm/trunk/lib/Support/Unix/PathV2.inc Thu Nov 15 14:24:52 2012<br>
> @@ -424,9 +424,10 @@<br>
>      // If the file existed, try again, otherwise, error.<br>
>      if (errno == errc::file_exists)<br>
>        goto retry_random_path;<br>
> -    // The path prefix doesn't exist.<br>
> -    if (errno == errc::no_such_file_or_directory) {<br>
> -      StringRef p(RandomPath.begin(), RandomPath.size());<br>
> +    // If path prefix doesn't exist, try to create it.<br>
> +    if (errno == errc::no_such_file_or_directory &&<br>
> +        !exists(path::parent_path(RandomPath))) {<br>
> +      StringRef p(RandomPath);<br>
>        SmallString<64> dir_to_create;<br>
>        for (path::const_iterator i = path::begin(p),<br>
>                                  e = --path::end(p); i != e; ++i) {<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>