Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

FakeFS, CSV and JRuby 1.7.1 in 1.9 mode #172

Closed
crawlik opened this Issue · 2 comments

1 participant

@crawlik

Here is an issue I run into when running tests under JRuby 1.7 in 1.9 mode

jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_07-b10 [linux-amd64]

irb(main):001:0> require 'csv' ; require 'fakefs' ; CSV.open('test.csv', "w") do |csv| end
ArgumentError: wrong number of arguments (3 for 2)
from /home/alex/.rvm/rubies/jruby-1.7.2/lib/ruby/1.9/csv.rb:1342:in open'
from (irb):1:in
evaluate'
from org/jruby/RubyKernel.java:1066:in eval'
from org/jruby/RubyKernel.java:1392:in
loop'
from org/jruby/RubyKernel.java:1174:in catch'
from org/jruby/RubyKernel.java:1174:in
catch'
from /home/alex/.rvm/rubies/jruby-1.7.2/bin/irb:13:in `(root)'

same code runs just fine under
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux]
$ irb
1.9.3p362 :001 > require 'csv' ; require 'fakefs' ; CSV.open('test.csv', "w") do |csv| end
=> nil

and

jruby 1.7.2 (ruby-1.8.7p370) 2013-01-04 302c706 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_07-b10 [linux-amd64]
irb(main):001:0> require 'csv' ; require 'fakefs' ; CSV.open('test.csv', "w") do |csv| end
=> nil

Obviously something has changed in core library. So I wonder if anybody knows what causes this issue.

@crawlik

It turned out that StringIO class which FakeFS is derived from has open method that accepts only two parameters. So it fails as expected

ruby -v ; ruby -e 'require "fakefs" ; p FakeFS::File.open("test.csv", "w", {})'
jruby 1.7.1 (1.9.3p327) 2012-12-03 30a153b on Java HotSpot(TM) 64-Bit Server VM 1.7.0_07-b10 [linux-amd64]
ArgumentError: wrong number of arguments (3 for 2)
  (root) at -e:1

However when same code doesn't fail under MRI 1.9 which puzzles me big time...

ruby -v ; ruby -e 'require "fakefs" ; p FakeFS::File.open("test.csv", "w", {})'
ruby 1.9.3p362 (2012-12-25 revision 38607) [x86_64-linux]
#<FakeFS::File:0x00000001b9f090>

The call is made from csv.rb which the following parameters:

args = ["test.csv", "w"] 
file_opts = {universal_newline: false}

Any idea how it is possible?

@crawlik

It turned out to be JRuby bug. Details are here Kudos to https://github.com/enebo for fixing it quickly

@crawlik crawlik closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.