You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
System.PosixCompat.Files.fileSize is defined to be a FileOffset, just like System.Posix.Files.fileSize.
But, on Windows, maxBound:: FileOffset = 2147483647.
On Linux, it's quite a bit more than this 2 GB!
I have had to avoid using fileSize at al in my program because of this gotcha. (hFileSize doesn't have this problem; it will return the real size of a multi-gb file on Windows).
I don't know how to fix this library. Changing the PosixCompat version of FileStatus to use an Integer would work, but it would break compatability between unix and windows for users of this library. Maybe ghc is at fault for using such a small type for FileOffset on Windows?
The text was updated successfully, but these errors were encountered:
I don't want to break compatibility between the unix and windows versions of this library as that is the whole point of the library.
This is a tricky situation, as FileOffset is just a type synonym for COff, which makes sense. COff represents the C type off_t. So it must be in msys/mingw where it defined to be only 32-bits.
Apparently in GCC you can use -D_FILE_OFFSET_BITS=64 in order to get 64-bit off_t and size_t types. However, this would have to be done during compilation of the base library. So we probably need to patch this upstream :/
System.PosixCompat.Files.fileSize is defined to be a FileOffset, just like System.Posix.Files.fileSize.
But, on Windows, maxBound:: FileOffset = 2147483647.
On Linux, it's quite a bit more than this 2 GB!
I have had to avoid using fileSize at al in my program because of this gotcha. (hFileSize doesn't have this problem; it will return the real size of a multi-gb file on Windows).
I don't know how to fix this library. Changing the PosixCompat version of FileStatus to use an Integer would work, but it would break compatability between unix and windows for users of this library. Maybe ghc is at fault for using such a small type for FileOffset on Windows?
The text was updated successfully, but these errors were encountered: