From: naruse@... Date: 2019-01-24T01:00:24+00:00 Subject: [ruby-core:91238] [Ruby trunk Bug#15500] Behavior of require method in 2.5 is different from 2.4 and 2.6 Issue #15500 has been updated by naruse (Yui NARUSE). Backport changed from 2.4: DONTNEED, 2.5: REQUIRED, 2.6: REQUIRED to 2.4: DONTNEED, 2.5: REQUIRED, 2.6: DONE ruby_2_6 r66913 merged revision(s) 66867. ---------------------------------------- Bug #15500: Behavior of require method in 2.5 is different from 2.4 and 2.6 https://bugs.ruby-lang.org/issues/15500#change-76483 * Author: mrkn (Kenta Murata) * Status: Closed * Priority: Normal * Assignee: hsbt (Hiroshi SHIBATA) * Target version: * ruby -v: ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18] * Backport: 2.4: DONTNEED, 2.5: REQUIRED, 2.6: DONE ---------------------------------------- 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. ```ruby 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" ``` -- https://bugs.ruby-lang.org/ Unsubscribe: