[PATCH] Support: add sys::path::canonical
Ilya Konstantinov
ilya.konstantinov at gmail.com
Fri Aug 1 08:54:23 PDT 2014
As someone who was looking into http://llvm.org/bugs/show_bug.cgi?id=20440, some comments:
- This naive canonization will break Unix path behavior with symlinks. realpath does the right thing on Un*x. I suspect (although didn't verify) that this is what makes it slow.
- Win32 directory symlinks don't behave like Unix symlinks, so this will do the right thing on Win32.
- That looks like a whole lot of work for path manipulation. All this copying and vectors. Why not do string processing, e.g. "Got a ".."? Go back to the last slash/backslash." I thought performance is of importance here.
- This comment says "in place", but the work isn't done "in place" nor is the result "in place".
Now, as to 20440:
- We can keep doing include path concatenations as usual (growing it even to thousands of characters in length) and when time comes for CreateFileWs, we'll pass a canonized \??\ path, same as I implemented here in the form of an API hook: https://github.com/ikonst/LongPathFix
- I don't think this canonizing function quite cuts it for \??\. You need to handle absolute paths, root paths, relative paths, UNC paths. It's rather Win32 specific.
- The beautiful thing is that 20440 isn't an issue on Un*x since open accepts long paths naturally.
http://reviews.llvm.org/D4745
More information about the llvm-commits
mailing list