Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sys.file_exists returns false on large files #6273

vicuna opened this issue Dec 16, 2013 · 3 comments


None yet
2 participants
Copy link

commented Dec 16, 2013

Original bug ID: 6273
Reporter: Christoph Bauer
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:26:40Z)
Resolution: fixed
Priority: normal
Severity: major
Platform: x86
OS: Windows
OS Version: 7
Version: 4.00.1
Fixed in version: 4.02.0+dev
Category: standard library
Tags: patch
Monitored by: @hcarty @dbuenzli

Bug description

Sys.file_exists returns false, if the file is larger than 4GB.

Steps to reproduce

open Sys

file_exists "c:\bigfile.dat"

File attachments


This comment has been minimized.

Copy link

commented Dec 17, 2013

Comment author: Christoph Bauer

Additional info: ocaml was build with MSVC toolchain.

c:> ocaml unix.cma
Unix.stat "c:\bigfile.dat";;
Unix.Unix_error (Unix.EOVERFLOW, "stat", "c:\bigfile.dat").

Workaround with the unix module:

let file_exists path =
try ignore (Unix.LargeFile.stat path); true with _ -> false


This comment has been minimized.

Copy link

commented Dec 18, 2013

Comment author: Christoph Bauer

The attached patched calls _stati64 (like in win32unix) instead of stat on windows. It solves the problem for me.


This comment has been minimized.

Copy link

commented Apr 22, 2014

Comment author: @alainfrisch

Thanks! Fixed as suggested (commit 14652 on trunk).

@vicuna vicuna closed this Dec 11, 2015

@vicuna vicuna added the stdlib label Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.