Long options that start with `--no-*` are negated even when its explicitly defined as an option
Open
Nobody has claimed this yet.
Type: Bug
- Dominant language
- Ruby
- Stars
- 118
- Forks
- 40
- PR merge metrics
- No merged PRs in 30d
Description
Version:
mixlib-cli-1.7.0
Environment:
Unsure see: https://github.com/sensu-plugins/sensu-plugins-disk-checks/issues/94
Scenario:
Use an arg such as --no-smart-capable-disks with a -
Steps to Reproduce:
- clone repo: https://github.com/sensu-plugins/sensu-plugins-disk-checks
- run
bundle - run script:
$ bundle exec ./bin/check-smart.rb --no-smart-capable-disks
Check failed to run: undefined method `to_sym' for false:FalseClass
Did you mean? to_s, ["/home/babrams/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:290:in `block (3 levels) in opt_parser'", "/home/babrams/.rbenv/versions/2.4.1/lib/ruby/2.4.0/optparse.rb:1552:in `block in parse_in_order'", "/home/babrams/.rbenv/versions/2.4.1/lib/ruby/2.4.0/optparse.rb:1538:in `catch'", "/home/babrams/.rbenv/versions/2.4.1/lib/ruby/2.4.0/optparse.rb:1538:in `parse_in_order'", "/home/babrams/.rbenv/versions/2.4.1/lib/ruby/2.4.0/optparse.rb:1532:in `order!'", "/home/babrams/.rbenv/versions/2.4.1/lib/ruby/2.4.0/optparse.rb:1626:in `permute!'", "/home/babrams/.rbenv/versions/2.4.1/lib/ruby/2.4.0/optparse.rb:1648:in `parse!'", "/home/babrams/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/mixlib-cli-1.7.0/lib/mixlib/cli.rb:230:in `parse_options'", "/home/babrams/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sensu-plugin-1.4.5/lib/sensu-plugin/cli.rb:13:in `initialize'", "./bin/check-smart.rb:138:in `initialize'", "/home/babrams/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sensu-plugin-1.4.5/lib/sensu-plugin/cli.rb:57:in `new'", "/home/babrams/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/sensu-plugin-1.4.5/lib/sensu-plugin/cli.rb:57:in `block in <class:CLI>'"]
Expected Result:
Argument should work
Actual Result:
It blows up and does not parse the arguments properly
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/mixlib/cli.rb at the opt_parser and parse_options paths around the reported line 290. Reproduce the failure with --no-smart-capable-disks using the sensu-plugins-disk-checks command, then verify that an explicitly defined option parses without the false.to_sym exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100