Bugs item #8990, was opened at 2007-03-02 02:03
You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=8990&group_id=426

>Category: Triage (do not select)
Group: 1.8.5
Status: Open
Resolution: None
Priority: 3
Submitted By: Martin Kihlgren (zond)
Assigned to: Nobody (None)
Summary: File.size and IO.stat.size sometimes give different results

Initial Comment:
In our rails project we did a Pathname.size on a file uploaded in the same request. As far as I can tell Pathname.size calls File.size.

Even though `ls -l` and `stat` gave correct sizes (about 4MB) at that point in the code, Pathname.size gave 15 bytes.

So we tried different ways, and ended up using stat(f).size, which gave a correct result.

According to the source IO.stat uses fstat, and File.size uses rb_stat, but I havent looked into the differences in those. Maybe you know more than I do :)

regards,
//Martin Kihlgren

----------------------------------------------------------------------

You can respond by visiting: 
http://rubyforge.org/tracker/?func=detail&atid=1698&aid=8990&group_id=426