Question about File::Stat and file size

O

Overdorf, Sam

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
 
E

Eric Hodel

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
 
E

Eric Hodel

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top