<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Nov 11, 2014 at 8:52 PM, Robinson, Paul <span dir="ltr"><<a href="mailto:Paul_Robinson@playstation.sony.com" target="_blank">Paul_Robinson@playstation.sony.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">New patch attached. Threw together . and .. elimination for Michael.<br>
Extra test for Rafael, although I had to #include <windows.h> in the<br>
unittest to make the necessary Windows APIs available. (Testing a relative<br>
path requires setting the current directory to a known writeable place,<br>
which means calling Windows APIs because path/fs don't have them.)</blockquote><div><br></div><div>There's a pair of raw chdir calls in libTooling, and also in unittests/Support/LockFileManagerTest.cpp. Maybe it's time libSupport grows a chdir?</div><div><br></div><div>+ ASSERT_NO_ERROR(fs::remove(Twine("b")));<br></div><div><br></div><div>Twine should have an implicit constructor for const char *. Same goes for other places where you explicitly use foo(Twine(x)).</div><div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> If it's<br>
going overboard to do that, let me know and I can take the relative-path<br>
test back out; but actually I think it's useful to have it.<br>
--paulr<br>
<span class="im"><br>
> -----Original Message-----<br>
> From: <a href="mailto:llvm-commits-bounces@cs.uiuc.edu">llvm-commits-bounces@cs.uiuc.edu</a> [mailto:<a href="mailto:llvm-commits-">llvm-commits-</a><br>
> <a href="mailto:bounces@cs.uiuc.edu">bounces@cs.uiuc.edu</a>] On Behalf Of Robinson, Paul<br>
> Sent: Tuesday, November 11, 2014 2:13 PM<br>
> To: Michael Spencer<br>
> Cc: <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a>; Aaron Ballman<br>
</span><div class=""><div class="h5">> Subject: RE: [PATCH] PR21482: long paths on Windows<br>
><br>
> > -----Original Message-----<br>
> > From: Michael Spencer [mailto:<a href="mailto:bigcheesegs@gmail.com">bigcheesegs@gmail.com</a>]<br>
> > Sent: Tuesday, November 11, 2014 12:36 PM<br>
> > To: Robinson, Paul<br>
> > Cc: Aaron Ballman; Rafael Espíndola; <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> > Subject: Re: [PATCH] PR21482: long paths on Windows<br>
> ><br>
> > On Tue, Nov 11, 2014 at 7:27 AM, Robinson, Paul<br>
> > <<a href="mailto:Paul_Robinson@playstation.sony.com">Paul_Robinson@playstation.sony.com</a>> wrote:<br>
> > > New patch attached.<br>
> > ><br>
> > > I ended up not using make_absolute because it caused more string<br>
> > copying.<br>
> > > If there's some reason to consider it safer than current_path and<br>
> doing<br>
> > > my own pasting, I can do that instead, but only if y'all think it has<br>
> > > actual value.<br>
> > ><br>
> > > This changed the specific error returned by another fs test, which<br>
> > > seems reasonable.<br>
> > > --paulr<br>
> ><br>
> > This patch doesn't seem to be able to handle "..\foo". \\?\ disables<br>
> > expansion of . and ..<br>
><br>
> Feh.<br>
><br>
> I'm not able to find a pre-Windows8 API that does this canonicalization<br>
> on sufficiently long path names. If anybody else has one I'm all ears.<br>
> Otherwise I guess I have to write my own.<br>
> --paulr<br>
><br>
> ><br>
> > Other than that it looks fine.<br>
> ><br>
> > - Michael Spencer<br>
> ><br>
> > ><br>
> > >> -----Original Message-----<br>
> > >> From: Michael Spencer [mailto:<a href="mailto:bigcheesegs@gmail.com">bigcheesegs@gmail.com</a>]<br>
> > >> Sent: Monday, November 10, 2014 4:04 PM<br>
> > >> To: Robinson, Paul<br>
> > >> Cc: Aaron Ballman; Rafael Espíndola; <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> > >> Subject: Re: [PATCH] PR21482: long paths on Windows<br>
> > >><br>
> > >> On Mon, Nov 10, 2014 at 3:05 PM, Robinson, Paul<br>
> > >> <<a href="mailto:Paul_Robinson@playstation.sony.com">Paul_Robinson@playstation.sony.com</a>> wrote:<br>
> > >> >> -----Original Message-----<br>
> > >> >> From: Aaron Ballman [mailto:<a href="mailto:aaron.ballman@gmail.com">aaron.ballman@gmail.com</a>]<br>
> > >> >> Sent: Monday, November 10, 2014 2:47 PM<br>
> > >> >> To: Rafael Espíndola<br>
> > >> >> Cc: Robinson, Paul; <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> > >> >> Subject: Re: [PATCH] PR21482: long paths on Windows<br>
> > >> >><br>
> > >> >> On Mon, Nov 10, 2014 at 5:43 PM, Rafael Espíndola<br>
> > >> >> <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>> wrote:<br>
> > >> >> > static std::error_code widen_path(const Twine &Path8,<br>
> > >> >> ><br>
> > >> >> > widenPath<br>
> > >> >> ><br>
> > >> >> > Using '\\?\' also disables using / as a path separator, no?<br>
> > Don't<br>
> > >> we<br>
> > >> >> > have to check/assert that there is no / in Path8?<br>
> > >> ><br>
> > >> > So for paranoia I should translate all / to \ in the widened path?<br>
> I<br>
> > >> don't<br>
> > >> > see any existing utility to do that, but easy enough to invent one.<br>
> > >><br>
> > >> sys::path::native(). in Path.h<br>
> > >><br>
> > >> We also have make_absolute in FileSystem.h<br>
> > >><br>
> > >> - Michael Spencer<br>
> > >><br>
> > >> ><br>
> > >> >> ><br>
> > >> >> > + size_t NLevels = ((248 - TmpLen) / 10) + 1;<br>
> > >> >> > + const char *OneDir = "\\123456789";<br>
> > >> >> ><br>
> > >> >> > Use the size of OneDir instead of hard codding the 10.<br>
> > >> >> ><br>
> > >> >> > Aaron, this only uses '\\?\' to create long paths. They can<br>
> still<br>
> > be<br>
> > >> >> > accessed by regular tools by changing the current directory, no?<br>
> > >> >><br>
> > >> >> Yes, relative paths aren't an issue. Just tools using absolute<br>
> paths<br>
> > >> >> that don't support the extended path namespace (which can happen<br>
> if<br>
> > >> >> the app assumes MAX_PATH is actually the max).<br>
> > >> >><br>
> > >> >> ~Aaron<br>
> > >> >><br>
> > >> >> ><br>
> > >> >> > On 10 November 2014 16:01, Robinson, Paul<br>
> > >> >> > <<a href="mailto:Paul_Robinson@playstation.sony.com">Paul_Robinson@playstation.sony.com</a>> wrote:<br>
> > >> >> >> Support directory names longer than 248 characters on Windows.<br>
> > >> >> >><br>
> > >> >> >> The normal Windows path limit is 260 characters; the limit for<br>
> > >> >> directory<br>
> > >> >> >> names is 248, to leave room for an 8.3 filename at the end.<br>
> > Adding<br>
> > >> the<br>
> > >> >> >> '\\?\' prefix greatly expands these limits. Intercept path<br>
> names<br>
> > >> that<br>
> > >> >> >> we are about to pass to the Windows APIs and add the prefix if<br>
> > >> >> necessary.<br>
> > >> >> >><br>
> > >> >> >> Also correct the comment about the state of the temporary<br>
> > directory<br>
> > >> >> used<br>
> > >> >> >> by the Support unittests.<br>
> > >> >> >> --paulr<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>
> > >> >> >><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>
><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><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>
<br></blockquote></div><br></div></div>