From: djberg96@... (Daniel Berger) Date: 2004-03-26T00:29:32+09:00 Subject: Re: File.stat.size errors with file sizes over 2Gigs. Martin Weber wrote in message news:<20040324212533.GF11599@phaeton.entropie.net>... > On Thu, Mar 25, 2004 at 05:48:26AM +0900, walter@mwsewall.com wrote: > > File.stat('file_name').size returns erroneous file sizes when the > > files are over 2 Gigs in size (at which point the number wraps around > > and becomes negative). Is this an expected limitation or a bug? > > > > I am using the Pragmatic Programmers 1.8.1-11 build on a windows 2000 > > machine. > > I'm not sure about windows, but on unix[1] the file size usually is an > off_t, which is a signed value[2], and traditionally was 32bit (i.e. +/- 2Gig). > > Following, some unices (namely solaris comes to mind) offered 'large file > versions' of many of their calls, others (e.g. BSDs) just switched to a > signed 64 bit value for off_t. I think the latter is called for in the windows > compat layer (as I assume there is one, implementing stat) to really solve your > problem. > > [1] -- in stat(2)'s struct stat that is > [2] -- to seek(2) backwards > > Regards, > > -Martin If you're on a 64 bit platform you can build Ruby as a 64 bit app, and that will also solve this problem. My problem on Solaris is that, when I use a 32 bit Ruby 1.8.x, I must disable large file support in order to get any extensions that use procfs.h to compile. I've posted on this before with no solution. Dan