Question about File::Stat and file size

Discussion in 'Ruby' started by Overdorf, Sam, Aug 7, 2008.

  1. 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
     
    Overdorf, Sam, Aug 7, 2008
    #1
    1. Advertising

  2. Overdorf, Sam

    Eric Hodel Guest

    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, Aug 7, 2008
    #2
    1. Advertising

  3. Overdorf, Sam

    Eric Hodel Guest

    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.
     
    Eric Hodel, Aug 7, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steven T. Hatton
    Replies:
    3
    Views:
    9,716
    Pete Becker
    Jun 2, 2005
  2. Patrick Useldinger

    os.stat('<filename>')[stat.ST_INO] on Windows

    Patrick Useldinger, Feb 27, 2005, in forum: Python
    Replies:
    6
    Views:
    1,184
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Mar 3, 2005
  3. Magesh
    Replies:
    3
    Views:
    448
    Gordon Burditt
    Oct 5, 2007
  4. Rolf Krüger
    Replies:
    2
    Views:
    621
    Ian Collins
    Mar 12, 2008
  5. ruck
    Replies:
    10
    Views:
    1,281
Loading...

Share This Page