Project

General

Profile

Actions

Bug #12667

closed

full_gem_path is incorrect for core modules

Added by jeffreyc (Jeff C) over 8 years ago. Updated about 5 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]
[ruby-core:76830]

Description

#find_full_gem_path assumes all gems are in gems_dir. It also leverages full_name, which assumes the directory includes the version. 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:

> 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:

% 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
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0