[PATCH] D30668: Add llvm::sys::fs::real_path

Zachary Turner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 16:19:01 PST 2017


zturner added a comment.

In https://reviews.llvm.org/D30668#693823, @amccarth wrote:

> I can see why it's probably not feasible to test `realPathFromHandle` and `directoryRealPath` directly, but is there a way to test `real_path` to ensure that it covers a lot of the important cases (like MAX_PATH on Windows)?


I actually tried adding some tests for `real_path`, but it's not that easy.  You need a way to generate a symbolic link, and creating a symbolic link requires `SeCreateSymbolicLink` privilege.  Because of this, `llvm::sys::fs::create_link` actually creates a hard link instead of a symbolic link, and when you make a file B which is a hardlink to A, can call `real_path(B)` it will just return B, not A (as expected).

I could probably add a test for . and .. syntax, but I don't see a way to write one for symbolic link resolution.


https://reviews.llvm.org/D30668





More information about the llvm-commits mailing list