* [ruby-core:95358] [Ruby master Bug#16257] Gem::Version instances are silently created as singletons
[not found] <redmine.issue-16257.20191016082305@ruby-lang.org>
@ 2019-10-16 8:23 ` tonci.damjanic
2019-10-16 8:25 ` [ruby-core:95359] " tonci.damjanic
` (3 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: tonci.damjanic @ 2019-10-16 8:23 UTC (permalink / raw
To: ruby-core
Issue #16257 has been reported by tonci (Tonči Damjanić).
----------------------------------------
Bug #16257: Gem::Version instances are silently created as singletons
https://bugs.ruby-lang.org/issues/16257
* Author: tonci (Tonči Damjanić)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Instantiating `Gem::Version` objects via `new` actually returns singletons, which is not obvious nor is this documented anywhere:
~~~
irb(main):001:0> v1 = Gem::Version.new("2.2.0")
=> #<Gem::Version "2.2.0">
irb(main):002:0> v1.frozen?
=> false
irb(main):003:0> v2 = Gem::Version.new("2.2.0")
=> #<Gem::Version "2.2.0">
irb(main):004:0> v2.frozen?
=> false
irb(main):005:0> v1.freeze
=> #<Gem::Version "2.2.0">
irb(main):006:0> v1.frozen?
=> true
irb(main):007:0> v2.frozen?
=> true
irb(main):008:0> v1.object_id == v2.object_id
=> true
~~~
Affected Ruby versions:
* `ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]`
* `ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-darwin17]`
This feature can cause side-effects if the application freezes a `Gem::Version` that matches the version of one of the loaded gems.
```
class ApplicationController < ActionController::Base
...
SOME_VERSION = Gem::Version.new('2.2.0').freeze
end
```
Error raised during `rails console` startup (notice that `js_cookie_rails` is on the same version):
```
Invalid gemspec in [/var/www/application-server/vendor/bundle/ruby/2.4/specifications/js_cookie_rails-2.2.0.gemspec]: can't modify frozen Gem::Version
/usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/stub_specification.rb:97:in `_remote_specification': The gemspec for js_cookie_rails-2.2.0 at /var/www/application-server/vendor/bundle/ruby/2.4/specifications/js_cookie_rails-2.2.0.gemspec was missing or broken. Try running `gem pristine js_cookie_rails -v 2.2.0` to fix the cached spec. (Bundler::GemspecError)
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/remote_specification.rb:106:in `method_missing'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1040:in `block in find_by_path'
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1039:in `find'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1039:in `find_by_path'
from /usr/share/ruby/vendor_ruby/2.4/rubygems.rb:209:in `try_activate'
...
```
Unfreezing the constant fixes the gemspec error.
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:95359] [Ruby master Bug#16257] Gem::Version instances are silently created as singletons
[not found] <redmine.issue-16257.20191016082305@ruby-lang.org>
2019-10-16 8:23 ` [ruby-core:95358] [Ruby master Bug#16257] Gem::Version instances are silently created as singletons tonci.damjanic
@ 2019-10-16 8:25 ` tonci.damjanic
2019-10-16 8:59 ` [ruby-core:95362] " nobu
` (2 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: tonci.damjanic @ 2019-10-16 8:25 UTC (permalink / raw
To: ruby-core
Issue #16257 has been updated by tonci (Tonči Damjanić).
File full-stack-trace.txt added
Attached the full stack trace.
----------------------------------------
Bug #16257: Gem::Version instances are silently created as singletons
https://bugs.ruby-lang.org/issues/16257#change-82066
* Author: tonci (Tonči Damjanić)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Instantiating `Gem::Version` objects via `new` actually returns singletons, which is not obvious nor is this documented anywhere:
~~~
irb(main):001:0> v1 = Gem::Version.new("2.2.0")
=> #<Gem::Version "2.2.0">
irb(main):002:0> v1.frozen?
=> false
irb(main):003:0> v2 = Gem::Version.new("2.2.0")
=> #<Gem::Version "2.2.0">
irb(main):004:0> v2.frozen?
=> false
irb(main):005:0> v1.freeze
=> #<Gem::Version "2.2.0">
irb(main):006:0> v1.frozen?
=> true
irb(main):007:0> v2.frozen?
=> true
irb(main):008:0> v1.object_id == v2.object_id
=> true
~~~
Affected Ruby versions:
* `ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]`
* `ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-darwin17]`
This feature can cause side-effects if the application freezes a `Gem::Version` that matches the version of one of the loaded gems.
```
class ApplicationController < ActionController::Base
...
SOME_VERSION = Gem::Version.new('2.2.0').freeze
end
```
Error raised during `rails console` startup (notice that `js_cookie_rails` is on the same version):
```
Invalid gemspec in [/var/www/application-server/vendor/bundle/ruby/2.4/specifications/js_cookie_rails-2.2.0.gemspec]: can't modify frozen Gem::Version
/usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/stub_specification.rb:97:in `_remote_specification': The gemspec for js_cookie_rails-2.2.0 at /var/www/application-server/vendor/bundle/ruby/2.4/specifications/js_cookie_rails-2.2.0.gemspec was missing or broken. Try running `gem pristine js_cookie_rails -v 2.2.0` to fix the cached spec. (Bundler::GemspecError)
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/remote_specification.rb:106:in `method_missing'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1040:in `block in find_by_path'
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1039:in `find'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1039:in `find_by_path'
from /usr/share/ruby/vendor_ruby/2.4/rubygems.rb:209:in `try_activate'
...
```
Unfreezing the `SOME_VERSION` constant fixes the gemspec error.
---Files--------------------------------
full-stack-trace.txt (4.98 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:95362] [Ruby master Bug#16257] Gem::Version instances are silently created as singletons
[not found] <redmine.issue-16257.20191016082305@ruby-lang.org>
2019-10-16 8:23 ` [ruby-core:95358] [Ruby master Bug#16257] Gem::Version instances are silently created as singletons tonci.damjanic
2019-10-16 8:25 ` [ruby-core:95359] " tonci.damjanic
@ 2019-10-16 8:59 ` nobu
2019-10-16 12:59 ` [ruby-core:95365] " tonci.damjanic
2019-10-17 7:53 ` [ruby-core:95389] " tonci.damjanic
4 siblings, 0 replies; 5+ messages in thread
From: nobu @ 2019-10-16 8:59 UTC (permalink / raw
To: ruby-core
Issue #16257 has been updated by nobu (Nobuyoshi Nakada).
Status changed from Open to Third Party's Issue
It is an issue of rubygems.
Please report it at https://github.com/rubygems/rubygems/
----------------------------------------
Bug #16257: Gem::Version instances are silently created as singletons
https://bugs.ruby-lang.org/issues/16257#change-82070
* Author: tonci (Tonči Damjanić)
* Status: Third Party's Issue
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Instantiating `Gem::Version` objects via `new` actually returns singletons, which is not obvious nor is this documented anywhere:
~~~
irb(main):001:0> v1 = Gem::Version.new("2.2.0")
=> #<Gem::Version "2.2.0">
irb(main):002:0> v1.frozen?
=> false
irb(main):003:0> v2 = Gem::Version.new("2.2.0")
=> #<Gem::Version "2.2.0">
irb(main):004:0> v2.frozen?
=> false
irb(main):005:0> v1.freeze
=> #<Gem::Version "2.2.0">
irb(main):006:0> v1.frozen?
=> true
irb(main):007:0> v2.frozen?
=> true
irb(main):008:0> v1.object_id == v2.object_id
=> true
~~~
Affected Ruby versions:
* `ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]`
* `ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-darwin17]`
This feature can cause side-effects if the application freezes a `Gem::Version` that matches the version of one of the loaded gems.
```
class ApplicationController < ActionController::Base
...
SOME_VERSION = Gem::Version.new('2.2.0').freeze
end
```
Error raised during `rails console` startup (notice that `js_cookie_rails` is on the same version):
```
Invalid gemspec in [/var/www/application-server/vendor/bundle/ruby/2.4/specifications/js_cookie_rails-2.2.0.gemspec]: can't modify frozen Gem::Version
/usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/stub_specification.rb:97:in `_remote_specification': The gemspec for js_cookie_rails-2.2.0 at /var/www/application-server/vendor/bundle/ruby/2.4/specifications/js_cookie_rails-2.2.0.gemspec was missing or broken. Try running `gem pristine js_cookie_rails -v 2.2.0` to fix the cached spec. (Bundler::GemspecError)
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/remote_specification.rb:106:in `method_missing'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1040:in `block in find_by_path'
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1039:in `find'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1039:in `find_by_path'
from /usr/share/ruby/vendor_ruby/2.4/rubygems.rb:209:in `try_activate'
...
```
Unfreezing the `SOME_VERSION` constant fixes the gemspec error.
---Files--------------------------------
full-stack-trace.txt (4.98 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:95365] [Ruby master Bug#16257] Gem::Version instances are silently created as singletons
[not found] <redmine.issue-16257.20191016082305@ruby-lang.org>
` (2 preceding siblings ...)
2019-10-16 8:59 ` [ruby-core:95362] " nobu
@ 2019-10-16 12:59 ` tonci.damjanic
2019-10-17 7:53 ` [ruby-core:95389] " tonci.damjanic
4 siblings, 0 replies; 5+ messages in thread
From: tonci.damjanic @ 2019-10-16 12:59 UTC (permalink / raw
To: ruby-core
Issue #16257 has been updated by tonci (Tonči Damjanić).
Done: https://github.com/rubygems/rubygems/issues/2948
----------------------------------------
Bug #16257: Gem::Version instances are silently created as singletons
https://bugs.ruby-lang.org/issues/16257#change-82073
* Author: tonci (Tonči Damjanić)
* Status: Third Party's Issue
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Instantiating `Gem::Version` objects via `new` actually returns singletons, which is not obvious nor is this documented anywhere:
~~~
irb(main):001:0> v1 = Gem::Version.new("2.2.0")
=> #<Gem::Version "2.2.0">
irb(main):002:0> v1.frozen?
=> false
irb(main):003:0> v2 = Gem::Version.new("2.2.0")
=> #<Gem::Version "2.2.0">
irb(main):004:0> v2.frozen?
=> false
irb(main):005:0> v1.freeze
=> #<Gem::Version "2.2.0">
irb(main):006:0> v1.frozen?
=> true
irb(main):007:0> v2.frozen?
=> true
irb(main):008:0> v1.object_id == v2.object_id
=> true
~~~
Affected Ruby versions:
* `ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]`
* `ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-darwin17]`
This feature can cause side-effects if the application freezes a `Gem::Version` that matches the version of one of the loaded gems.
```
class ApplicationController < ActionController::Base
...
SOME_VERSION = Gem::Version.new('2.2.0').freeze
end
```
Error raised during `rails console` startup (notice that `js_cookie_rails` is on the same version):
```
Invalid gemspec in [/var/www/application-server/vendor/bundle/ruby/2.4/specifications/js_cookie_rails-2.2.0.gemspec]: can't modify frozen Gem::Version
/usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/stub_specification.rb:97:in `_remote_specification': The gemspec for js_cookie_rails-2.2.0 at /var/www/application-server/vendor/bundle/ruby/2.4/specifications/js_cookie_rails-2.2.0.gemspec was missing or broken. Try running `gem pristine js_cookie_rails -v 2.2.0` to fix the cached spec. (Bundler::GemspecError)
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/remote_specification.rb:106:in `method_missing'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1040:in `block in find_by_path'
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1039:in `find'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1039:in `find_by_path'
from /usr/share/ruby/vendor_ruby/2.4/rubygems.rb:209:in `try_activate'
...
```
Unfreezing the `SOME_VERSION` constant fixes the gemspec error.
---Files--------------------------------
full-stack-trace.txt (4.98 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
* [ruby-core:95389] [Ruby master Bug#16257] Gem::Version instances are silently created as singletons
[not found] <redmine.issue-16257.20191016082305@ruby-lang.org>
` (3 preceding siblings ...)
2019-10-16 12:59 ` [ruby-core:95365] " tonci.damjanic
@ 2019-10-17 7:53 ` tonci.damjanic
4 siblings, 0 replies; 5+ messages in thread
From: tonci.damjanic @ 2019-10-17 7:53 UTC (permalink / raw
To: ruby-core
Issue #16257 has been updated by tonci (Tonči Damjanić).
Fixed and scheduled for rubygems v3.1.0.
----------------------------------------
Bug #16257: Gem::Version instances are silently created as singletons
https://bugs.ruby-lang.org/issues/16257#change-82102
* Author: tonci (Tonči Damjanić)
* Status: Third Party's Issue
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Instantiating `Gem::Version` objects via `new` actually returns singletons, which is not obvious nor is this documented anywhere:
~~~
irb(main):001:0> v1 = Gem::Version.new("2.2.0")
=> #<Gem::Version "2.2.0">
irb(main):002:0> v1.frozen?
=> false
irb(main):003:0> v2 = Gem::Version.new("2.2.0")
=> #<Gem::Version "2.2.0">
irb(main):004:0> v2.frozen?
=> false
irb(main):005:0> v1.freeze
=> #<Gem::Version "2.2.0">
irb(main):006:0> v1.frozen?
=> true
irb(main):007:0> v2.frozen?
=> true
irb(main):008:0> v1.object_id == v2.object_id
=> true
~~~
Affected Ruby versions:
* `ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux]`
* `ruby 2.4.4p296 (2018-03-28 revision 63013) [x86_64-darwin17]`
This feature can cause side-effects if the application freezes a `Gem::Version` that matches the version of one of the loaded gems.
```
class ApplicationController < ActionController::Base
...
SOME_VERSION = Gem::Version.new('2.2.0').freeze
end
```
Error raised during `rails console` startup (notice that `js_cookie_rails` is on the same version):
```
Invalid gemspec in [/var/www/application-server/vendor/bundle/ruby/2.4/specifications/js_cookie_rails-2.2.0.gemspec]: can't modify frozen Gem::Version
/usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/stub_specification.rb:97:in `_remote_specification': The gemspec for js_cookie_rails-2.2.0 at /var/www/application-server/vendor/bundle/ruby/2.4/specifications/js_cookie_rails-2.2.0.gemspec was missing or broken. Try running `gem pristine js_cookie_rails -v 2.2.0` to fix the cached spec. (Bundler::GemspecError)
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/remote_specification.rb:106:in `method_missing'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1040:in `block in find_by_path'
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
from /usr/local/share/ruby/gems/2.4/gems/bundler-2.0.2/lib/bundler/spec_set.rb:148:in `each'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1039:in `find'
from /usr/share/ruby/vendor_ruby/2.4/rubygems/specification.rb:1039:in `find_by_path'
from /usr/share/ruby/vendor_ruby/2.4/rubygems.rb:209:in `try_activate'
...
```
Unfreezing the `SOME_VERSION` constant fixes the gemspec error.
---Files--------------------------------
full-stack-trace.txt (4.98 KB)
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-10-17 7:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <redmine.issue-16257.20191016082305@ruby-lang.org>
2019-10-16 8:23 ` [ruby-core:95358] [Ruby master Bug#16257] Gem::Version instances are silently created as singletons tonci.damjanic
2019-10-16 8:25 ` [ruby-core:95359] " tonci.damjanic
2019-10-16 8:59 ` [ruby-core:95362] " nobu
2019-10-16 12:59 ` [ruby-core:95365] " tonci.damjanic
2019-10-17 7:53 ` [ruby-core:95389] " tonci.damjanic
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).