Skip to content

Commit aa68c71

Browse files
Use capi instead of ccall for stat/lstat on macOS
On macOS, stat is remapped via macros in sys/stat.h to a 64-bit variant. Using ccall bypassed this remapping causing st_mode to be read at the wrong offset, misidentifying symlinks as regular files and breaking followSymlinks.
1 parent 846d15b commit aa68c71

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

core/docs/Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
# Bug fix: Fixed `followSymlinks` option not working correctly on macOS.
6+
57
## 0.3.0
68

79
See [0.2.2-0.3.0 API Changelog](/core/docs/ApiChangelogs/0.2.2-0.3.0.txt) for a

core/src/Streamly/Internal/FileSystem/Posix/ReadDir.hsc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,10 @@ foreign import capi unsafe "dirent.h readdir"
144144
-- Stat
145145
--------------------------------------------------------------------------------
146146

147-
foreign import ccall unsafe "stat.h lstat"
147+
foreign import capi unsafe "sys/stat.h lstat"
148148
c_lstat :: CString -> Ptr CStat -> IO CInt
149149

150-
foreign import ccall unsafe "stat.h stat"
150+
foreign import capi unsafe "sys/stat.h stat"
151151
c_stat :: CString -> Ptr CStat -> IO CInt
152152

153153
s_IFMT :: CMode

0 commit comments

Comments
 (0)