`Gem::Installer#install` should not modify `spec.loaded_from`
Open
Nobody has claimed this yet.
type: feature request
- Dominant language
- Ruby
- Stars
- 4k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 81
Description
Calling Gem::Installer#install, changes state of the embedded Gem::Specification object [1]:
spec = Gem::Specification.new
spec.name = 'test'
spec.version = '1'
spec.loaded_from = '/some/path'
installer = Gem::Installer.for_spec spec, :install_dir => '/builddir/build/BUILDROOT/ruby-2.7.0-0.1.git4a403e3f98.fc32.x86_64/usr/share/ruby/gems/gems/test'
installer.install
puts spec.loaded_from
# /builddir/build/BUILDROOT/ruby-2.7.0-0.1.git4a403e3f98.fc32.x86_64/usr/share/ruby/gems/gems/test/specifications/test-1.gemspec
Although I understand the #install method does this for ages, I don't think this is acceptable behavior. The state of spec object should not be modified in this non-transparent way.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at lib/rubygems/installer.rb around the linked blame location and reproduce the issue with the Gem::Specification example from the report. Trace where Gem::Installer#install assigns loaded_from; done means installation no longer changes the embedded specification's loaded_from value, with regression coverage for that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100