Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global variable $INPUT_LINE_NUMBER isn't being updated correctly #3429

Closed
bpardee opened this issue Oct 27, 2015 · 1 comment
Closed

Global variable $INPUT_LINE_NUMBER isn't being updated correctly #3429

bpardee opened this issue Oct 27, 2015 · 1 comment

Comments

@bpardee
Copy link

bpardee commented Oct 27, 2015

In 9.0.3.0, the global variable $INPUT_LINE_NUMBER isn't being updated correctly. Given the following program:

require 'csv'
File.open('foo.csv', 'w') do |f|
  f.write "a,b,c\n1,2,3\n4,5,6\n7,8,9\n"
end
CSV.foreach('foo.csv', headers: true) do |row|
  puts "i=#{$INPUT_LINE_NUMBER}"
end

MRI and JRuby 1.7 display:

i=2
i=3
i=4

While JRuby 9.0.3.0 displays:

i=2
i=2
i=2
bpardee pushed a commit to bpardee/data_seeder that referenced this issue Oct 27, 2015
@kares kares added the core label Jan 17, 2017
@kares
Copy link
Member

kares commented Jan 17, 2017

now, works in 9.1.7.0 (fixed somewhere along the way) :

jruby-9.1.7.0 :001 > require 'csv'
 => true 
jruby-9.1.7.0 :002 > File.open('foo.csv', 'w') do |f|
jruby-9.1.7.0 :003 >       f.write "a,b,c\n1,2,3\n4,5,6\n7,8,9\n"
jruby-9.1.7.0 :004?>   end
 => 24 
jruby-9.1.7.0 :005 > CSV.foreach('foo.csv', headers: true) do |row|
jruby-9.1.7.0 :006 >       puts "i=#{$INPUT_LINE_NUMBER}"
jruby-9.1.7.0 :007?>   end
i=2
i=3
i=4

@kares kares closed this as completed Jan 17, 2017
@kares kares removed the core label Jan 17, 2017
@kares kares added this to the Invalid or Duplicate milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants