Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give a better look at RubyGems handling the gem directories #7089

Open
voxik opened this issue Oct 22, 2023 · 3 comments
Open

Give a better look at RubyGems handling the gem directories #7089

voxik opened this issue Oct 22, 2023 · 3 comments
Labels

Comments

@voxik
Copy link
Contributor

voxik commented Oct 22, 2023

Looking into #5327 and similar, I believe that RubyGems would deserve second look at where the gems are installed.

First and foremost, RubyGems were historically designed to well support multiple install locations. There essentially were just Gem.default_path and Gem.default_dir. The first was list of all paths where gems were stored and the Gem.default_dir was the location, where the gems were installed by default. Please note that these were times, where RubyGems were 3rd partly library and there were no gems shipped as part of Ruby.

Later, RubyGems became part of StdLib and first gems started to be part of Ruby. Unfortunately, the Gem.default_dir meaning somehow drifted at this time. While it still was the default installation location, it also become the location of gems which are part of StdLib.

And this is very unfortunate situation. In older days, without bundled and default gems, Fedora was using this operating_system.rb to configure where to install system wide available gems. Unfortunately, with the evolution as I described above and introduction of bundled/default gems, changing Gem.default_dir configuration also meant that there were suddenly missing the default/bundled gems. So Fedora adapted and this is the current version of operating_system.rb. It uses standard command line options, but these unfortunately has different side effects.

Now back to the context of #5327, can we make sure that:

  1. All gem directories are treated the same. Currently, there is essentially single location and using any other location has their issues (this resulted in hackish implementation of default gems, where they could have been just different location).
  2. Don't treat user home installed gems any special.
  3. Let the vendor configure what is their default location easily.

Maybe the first good step could be to free the StdLib gems from the Gem.default_dir and give the Gem.default_dir the old meaning, which was just the default install location. Nothing more nothing less.

@voxik voxik added the RubyGems label Oct 22, 2023
@eregon
Copy link
Contributor

eregon commented Oct 25, 2023

Linking to https://bugs.ruby-lang.org/issues/19972 since it seems highly related.

I replied there, agreed it would be best to store default & bundled gems separate from user-installed gems.

  1. Don't treat user home installed gems any special.

👍 I think this would remove a bunch of bugs because user-install is treated quite specially right now IIRC.

@voxik
Copy link
Contributor Author

voxik commented Oct 25, 2023

Linking to https://bugs.ruby-lang.org/issues/19972 since it seems highly related.

I think this ^^ ticket extracts my last thought (Maybe the first good step could be to free the StdLib gems from the Gem.default_dir and give the Gem.default_dir the old meaning, which was just the default install location. Nothing more nothing less.) into separate ticket, which is more relevant for Ruby itself. Thx for providing the link here.

@duckinator
Copy link
Member

duckinator commented Oct 30, 2023

I agree that separating things, especially stdlib gems, from Gem.default_dir makes sense. We should make sure this information is exposed for debugging purposes, though — e.g. as other Gem.???_dir functions and in the output of gem env.

user-install is treated quite specially right now

This actually improved quite a bit recently, because of #7100 (by @voxik). gem install --user-install now just sets --install-dir to Gem.user_dir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants