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

Key: JRUBY-1308
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Thomas E Enebo
Reporter: Johannes Sasongko
Votes: 0
Watchers: 0
Operations

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

File.new using File::CREAT should imply reading, not writing

Created: 04/Sep/07 01:02 AM   Updated: 22/Dec/07 06:28 AM
Component/s: Core Classes/Modules
Affects Version/s: JRuby 1.0.1
Fix Version/s: JRuby 1.1b1, JRuby 1.0.2

Time Tracking:
Not Specified


 Description  « Hide
$ touch tmp

$ ruby -e "File.new('tmp', File::CREAT).read(1)"

$ jruby -e "File.new('tmp', File::CREAT).read(1)"
:1: not opened for reading (IOError)

$ ruby -e "File.new('tmp', File::CREAT) << 'a'"
-e:1:in `write': not opened for writing (IOError)
from -e:1:in `<<'
from -e:1

$ jruby -e "File.new('tmp', File::CREAT) << 'b'"

$ cat tmp
b



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Thomas E Enebo - 04/Sep/07 12:41 PM
Fixed in commit 4270 on trunk and and 4272 on 1.0 branch. In addition to this Jira description, this bug also fixes the behavior that we did not always create the file if O_CREAT is specified. Adding that behavior makes us match MRI better.