--install-dir vs --only_install_dir
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 4k
- Forks
- 1.9k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 81
Description
$ gem -v
2.7.6.3
$ ruby -v
ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.6.3
- RUBY VERSION: 2.5.9 (2021-04-05 patchlevel 229) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/share/gems
- USER INSTALLATION DIRECTORY: /builddir/.gem/ruby
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /builddir/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/share/gems
- /builddir/.gem/ruby
- /usr/local/share/gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/sbin
$ gem install nokogiri:1.6.7.1 rake:0.9.6 rack:1.6.13 i18n:0.9.0 activesupport:4.2.7 --no-document --conservative --install-dir=~/g
Fetching: mini_portile2-2.0.0.gem (100%)
Successfully installed mini_portile2-2.0.0
Fetching: nokogiri-1.6.7.1.gem (100%)
Building native extensions. This could take a while...
Successfully installed nokogiri-1.6.7.1
Fetching: rake-0.9.6.gem (100%)
Successfully installed rake-0.9.6
Fetching: rack-1.6.13.gem (100%)
Successfully installed rack-1.6.13
Fetching: concurrent-ruby-1.1.10.gem (100%)
Successfully installed concurrent-ruby-1.1.10
Fetching: i18n-0.9.0.gem (100%)
Successfully installed i18n-0.9.0
Fetching: thread_safe-0.3.6.gem (100%)
Successfully installed thread_safe-0.3.6
Fetching: minitest-5.15.0.gem (100%)
Successfully installed minitest-5.15.0
Fetching: tzinfo-1.2.9.gem (100%)
Successfully installed tzinfo-1.2.9
Fetching: json-1.8.6.gem (100%)
Building native extensions. This could take a while...
Successfully installed json-1.8.6
Fetching: i18n-0.9.5.gem (100%)
Successfully installed i18n-0.9.5
Fetching: activesupport-4.2.7.gem (100%)
Successfully installed activesupport-4.2.7
12 gems installed
In the example above, the i18n is installed twice in different versions. This is due to --install-dir option implying also --only_install_dir in a non-transparent way. I don't think this is correct behavior. The --install-dir documentation only says:
If the installation directory is still the same, its content should be reflected for resolution IMO. However the implementation derives the the --only_install_dir from the presence of --install-dir:
Later submitting this value to the resolver with completely different meaning:
Sorry for testing with outdated version of Ruby/RubyGems, but checking the code, it seems the behavior has not changed.
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 with the referenced logic in lib/rubygems/installer.rb and lib/rubygems/dependency_installer.rb, especially the cited handling of --install-dir and --only_install_dir. Reproduce the gem install command from the report and inspect how the resolver treats the two options. Done means the installation-directory contents are reflected in dependency resolution without the options being conflated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100