[llvm-dev] Supporting symbolic links in Path library routines
Cameron Esfahani via llvm-dev
llvm-dev at lists.llvm.org
Mon Aug 17 18:32:39 PDT 2015
include/llvm/Support/FileSystem.h has file_type which enumerates the file system’s view of the file type. One of the values is “symlink_file”.
But because the Unix implementation of status() calls stat() instead of lstat(), if the path refers to a symbolic link, the link is followed. There’s no way to get information about the symbolic link itself.
I think changing status() to call lstat() is a bad idea, so it seems like the only other option is to create a new routine when you explicitly want to check if what the path refers to is a symbolic link.
Or this is such an uncommon case, that it’s the caller’s responsibility to detect if a file path refers to a symbolic link in whatever platform appropriate mechanism they have available to them. If that’s the case, then I suggest removing symlink_file from file_type.
dirty at apple.com
"There are times in the life of a nation when the only place a decent man can find himself is in prison."
More information about the llvm-dev