Cameron Esfahani via llvm-dev
2015-Aug-18 01:32 UTC
[llvm-dev] Supporting symbolic links in Path library routines
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. Any comments? Cameron Esfahani 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."
Michael Spencer via llvm-dev
2015-Aug-20 01:48 UTC
[llvm-dev] Supporting symbolic links in Path library routines
On Mon, Aug 17, 2015 at 6:32 PM, Cameron Esfahani via llvm-dev <llvm-dev at lists.llvm.org> wrote:> 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. > > Any comments? > > Cameron Esfahani > 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." > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org http://llvm.cs.uiuc.edu > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-devThe API was designed as a mirror of the Boost Filesystem API. I'm not surprised to see an unused enum member there. I don't believe any LLVM tools care about symlinks, so I'm fine with removing it as long as no platform will return that value. - Michael Spencer
Cameron Esfahani via llvm-dev
2015-Aug-25 01:01 UTC
[llvm-dev] Supporting symbolic links in Path library routines
I’ll search through the code and proffer a patch if no one uses it. Cameron Esfahani dirty at apple.com "Americans are very skilled at creating a custom meaning from something that's mass-produced." Ann Powers> On Aug 19, 2015, at 6:48 PM, Michael Spencer <bigcheesegs at gmail.com> wrote: > > The API was designed as a mirror of the Boost Filesystem API. I'm not > surprised to see an unused enum member there. I don't believe any LLVM > tools care about symlinks, so I'm fine with removing it as long as no > platform will return that value. >
Rafael Espíndola via llvm-dev
2015-Aug-26 15:30 UTC
[llvm-dev] Supporting symbolic links in Path library routines
Looks like there is effectively dead code in clang that compares with file_type::symlink_file. We can very likely nuke it too. Thanks for finding this dead code. Cheers, Rafael On 17 August 2015 at 21:32, Cameron Esfahani via llvm-dev <llvm-dev at lists.llvm.org> wrote:> 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. > > Any comments? > > Cameron Esfahani > 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." > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org http://llvm.cs.uiuc.edu > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev