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

Infinite loop in rubocop -a for ruby/csv #5586

Closed
ShockwaveNN opened this issue Feb 21, 2018 · 4 comments
Closed

Infinite loop in rubocop -a for ruby/csv #5586

ShockwaveNN opened this issue Feb 21, 2018 · 4 comments
Labels

Comments

@ShockwaveNN
Copy link
Contributor

Failure to perform RuboCop autocorrect in https://github.com/ruby/csv.git project


Actual behavior

Take a pretty long time

Infinite loop detected in /home/user/sources/csv/test/lib/test/unit.rb.
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:234:in `block in iterate_until_no_changes'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:230:in `loop'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:230:in `iterate_until_no_changes'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:201:in `do_inspection_loop'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:111:in `block in file_offenses'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:121:in `file_offense_cache'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:109:in `file_offenses'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:100:in `process_file'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:78:in `block in each_inspected_file'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:75:in `each'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:75:in `reduce'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:75:in `each_inspected_file'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:67:in `inspect_files'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/runner.rb:39:in `run'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/cli.rb:150:in `execute_runner'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/cli.rb:78:in `execute_runners'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/lib/rubocop/cli.rb:38:in `run'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/bin/rubocop:13:in `block in <top (required)>'
/home/user/.rvm/rubies/ruby-2.5.0/lib/ruby/2.5.0/benchmark.rb:308:in `realtime'
/home/user/.rvm/gems/ruby-2.5.0/gems/rubocop-0.52.1/bin/rubocop:12:in `<top (required)>'
/home/user/.rvm/gems/ruby-2.5.0/bin/rubocop:23:in `load'
/home/user/.rvm/gems/ruby-2.5.0/bin/rubocop:23:in `<main>'
/home/user/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `eval'
/home/user/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `<main>'

Steps to reproduce the problem

  1. git clone https://github.com/ruby/csv.git
  2. cd csv && git checkout 2cc4f858a2dcad54dc8c5e346ae691ac9a88f2a3
  3. rubocop -a

RuboCop version

$ rubocop -V
0.52.1 (using Parser 2.5.0.0, running on ruby 2.5.0 x86_64-linux)
@pocke pocke added the bug label Feb 26, 2018
@pocke
Copy link
Collaborator

pocke commented Feb 26, 2018

Probably it is related to #5547
I can reproduce this problem with --only BlockEndNewline option, and the related issue cause is the BlockEndNewline cop.

@ericmathison
Copy link

I was able to make a reduced test case using test/lib/test/unit.rb (from the above csv repo).

begin
  gem 'minitest', '< 5.0.0' if defined? Gem
rescue Gem::LoadError
end
require 'minitest/unit'
require 'test/unit/assertions'

def foo
  report.each {|r| 0 + \
  0 }
end

For whatever reason, this reduced case will only give the infinite loop error when explicitly specifying the --only BlockEndNewline option.

@bquorning
Copy link
Contributor

I believe this issue has been fixed by #5590.

@ShockwaveNN
Copy link
Contributor Author

Found another one infinite loop in ruby/csv - probably not related to current one, in another file #5628

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants