[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Question about File::Stat and file size

Overdorf, Sam

8/7/2008 8:54:00 PM

I frequently use the File::Stat structure.

I have found the size element is not large enough for DVD's (4Gigs)
because it always comes out as a negative number.

I also use the restart feature of ftp when transferring a DVD image and
find that the Ruby implementation does not support this large of a file
so I can't restart a transfer picking up where it left off.

Does anyone know if this will be addressed in future implementations of
Ruby?

Thanks,
Sam Overdorf
LADV/Intel


2 Answers

Eric Hodel

8/7/2008 9:16:00 PM

0

On Aug 7, 2008, at 13:53 PM, Overdorf, Sam wrote:
> I frequently use the File::Stat structure.
>
> I have found the size element is not large enough for DVD's (4Gigs)
> because it always comes out as a negative number.
>
> I also use the restart feature of ftp when transferring a DVD image
> and
> find that the Ruby implementation does not support this large of a
> file
> so I can't restart a transfer picking up where it left off.
>
> Does anyone know if this will be addressed in future implementations
> of
> Ruby?

I think the problem is in your operating system:

$ ll big
-rw-r--r-- 1 drbrain staff 17179869185 Aug 7 14:13 big
$ ruby -e 'p File::Stat.new("big").size'
17179869185
$ ruby -e 'p File::Stat.new("big").size.class'
Bignum
$ uname -a
Darwin dhcp-218.coop.robotcoop.com 9.4.0 Darwin Kernel Version 9.4.0:
Mon Jun 9 19:30:53 PDT 2008; root:xnu-1228.5.20~1/RELEASE_I386 i386


Eric Hodel

8/7/2008 9:35:00 PM

0

On Aug 7, 2008, at 14:15 PM, Eric Hodel wrote:
> On Aug 7, 2008, at 13:53 PM, Overdorf, Sam wrote:
>> I frequently use the File::Stat structure.
>>
>> I have found the size element is not large enough for DVD's (4Gigs)
>> because it always comes out as a negative number.
>>
>> I also use the restart feature of ftp when transferring a DVD image
>> and
>> find that the Ruby implementation does not support this large of a
>> file
>> so I can't restart a transfer picking up where it left off.
>>
>> Does anyone know if this will be addressed in future
>> implementations of
>> Ruby?
>
> I think the problem is in your operating system:
>
> $ ll big
> -rw-r--r-- 1 drbrain staff 17179869185 Aug 7 14:13 big
> $ ruby -e 'p File::Stat.new("big").size'
> 17179869185
> $ ruby -e 'p File::Stat.new("big").size.class'
> Bignum
> $ uname -a
> Darwin dhcp-218.coop.robotcoop.com 9.4.0 Darwin Kernel Version
> 9.4.0: Mon Jun 9 19:30:53 PDT 2008; root:xnu-1228.5.20~1/
> RELEASE_I386 i386

On a filesystem with sparse-file support (1TB file on a partition with
45GB free):

$ ll sparse-file
-rw-r--r-- 1 drbrain drbrain 1099511627776 Aug 7 14:30 sparse-file
$ ruby -e 'p File::Stat.new("sparse-file").size'
1099511627776
$ df /data
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad4s1g 55679808 4424840 46800584 9% /data
$

maybe the configure script could not find large file support for your
OS.