From: hsbt@ruby-lang.org
To: ruby-core@ruby-lang.org
Subject: [ruby-core:91141] [Ruby trunk Bug#15500] Behavior of require method in 2.5 is different from 2.4 and 2.6
Date: Thu, 17 Jan 2019 12:52:37 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-76372.20190117125235.517da0ef9a8d9ac5@ruby-lang.org> (raw)
In-Reply-To: redmine.issue-15500.20190103053456@ruby-lang.org
Issue #15500 has been updated by hsbt (Hiroshi SHIBATA).
I could reproduce them. But I also reproduce it with Ruby 2.5.3 with RubyGems 2.6.14.3 bundled with Ruby 2.4.
```
~ > ruby -v
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
~ > gem -v
2.6.14.3
~ > gem list bigdecimal
*** LOCAL GEMS ***
bigdecimal (1.4.3, default: 1.3.4)
~ > ruby -e "require 'bigdecimal'; p \$LOADED_FEATURES.grep(/bigdecimal/).first"
"/Users/hsbt/.rbenv/versions/2.5.3/lib/ruby/2.5.0/x86_64-darwin18/bigdecimal.bundle"
```
It seems this issue produced by Ruby core without RubyGems maybe.
----------------------------------------
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-76372
* Author: mrkn (Kenta Murata)
* Status: Assigned
* 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: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
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/
next prev parent reply other threads:[~2019-01-17 12:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <redmine.issue-15500.20190103053456@ruby-lang.org>
2019-01-03 5:34 ` [ruby-core:90867] [Ruby trunk Bug#15500] Behavior of require method in 2.5 is different from 2.4 and 2.6 muraken
2019-01-03 6:40 ` [ruby-core:90868] " ruby-core
2019-01-03 7:13 ` [ruby-core:90869] " muraken
2019-01-10 8:56 ` [ruby-core:90983] [Ruby trunk Bug#15500][Assigned] " hsbt
2019-01-17 12:52 ` hsbt [this message]
2019-01-19 3:37 ` [ruby-core:91168] [Ruby trunk Bug#15500] " hsbt
2019-01-24 1:00 ` [ruby-core:91238] " naruse
2019-01-24 6:06 ` [ruby-core:91245] " muraken
2019-02-05 12:15 ` [ruby-core:91408] " nagachika00
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.ruby-lang.org/en/community/mailing-lists/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-76372.20190117125235.517da0ef9a8d9ac5@ruby-lang.org \
--to=ruby-core@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).