From: "Eregon (Benoit Daloze) via ruby-core" <ruby-core@...>
Date: 2023-10-25T17:57:30+00:00
Subject: [ruby-core:115167] [Ruby master Bug#19972] Install default/bundled gems into dedicated directories

Issue #19972 has been updated by Eregon (Benoit Daloze).


I think this makes sense and would be better/clearer and make it easier if a user wants to remove all user-installed gems.
We should make sure it does not hurt application startup since it might have to look in more places, but probably insignificant since this search is likely only done on gem activation time or so.

Some remarks:
* Default gems have almost no files, e.g. `lib/ruby/gems/3.2.0/gems/fcntl-1.0.2` is empty and `lib/ruby/gems/3.2.0/gems/racc-1.6.2` only has `bin/racc`. But still it definitely feels better to separate those. BTW `gem install`'ing the same version tend to cause troubles, probably RubyGems should reject that and just use the default gem if same version. Also this might remove the need for `specifications/default` which is a bit odd.
* Bundled gems are supposed to be "just like another gem, they just happen to be shipped with Ruby without needing gem install". Maybe those make sense to keep together with user gems? Although from the POV that they are sort of "stdlib"/"standard gems" it makes sense to separate them.

----------------------------------------
Bug #19972: Install default/bundled gems into dedicated directories
https://bugs.ruby-lang.org/issues/19972#change-105077

* Author: vo.x (Vit Ondruch)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.3.0dev (2023-10-24 master c44d65427e) [x86_64-linux]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
I think that the current situation, where the same directory (lets call it `Gem.default_dir`) is used for default/bundled gems as well as for user installed gems, is suboptimal. During the times, this has caused us quite some issue on Fedora. Historically, we redefined the `Gem.default_dir` to user home directory, to avoid the mixing of system gems and user installed gems. Unfortunately, with advent of default/bundled gems, we were facing issues that these gems were suddenly not listed, etc. I am realizing this issue in full once again since the "user install" RubyGems feature has landed [1]. I also think that we have arrived to this situation by evolution, not by design.

Therefore my proposal is:

Keep the `Gem.default_dir` for user `gem install`ed gems and lets install default and bundled gems into separate dedicated directories. Have separate `Gem.bundled_gems_dir` and `Gem.default_gems_dir` structures.

Of course, if `Gem.default_dir == Gem.bundled_gems_dir == Gem.default_gems_dir`, we still can have the current layout.

I have a simple POC here:

https://github.com/ruby/ruby/pull/8761

BTW I have reported it here, because I think that RubyGems provides all it is needed. So it is not RubyGems ticket after all. However, I believe that RubyGems could benefit from this long term and some simplifications/cleanups would be possible.

[1]: https://github.com/rubygems/rubygems/pull/5327



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/