Issue #12667 has been reported by Jeff C.

----------------------------------------
Bug #12667: full_gem_path is incorrect for core modules
https://bugs.ruby-lang.org/issues/12667

* Author: Jeff C
* Status: Open
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
`#find_full_gem_path` [assumes all gems are in `gems_dir`](https://github.com/ruby/ruby/blob/trunk/lib/rubygems/basic_specification.rb#L105). It also leverages `full_name`, which [assumes the directory includes the version](https://github.com/ruby/ruby/blob/trunk/lib/rubygems/basic_specification.rb#L128-L130). Neither is correct for core modules that behave like gems (e.g., JSON), which are located in `lib/ruby/2.3.0` instead of `lib/ruby/gems/2.3.0/gems` and are unversioned. This causes `#full_gem_path` to return an incorrect value:

```ruby
> spec = Gem::Specification::load('~/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/specifications/default/json-1.8.3.gemspec')
=> #<Gem::Specification:0x3fc7f944ef20 json-1.8.3>
> spec.full_gem_path
=> "~/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/json-1.8.3"
```

In this case, `#full_gem_path` should return `~/.rbenv/versions/2.3.1/lib/ruby/2.3.0/json`.

This incorrect value causes anything that depends upon `#full_gem_path` to find the gem to fail; e.g., [`bundle show`](https://github.com/bundler/bundler/blob/master/lib/bundler/cli/show.rb#L26-L29):

```
% bundle show json
The gem json has been deleted. It was installed at:
~/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/json-1.8.3
```




-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>