hpath-posix 0.13.1 → 0.13.2
raw patch · 5 files changed
+16/−5 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +4/−0
- cbits/dirutils.c +1/−1
- cbits/dirutils.h +2/−0
- hpath-posix.cabal +1/−1
- src/System/Posix/RawFilePath/Directory/Traversals.hs +8/−3
CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for hpath-posix +## 0.13.2 -- 2020-04-14++* fix macOS compatibility, especially with memory bug in `fdopendir`+ ## 0.13.1 -- 2020-02-08 * Remove unnecessary dependencies
cbits/dirutils.c view
@@ -1,7 +1,7 @@ #include "dirutils.h"+ unsigned int __posixdir_d_type(struct dirent* d) { return(d -> d_type); }-
cbits/dirutils.h view
@@ -7,7 +7,9 @@ #include <sys/stat.h> #include <fcntl.h> + extern unsigned int __posixdir_d_type(struct dirent* d) ;+ #endif
hpath-posix.cabal view
@@ -1,7 +1,7 @@ cabal-version: >=1.10 name: hpath-posix-version: 0.13.1+version: 0.13.2 synopsis: Some low-level POSIX glue code, that is not in 'unix' homepage: https://github.com/hasufell/hpath bug-reports: https://github.com/hasufell/hpath/issues
src/System/Posix/RawFilePath/Directory/Traversals.hs view
@@ -10,6 +10,7 @@ -- Traversal and read operations on directories. +{-# LANGUAGE CApiFFI #-} {-# LANGUAGE CPP #-} {-# LANGUAGE ForeignFunctionInterface #-} {-# LANGUAGE OverloadedStrings #-}@@ -173,11 +174,15 @@ foreign import ccall unsafe "__posixdir_d_type" c_type :: Ptr CDirent -> IO DirType -foreign import ccall "realpath"+foreign import capi "stdlib.h realpath" c_realpath :: CString -> CString -> IO CString -foreign import ccall unsafe "fdopendir"- c_fdopendir :: Posix.Fd -> IO (Ptr ())+-- Using normal 'ccall' here lead to memory bugs, crashes+-- and corrupted d_name entries. It appears there are two fdopendirs:+-- https://opensource.apple.com/source/Libc/Libc-1244.1.7/include/dirent.h.auto.html+-- The capi call picks the correct one.+foreign import capi unsafe "dirent.h fdopendir"+ c_fdopendir :: Posix.Fd -> IO (Ptr CDir) ---------------------------------------------------------- -- less dodgy but still lower-level