Version française
Home     About     Download     Resources     Contact us    
Browse thread
Bug: mingw in_channel_length fails
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Shivkumar Chandrasekaran <shiv@e...>
Subject: Bug: mingw in_channel_length fails
Hi,

I just noticed that both in_channel_length and 
LargeFile.in_channel_length report the wrong values on files that are 
greater than some number (in my case 2GB) using ocaml 3.08.1 mingw 
(WindowsXP SP2) build (compiled following instructions).

In particular I ran the same snippet of code:

let fd_in = open_in_bin "fname";;
in_channel_length fd_in;;
LargeFile.in_channel_length fd_in;;

on the same file in Mac OS X, Linux (x86), and mingw.

In the first two cases in_channel_length throws an exception:
Exception: Sys_error "Value too large to be stored in data type".

while LargeFile.in_channel_length returns:
- : int64 = 2621440000L

which is correct (doing ls -l in shell).

In the mingw version I get 473956352 for in_channel_length and 
-1673527296L for LargeFile.in_channel_length (note the negative value)!

EIther I messed up while building from ocaml sources, or this seems to 
be a mingw specific bug.

Thanks for any help.

--shiv--

PS: I can send the file if somebody wishes to cross-check.