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

Key: JRUBY-1470
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Dudley Flanders
Votes: 0
Watchers: 1
Operations

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

FileTest methods only work with string arguments

Created: 24/Oct/07 03:21 PM   Updated: 12/May/08 03:50 PM
Component/s: Core Classes/Modules
Affects Version/s: JRuby 1.1.1
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments: 1. File filetest_file_arg.diff (1 kb)


Testcase included: yes


 Description  « Hide
FileTest methods in MRI work on filename strings or File objects, but in JRuby they only work with strings.
dudley@hiro jruby-trunk :> irb
>> FileTest.size(File.new('x','w+'))
=> 0

dudley@hiro jruby-trunk :> jirb
>> FileTest.size(File.new('x','w+'))
TypeError: can't convert File into String


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Dudley Flanders - 25/Oct/07 02:09 PM
Here's a patch that works for the specific case where you're passing in a File object (or anything that responds_to "path"). MRI calls to_io and then fstat on the IO object's file descriptor, so this isn't 100% compatible, but it is slightly closer than just accepting strings.

Charles Oliver Nutter - 12/May/08 03:50 PM
Confirmed, this is still broken. I think the approach we need is to add specs for where to_io is supposed to be called to the rubyspecs and fix from there. No one-shot hacks, sorry

Marking as broken in 1.1.1 to keep it fresh.