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

Sinatra 2.0.6 regression: OptionParser::InvalidOption: invalid option: --pattern #1559

Closed
rubys opened this issue Aug 21, 2019 · 9 comments
Closed

Comments

@rubys
Copy link

rubys commented Aug 21, 2019

Error:

OptionParser::InvalidOption:
  invalid option: --pattern
# /var/lib/gems/2.5.0/gems/sinatra-2.0.6/lib/sinatra/main.rb:18:in `<module:Sinatra>'

Reproduction instructions:

$ git clone https://github.com/rubys/sinatra206.git
$ cd sinatra206
$ bundle install
$ bundle exec rake test

This worked with Sinatra 2.0.5. See also https://travis-ci.org/apache/whimsy/jobs/574961311

@namusyaka
Copy link
Member

namusyaka commented Aug 21, 2019

Thanks for the report. We'll cut a new release (v2.0.6.1 or v2.0.7) after fixing the issue.

@jgarber623
Copy link

I believe this same bug is causing issues with RSpec when invoked using bundle exec rake:

± bundle exec rake
/Users/jason/.rbenv/versions/2.6.3/bin/ruby -I/Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-core-3.8.2/lib:/Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-support-3.8.2/lib /Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rspec-core-3.8.2/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb

An error occurred while loading spec_helper.
Failure/Error: require File.expand_path('../config/environment', __dir__)

Bundler::GemRequireError:
  There was an error while trying to load the gem 'sinatra'.
  Gem Load Error is: invalid option: --pattern
  Backtrace for gem load error is:
  /Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sinatra-2.0.6/lib/sinatra/main.rb:18:in `<module:Sinatra>'
  /Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sinatra-2.0.6/lib/sinatra/main.rb:1:in `<top (required)>'
  /Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sinatra-2.0.6/lib/sinatra.rb:1:in `require'
  /Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sinatra-2.0.6/lib/sinatra.rb:1:in `<top (required)>'
  /Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:81:in `require'
  /Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:81:in `block (2 levels) in require'
  /Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:76:in `each'
  /Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:76:in `block in require'
  /Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:65:in `each'
  /Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:65:in `require'
  /Users/jason/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bundler-2.0.2/lib/bundler.rb:114:in `require'
# etc. etc. etc.

Strangely (to me, at least), bundle exec rspec works just fine which led me to the --pattern bit maybe being the issue.

bundle exec rake worked as expected before updating several of my applications to v2.0.6.

@namusyaka
Copy link
Member

This is because the difference between the actual executable file and the actual caller haven't been handled properly.

@jgarber623
Copy link

Oh, shoot. Apologies for the noise. The application code linked in the initial bug report is also using RSpec.

@namusyaka
Copy link
Member

@jgarber623 @rubys Could you try again with #1560?

@rubys
Copy link
Author

rubys commented Aug 22, 2019

My tests pass with #1560 applied.

@namusyaka
Copy link
Member

namusyaka commented Aug 22, 2019

I'll cut a patch release later.
LMK if you still have issues.

namusyaka added a commit that referenced this issue Aug 22, 2019
@sue445
Copy link

sue445 commented Aug 22, 2019

@namusyaka thank you for bugfix. #1560 works on my app too!

@namusyaka
Copy link
Member

Released v2.0.7: https://rubygems.org/gems/sinatra/versions/2.0.7
Thanks all for your feedback, it was very helpful to me.

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

No branches or pull requests

4 participants