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

Closed
vicuna opened this issue Dec 16, 2013 · 3 comments
Closed

Sys.file_exists returns false on large files #6273

vicuna opened this issue Dec 16, 2013 · 3 comments
Assignees

Comments

@vicuna
Copy link

@vicuna vicuna 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

@vicuna
Copy link
Author

@vicuna vicuna 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";;
Exception:
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

@vicuna
Copy link
Author

@vicuna vicuna 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.

@vicuna
Copy link
Author

@vicuna vicuna commented Apr 22, 2014

Comment author: @alainfrisch

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants