From: Martin Weber Date: 2004-03-25T06:25:43+09:00 Subject: Re: File.stat.size errors with file sizes over 2Gigs. 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