Project

General

Profile

Actions

Bug #15500

closed

Behavior of require method in 2.5 is different from 2.4 and 2.6

Added by mrkn (Kenta Murata) about 5 years ago. Updated about 5 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
[ruby-core:90867]

Description

On Ruby 2.5, require 'bigdecimal' does not load bigdecimal.so in gem-installed version of bigdecimal without specifying the version by gem method.
You can examine this phenomenon by the following code.

require 'bigdecimal'
p $LOADED_FEATURES.grep(/bigdecimal/).first

After installing bigdecimal-1.4.2 by gem install bigdecimal command, this code (saved as t.rb) show the following results:

On Ruby 2.4.5

$ ruby-2.4.5 -v t.rb
ruby 2.4.5p335 (2018-10-18 revision 65137) [x86_64-darwin18]
"/Users/mrkn/.rbenv/versions/2.4.5/lib/ruby/gems/2.4.0/gems/bigdecimal-1.4.2/lib/bigdecimal.bundle"

On Ruby 2.5.3:

$ ruby-2.5.3 -v t.rb
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
"/Users/mrkn/.rbenv/versions/2.5.3/lib/ruby/2.5.0/x86_64-darwin18/bigdecimal.bundle"

On Ruby 2.6.0:

$ ruby-2.6.0 -v t.rb
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-darwin18]
"/Users/mrkn/.rbenv/versions/2.6.0/lib/ruby/gems/2.6.0/gems/bigdecimal-1.4.2/lib/bigdecimal.bundle"

On Ruby 2.5.3, with gem 'bigdecimal', '1.4.2', the correct file can be loaded.

$ ( echo "gem 'bigdecimal', '1.4.2'"; cat t.rb ) | ruby-2.5.3 -v -
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
"/Users/mrkn/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0/gems/bigdecimal-1.4.2/lib/bigdecimal.bundle"

Related issues 3 (0 open3 closed)

Related to Ruby master - Misc #15486: Default gems README.mdFeedbackhsbt (Hiroshi SHIBATA)Actions
Related to Ruby master - Bug #15545: Backport r58403Closednagachika (Tomoyuki Chikanaga)Actions
Related to Ruby master - Bug #15469: Ruby2.6 included `bundler` does not handle specified `csv` gem.Closedhsbt (Hiroshi SHIBATA)Actions
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0Like0