Bug 828002

Summary: ruby package does not dep-in rubygem-bigdecimal
Product: [Fedora] Fedora Reporter: postmodern <postmodern.mod3>
Component: rubyAssignee: Jeroen van Meeuwen <vanmeeuwen+fedora>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: bkabrda, jeremy, mmorsi, mtasaka, sshedmak, tagoh, vanmeeuwen+fedora, vondruch
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-15 09:53:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description postmodern 2012-06-04 00:55:24 UTC
Description of problem:

When installing the ruby package, it also installs rubygem-json and rubygem-io-console (which are normally part of the ruby stdlib). However, rubygem-bigdecimal is not installed, despite it being part of the ruby stdlib.  https://github.com/ruby/ruby/tree/436d819bf2f51b7e01aab070f92e8864793c8d16/ext/bigdecimal


Version-Release number of selected component (if applicable):

ruby-1.9.3.194 (10.1.fc17)
rubygem-bigdecimal-1.1.0 (10.1.fc17)

How reproducible: 

Steps to Reproduce:
1. yum install ruby ruby-irb rubygems
2. irb
3. require 'bigdecimal'
  
Actual results:

LoadError: cannot load such file -- bigdecimal
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from /usr/share/rubygems/rubygems/custom_require.rb:36:in `require'
	from (irb):3
	from /usr/bin/irb:12:in `<main>'


Expected results:

bigdecimal is required.

Additional info:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.8.24
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/share/gems
  - RUBY EXECUTABLE: /usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/share/gems
     - /root/.gem/ruby/1.9.1
     - /usr/share/gems
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

Comment 1 Bohuslav "Slavek" Kabrda 2012-06-04 08:54:38 UTC
bigdecimal Gem is one of the bundled Gems in new Ruby. We unbundled it and we now ship it as a separate package (rubygem-bigdecimal). As this Gem is not a hard dependency for Ruby itself (the only thing that requires it from the rest of Ruby is "/ext/psych/lib/psych/visitors/to_ruby.rb"), I would say that it's an optional dependency and doesn't have to be required by Ruby itself.

I am however leaving this bug open for more people from Ruby SIG to express their opinions.

BTW, these "fake gems" are showing more issues, that are even not Fedora specific. See [1] for the reports on Redmine.

[1] https://bugs.ruby-lang.org/issues/6124

Comment 2 postmodern 2012-06-04 09:11:12 UTC
Many RubyGems require bigdecimal [1], but do not define a dependency on the actual bigdecimal gem [2], thus expecting bigdecimal to be installed along with the Ruby stdlib.

[1]: https://github.com/search?q=%22require+%27bigdecimal%27%22&repo=&langOverride=&start_value=1&type=Code&language=Ruby
[2]: https://rubygems.org/gems/bigdecimal

Comment 3 postmodern 2012-06-04 09:24:12 UTC
BTW, these fake stdlib gems also confused the Bundler utility [1]. Although, I expect the Bundler developers will support /usr/share/gems soon. The ruby-core team eventually plans to gemify stdlib in Ruby 3.0 [2]. I like Fedora's approach to beginning the gemification of the Ruby stdlib.

[1]: https://github.com/carlhuda/bundler/issues/1960
[2]: http://bugs.ruby-lang.org/issues/5481

Comment 4 Vít Ondruch 2012-06-04 10:20:12 UTC
Hi postmodern,

I understand your sentiment and I can assure you that we are not happy about the situation. But we strive for correct solution. The only correct solution IMO is to gemify the stdlib correctly. If it will be gemified correctly, all the gems you mention should depend on bigdecimal. That is why are we trying to correct the situation with upstream, as mentioned by Slavek [1].



[1] https://bugs.ruby-lang.org/issues/6124

Comment 5 postmodern 2012-06-05 01:05:11 UTC
I've found a workaround to this issue. Simply add symlinks into /usr/share/ruby/ and /usr/lib/ruby/ to bigdecimal.

$ ln -s /usr/share/gems/gems/bigdecimal-1.1.0/lib/bigdecimal /usr/share/ruby/bigdecimal
$ ln -s /usr/lib/gems/exts/bigdecimal-1.1.0/lib/bigdecimal.so /usr/lib/ruby/bigdecimal.so

This allows Ruby projects that use Bundler to require bigdecimal, without explicitly depending on bigdecimal.

Perhaps rubygem-bigdecimal, rubygem-json, rubygem-io-console could add these symlinks for maximum backwards compatibility?

Comment 6 Vít Ondruch 2012-06-05 05:59:58 UTC
(In reply to comment #5)
> Perhaps rubygem-bigdecimal, rubygem-json, rubygem-io-console could add these
> symlinks for maximum backwards compatibility?

I am against this idea. Once you put these symlinks in place, you will never be able to correct this situation, since you will not be able to detect this issue.

Comment 7 Bohuslav "Slavek" Kabrda 2012-06-05 06:29:40 UTC
(In reply to comment #6)
> (In reply to comment #5)
> > Perhaps rubygem-bigdecimal, rubygem-json, rubygem-io-console could add these
> > symlinks for maximum backwards compatibility?
> 
> I am against this idea. Once you put these symlinks in place, you will never
> be able to correct this situation, since you will not be able to detect this
> issue.

Also, as already mentioned in [1], this prevents using newer versions of these gems, if they are not in Gemfile or gemspecs (therefore don't get picked up by rubygems loading mechanism). It is not the case for json, but it is the case for io-console and most importantly bigdecimal.

[1] https://bugs.ruby-lang.org/issues/6124

Comment 8 Bohuslav "Slavek" Kabrda 2012-06-15 09:53:53 UTC
The symlinks were added for bigdecimal and io-console in this update:

https://admin.fedoraproject.org/updates/FEDORA-2012-9264/ruby-1.9.3.194-13.fc17

Use 'sudo yum update ruby rubygem-bigdecimal rubygem-io-console --enablerepo=udpates-testing' to update.

Comment 9 postmodern 2012-06-15 10:33:18 UTC
Updated and my test-suites pass now. Thank you!