janlelis/unicode-display_width

Parse error in v1.0.1 RubyGems gemspec

leoarnold opened this issue · 11 comments

Using Bundler and v1.0.1 from RubyGems.org I get the error

Invalid gemspec in [XXX/.vendor/bundle/ruby/1.9.1/specifications/unicode-display_width-1.0.1.gemspec]: Illformed requirement ["< 3.0.0, >= 1.9.3"]

which stems from the GemSpec line

  s.required_ruby_version = Gem::Requirement.new("< 3.0.0,>= 1.9.3")

but it works if I change it to

  # Inserted extra quotation marks
  s.required_ruby_version = Gem::Requirement.new("< 3.0.0",">= 1.9.3")

Thank you for reporting this. Can you confirm it works with 1.0.2?

Out of curiosity: Which versions of ruby, rubygems, and bundler were you using?

Negative:

Invalid gemspec in [XXX/.vendor/bundle/ruby/1.9.1/specifications/unicode-display_width-1.0.2.gemspec]: Illformed requirement ["< 3.0.0, >= 1.9.3"]

because still

s.required_ruby_version = Gem::Requirement.new("< 3.0.0, >= 1.9.3")

Which versions of

  • Ruby
  • RubyGems
  • Bundle
  • and which OS

are you using?

$ ruby --version
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
$ gem --version
1.8.23
$ bundle --version
Bundler version 1.10.5
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:        14.04
Codename:       trusty

Ruby comes from the OS repo, no RVM used.

Thank you for the additional info. This is a bug in Ruby, RubyGems, or Bundler, that seems to be already fixed (somewhere).

Ruby 1.9.3 is not officially supported by this gem. Although, Ruby 2.0 also has reached its EOL (https://www.ruby-lang.org/en/news/2016/02/24/support-plan-of-ruby-2-0-0-and-2-1/), maybe it already fixed the issue. So if it is an option for you, try if it works with http://packages.ubuntu.com/trusty/ruby/ruby2.0

Additionally, I created a branch with the proposed fix: https://github.com/janlelis/unicode-display_width/tree/old-rubies
You can use it with bundler with the following Gemfile line:

gem 'unicode-display_width', branch: 'old-rubies'

Feel free to post additional feedback or re-open if you can reproduce it with a Ruby version >= 2.1 (and current versions of RubyGems and Bundler)

I used

gem 'unicode-display_width', git: 'https://github.com/janlelis/unicode-display_width', branch: 'old-rubies'

and got

There was a RuntimeError while loading unicode-display_width.gemspec: 
can't modify frozen String from                                                                         
XXX/ruby/1.9.1/bundler/gems/unicode-display_width-eaf1d4fa1aea/unicode-display_width.gemspec:6:in                                                                                              
`block in <main>'

Personally I can nudge this manually until Ubuntu 16.04 LTS (Ruby 2.2) is released in April.

Bundler still exits 0 so this should not cause problems in Travis CI builds with Ruby 1.9.

Can you bundle update (for 4d6cc31) and try again?

Looks good:

$ bundle install --path vendor
Fetching https://github.com/janlelis/unicode-display_width
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies...
Rubygems 1.8.23 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
Using unicode-display_width 1.0.2 from https://github.com/janlelis/unicode-display_width (at old-rubies@4d6cc31)
Using bundler 1.11.2
Bundle complete! 1 Gemfile dependency, 2 gems now installed.
Bundled gems are installed into ./vendor.

with this branch on:

% ruby -v
ruby 1.9.3p551 (2014-11-13 revision 48407) [x86_64-linux]
% bundler -v
Bundler version 1.11.2
% bundle exec gem -v
1.8.23.2

and:

gem 'unicode-display_width', git: 'https://github.com/janlelis/unicode-display_width', branch: 'old-rubies'

I am still getting:

There was a ArgumentError while loading unicode-display_width.gemspec:
Illformed requirement ["< 3.0.0, >= 1.9.3"] from
  /home/rip/.rbenv/versions/1.9.3-p551/lib/ruby/gems/1.9.1/bundler/gems/unicode-display_width-4d6cc319c658/unicode-display_width.gemspec:17:in `new'

The bundle install as above from @leoarnold works, but after that any attempt to use the installed bundled fail as above :(

We have some dependencies who have not yet made themselves modern ruby aware so pretty stuck

I removed the < 3.0 part from the requirement, should work now

Thanks @janlelis for the effort to support crappy old rubies :( works with that change