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

crash in fix mode with multiple trailing arrows #776

Closed
jeremy-asher opened this issue Nov 1, 2017 · 5 comments · Fixed by #815
Closed

crash in fix mode with multiple trailing arrows #776

jeremy-asher opened this issue Nov 1, 2017 · 5 comments · Fixed by #815
Labels
Milestone

Comments

@jeremy-asher
Copy link

jeremy-asher commented Nov 1, 2017

This below crash seems to happen in fix mode only when there are 2 or more arrows trailing after a brace.

Without --fix

jasher@jasher-mbp:/tmp/test/manifests/ > puppet-lint init.pp
WARNING: arrow should be on the right operand's line on line 5
WARNING: arrow should be on the right operand's line on line 8

With --fix:

jasher@jasher-mbp:/tmp/test/manifests/ > puppet-lint --fix init.pp

puppet-lint version: 2.3.3
ruby version: 2.1.10-p492
platform: x86_64-darwin15.0
file path: init.pp
file contents:

# test
class test {
  package {'foo':
    ensure => 'installed',
  }->
  package {'bar':
    ensure => 'installed',
  }->
  package {'baz':
    ensure => 'installed',
  }
}

error:

ArgumentError: bad value for range
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint/data.rb:182:in `block in resource_indexes'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint/data.rb:171:in `each'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint/data.rb:171:in `resource_indexes'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint/checkplugin.rb:81:in `resource_indexes'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint/plugins/check_conditionals/selector_inside_resource.rb:7:in `check'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint/checkplugin.rb:21:in `run'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint/checks.rb:60:in `block in run'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint/checks.rb:57:in `each'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint/checks.rb:57:in `run'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint.rb:196:in `run'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint/bin.rb:59:in `block in run'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint/bin.rb:56:in `each'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/lib/puppet-lint/bin.rb:56:in `run'
/Users/jasher/.rbenv/versions/2.1.10/lib/ruby/gems/2.1.0/gems/puppet-lint-2.3.3/bin/puppet-lint:7:in `<top (required)>'
/Users/jasher/.rbenv/versions/2.1.10/bin/puppet-lint:23:in `load'
/Users/jasher/.rbenv/versions/2.1.10/bin/puppet-lint:23:in `<main>'
@rodjek rodjek added the bug label Nov 1, 2017
@rodjek rodjek added this to the 2.3.4 milestone Nov 2, 2017
@rodjek
Copy link
Owner

rodjek commented Nov 13, 2017

@jeremy-asher Could you attach the manifest file to this issue? I'm unable to reproduce the issue locally, so it might be related to the character encoding of the file.

@jeremy-asher
Copy link
Author

Interesting. Here you go:
test.tar.gz

@rodjek rodjek modified the milestones: 2.3.4, 2.3.5 Mar 23, 2018
@rodjek
Copy link
Owner

rodjek commented Mar 26, 2018

Sorry it took so long to get back to this. I've figured out why I couldn't reproduce it locally, the behaviour is only present on OSX and I can now reproduce it on an OSX VM. That's the most frustrating part solved, shouldn't take too long to fix :)

@jeremy-asher
Copy link
Author

Ah! That is surprising. Thanks!

@jeremy-asher
Copy link
Author

Thanks @rodjek!

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

Successfully merging a pull request may close this issue.

2 participants