History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-2383
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Thomas E Enebo
Reporter: McClain Looney
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
JRuby

File.stat fails confusingly on large files

Created: 10/Apr/08 11:08 AM   Updated: 28/May/08 11:57 AM
Component/s: Core Classes/Modules
Affects Version/s: JRuby 1.1
Fix Version/s: JRuby 1.1.3

Time Tracking:
Not Specified

Environment: centos5


 Description  « Hide
Calling File.stat('file') on large files (my failure case was 5.2gb) causes an Errno::ENOENT exception to be thrown.

setting -Djruby.ntive.enabled=false rectifies the issue, so it's likely something w/ the c implementation of the POSIX interface.

Really, it's two issues:

1. it shouldn't fail
2. it shouldn't lie about why it's failing

Appears to fail around the 2gb mark



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Vladimir Sizikov - 10/Apr/08 11:46 AM
For me, on Vista, File.stat on very long file (7Gb) actually reports the NEGATIVE file size!

McClain Looney - 10/Apr/08 12:38 PM
confirmed that 2**^32 bytes is the boundary on linux.

not an issue on osx 10.5 w/ trunk


Daniel Berger - 10/Apr/08 03:59 PM
On Windows you're going to need _stat64().

See win32-file for how I implement some of the other File functions that are broken, wrong or unimplemented in MRI.


Thomas E Enebo - 10/Apr/08 07:27 PM
I noticed an issue with this on ino on Solaris. We need to make sure that JNA-POSIX deals with unsigned values which get forced into Java signed values.

Daniel Berger - 11/Apr/08 09:22 AM
As per our discussion on #jruby, the solution for Windows is to map stat to _stat64 in the mapping file.

As for Solaris, watch out for this bug:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-core/9926


Thomas E Enebo - 25/May/08 01:31 PM
jna-posix.jar updated in commit 6785 to fix this.

McClain Looney - 28/May/08 11:16 AM
[ludi@localhost ludicrous]$ ruby -e "p File.stat('../bigfile')"
#<File::Stat dev=0xfd00, ino=22380573, mode=0100664, nlink=1, uid=500, gid=500, rdev=0x0, size=4294967296, blksize=4096, blocks=8396808, atime=Fri May 23 11:57:13 -0500 2008, mtime=Fri May 23 12:09:10 -0500 2008, ctime=Fri May 23 12:09:10 -0500 2008>
[ludi@localhost ludicrous]$ jruby -e "p File.stat('../bigfile')"
-e:1: No such file or directory - No such file or directory - /home/ludi/ludicrous/../bigfile (Errno::ENOENT)

Vladimir Sizikov - 28/May/08 11:30 AM
Confirmed on Windows Vista. Revision r6801 re-introduced the problem back.

Thomas E Enebo - 28/May/08 11:57 AM
Fixed in commit 6851 on trunk (I did something stupid at some point and put partially updated jna-posix jar in trunk). Up to date one there now.