#1247 ✓resolved
Postmodern

DataMapper libraries should not freeze their VERSION constants.

Reported by Postmodern | April 16th, 2010 @ 01:49 AM

RubyGems throws an exception under 1.9.1 and 1.9.2 if the VERSION supplied to the Gem Specification is frozen.

$ cd do/do_sqlite3
$ rvm use 1.9.1
$ rake build --trace
(in /home/hal/do/do_sqlite3)
rake aborted!
can't modify frozen string
/home/hal/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/site_ruby/1.9.1/rubygems/version.rb:186:in `strip!'
/home/hal/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/site_ruby/1.9.1/rubygems/version.rb:186:in `initialize'
/home/hal/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/site_ruby/1.9.1/rubygems/version.rb:173:in `new'
/home/hal/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/site_ruby/1.9.1/rubygems/version.rb:173:in `create'
/home/hal/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1366:in `block in <class:Specification>'
/home/hal/do/do_sqlite3/Rakefile:24:in `block in <top (required)>'
/home/hal/.rvm/gems/ruby-1.9.1-p378/gems/jeweler-1.4.0/lib/jeweler/tasks.rb:58:in `call'
/home/hal/.rvm/gems/ruby-1.9.1-p378/gems/jeweler-1.4.0/lib/jeweler/tasks.rb:58:in `yield_gemspec_set_version?'
/home/hal/.rvm/gems/ruby-1.9.1-p378/gems/jeweler-1.4.0/lib/jeweler/tasks.rb:105:in `define'
/home/hal/.rvm/gems/ruby-1.9.1-p378/gems/jeweler-1.4.0/lib/jeweler/tasks.rb:38:in `initialize'
/home/hal/do/do_sqlite3/Rakefile:22:in `new'
/home/hal/do/do_sqlite3/Rakefile:22:in `<top (required)>'
/home/hal/.rvm/gems/ruby-1.9.1-p378@global/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/home/hal/.rvm/gems/ruby-1.9.1-p378@global/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/home/hal/.rvm/gems/ruby-1.9.1-p378@global/gems/rake-0.8.7/lib/rake.rb:2017:in `block in load_rakefile'
/home/hal/.rvm/gems/ruby-1.9.1-p378@global/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/hal/.rvm/gems/ruby-1.9.1-p378@global/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/home/hal/.rvm/gems/ruby-1.9.1-p378@global/gems/rake-0.8.7/lib/rake.rb:2000:in `block in run'
/home/hal/.rvm/gems/ruby-1.9.1-p378@global/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/hal/.rvm/gems/ruby-1.9.1-p378@global/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/hal/.rvm/rubies/ruby-1.9.1-p378/bin/rake:36:in `<main>'
$ rvm use 1.9.2
$ rake build --trace
(in /home/hal/do/do_sqlite3)
rake aborted!
can't modify frozen string
/home/hal/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/site_ruby/1.9.1/rubygems/version.rb:186:in `strip!'
/home/hal/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/site_ruby/1.9.1/rubygems/version.rb:186:in `initialize'
/home/hal/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/site_ruby/1.9.1/rubygems/version.rb:173:in `new'
/home/hal/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/site_ruby/1.9.1/rubygems/version.rb:173:in `create'
/home/hal/.rvm/rubies/ruby-1.9.2-preview1/lib/ruby/site_ruby/1.9.1/rubygems/specification.rb:1366:in `block in <class:Specification>'
/home/hal/do/do_sqlite3/Rakefile:24:in `block in <top (required)>'
/home/hal/.rvm/gems/ruby-1.9.2-preview1/gems/jeweler-1.4.0/lib/jeweler/tasks.rb:58:in `call'
/home/hal/.rvm/gems/ruby-1.9.2-preview1/gems/jeweler-1.4.0/lib/jeweler/tasks.rb:58:in `yield_gemspec_set_version?'
/home/hal/.rvm/gems/ruby-1.9.2-preview1/gems/jeweler-1.4.0/lib/jeweler/tasks.rb:105:in `define'
/home/hal/.rvm/gems/ruby-1.9.2-preview1/gems/jeweler-1.4.0/lib/jeweler/tasks.rb:38:in `initialize'
/home/hal/do/do_sqlite3/Rakefile:22:in `new'
/home/hal/do/do_sqlite3/Rakefile:22:in `<top (required)>'
/home/hal/.rvm/gems/ruby-1.9.2-preview1@global/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/home/hal/.rvm/gems/ruby-1.9.2-preview1@global/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/home/hal/.rvm/gems/ruby-1.9.2-preview1@global/gems/rake-0.8.7/lib/rake.rb:2017:in `block in load_rakefile'
/home/hal/.rvm/gems/ruby-1.9.2-preview1@global/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/hal/.rvm/gems/ruby-1.9.2-preview1@global/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/home/hal/.rvm/gems/ruby-1.9.2-preview1@global/gems/rake-0.8.7/lib/rake.rb:2000:in `block in run'
/home/hal/.rvm/gems/ruby-1.9.2-preview1@global/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/hal/.rvm/gems/ruby-1.9.2-preview1@global/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/hal/.rvm/rubies/ruby-1.9.2-preview1/bin/rake:36:in `<main>'

Comments and changes to this ticket

  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) May 21st, 2010 @ 02:05 PM

    • State changed from “new” to “resolved”

    All DM and DO gems should be updated not to freeze their VERSION constants now.

    However, IMHO, this is probably more a bug in rubygems. I think constants should almost always be frozen, and it would be far better if the code in rubygems should be rewritten to something like this:

    @version = version.to_s.strip
    

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Pages