[llvm-commits] [llvm] r168081 - /llvm/trunk/lib/Support/Unix/PathV2.inc

Daniel Dunbar daniel at zuster.org
Thu Nov 29 10:12:58 PST 2012


Hi Takumi,

Well, my patch was only for Unix so it isn't surprising it hits cygwin.

Presumably the cygwin version of unique_file() needs a similar fix, but
someone who uses cygwin will have to contribute that.

 - Daniel


On Mon, Nov 26, 2012 at 9:30 PM, NAKAMURA Takumi <geek4civic at gmail.com>wrote:

> Daniel, FYI, I met infinite loop on cygwin (regardless of this) :D
>
> open("/dev/fd/1-foobar") caused not ENOENT, but EEXIST.
>
> I suppressed dev-fd-fs on cygwin in clang r168676.
>
> nvm, I shall do.
>
> ...Takumi
>
> 2012/11/16 Daniel Dunbar <daniel at zuster.org>:
> > Author: ddunbar
> > Date: Thu Nov 15 14:24:52 2012
> > New Revision: 168081
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=168081&view=rev
> > Log:
> > PathV2: Fix a possible infinite loop.
> >
> >  - The code could infinite loop trying to create unique files, if the
> directory
> >    containing the unique file exists, but open() calls on non-existent
> files in
> >    the path return ENOENT. This is true on the /dev/fd filesystem, for
> example.
> >
> >  - Will add a clang side test case for this.
> >
> > Modified:
> >     llvm/trunk/lib/Support/Unix/PathV2.inc
> >
> > Modified: llvm/trunk/lib/Support/Unix/PathV2.inc
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/PathV2.inc?rev=168081&r1=168080&r2=168081&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/lib/Support/Unix/PathV2.inc (original)
> > +++ llvm/trunk/lib/Support/Unix/PathV2.inc Thu Nov 15 14:24:52 2012
> > @@ -424,9 +424,10 @@
> >      // If the file existed, try again, otherwise, error.
> >      if (errno == errc::file_exists)
> >        goto retry_random_path;
> > -    // The path prefix doesn't exist.
> > -    if (errno == errc::no_such_file_or_directory) {
> > -      StringRef p(RandomPath.begin(), RandomPath.size());
> > +    // If path prefix doesn't exist, try to create it.
> > +    if (errno == errc::no_such_file_or_directory &&
> > +        !exists(path::parent_path(RandomPath))) {
> > +      StringRef p(RandomPath);
> >        SmallString<64> dir_to_create;
> >        for (path::const_iterator i = path::begin(p),
> >                                  e = --path::end(p); i != e; ++i) {
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20121129/b8e7c8ed/attachment.html>


More information about the llvm-commits mailing list