Skip to content

maxBound fileSize is dangerously small on windows #16

@joeyh

Description

@joeyh

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions