
On Mon, 2009-02-02 at 09:49 +1100, Erik de Castro Lopo wrote:
Hi all,
The following code creates a symbolic link in the current directory and then uses System.Posix.Files.getFileStatus to get the status of the link.
However, isDirectory returns True and isSymbolicLink returns False which is very different from what the stat() system call on a POSIX system would return. I consider this a bug.
No, it is the correct POSIX behaviour. You are thinking of lstat() which is what getSymbolicLinkStatus uses. The getFileStatus function calls stat(). The documentation makes this clear: http://www.haskell.org/ghc/docs/latest/html/libraries/unix/System-Posix-File... getFileStatus :: FilePath -> IO FileStatus getFileStatus path calls gets the FileStatus information (user ID, size, access times, etc.) for the file path. Note: calls stat. getSymbolicLinkStatus :: FilePath -> IO FileStatus Acts as getFileStatus except when the FilePath refers to a symbolic link. In that case the FileStatus information of the symbolic link itself is returned instead of that of the file it points to. Note: calls lstat. Duncan