| Age | Commit message (Collapse) | Author |
|
- Fix https://github.com/ruby/rubygems/issues/9238
- ### Problem
This is an issue that bites gem maintainers from time to time, with
the most recent one in https://github.com/minitest/minitest/issues/1040#issuecomment-3679370619
The issue is summarized as follow:
1) A gem "X" has a feature in "lib/feature.rb"
2) Maintainer wants to extract this feature into its own gem "Y"
3) Maintainer cut a release of X without that new feature.
4) Users install the new version of X and also install the new
gem "Y" since the feature is now extracted.
5) When a call to "require 'feature'" is encountered, RG will
fail to load the right gem, resulting in a `LoadError`.
### Details
Now that we have two gems (old version of X and new gem Y) with
the same path, RubyGems will detect that `feature.rb` can be loaded
from the old version of X, but if the new version of X had already
been loaded, then RubyGems will raise due to versions conflicting.
```ruby
require 'x' # Loads the new version of X without the feature which was extracted.
require 'feature' # Rubygems see that the old version of X include that file and tries to activate the spec.
```
### Solution
I propose that RubyGems fallback to a spec that's not yet loaded.
We try to find a spec by its path and filter it out in case a spec
with the same name has already been loaded.
Its worth to note that RubyGems already has a
`find_inactive_by_path` but we can't use it. This method only checks
if the spec object is active and doesn't look if other spec with the
same name have been loaded. The new method we are introducing
verifies this.
https://github.com/ruby/rubygems/commit/f298e2c68e
|
|
https://github.com/rubygems/rubygems/commit/2af077ee38
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/10924
|
|
This could happen when a regular gem shadows a default gem.
https://github.com/rubygems/rubygems/commit/9ef70dd1f7
|
|
benchmark.rb may extract as bundled gems in the future release
Notes:
Merged: https://github.com/ruby/ruby/pull/11490
|
|
https://github.com/rubygems/rubygems/commit/8dbe1dbdc7
Co-authored-by: MSP-Greg <Greg.mpls@gmail.com>
|
|
CI broke in https://github.com/ruby/ruby/pull/9604 because if any Ruby
tests run `require 'net/http'`, they will pollute the
`$LOADED_FEATURES` for the RubyGems tests. We can fix this by renaming
the test default gem from `net-http` to `my-http`.
See https://github.com/rubygems/rubygems/pull/7379#issuecomment-1901241299
for more details.
|
|
requiring a gem"
This reverts commit 04cf66765a8a9d48baea6d9aee266dc9aa21df27.
|
|
gems depend on it"
This reverts commit 54552b89e73fc616ba47c1c87d33625af99cbce9.
|
|
gems depend on it"
This reverts commit f1f5f22d22a149f20e019728b1ab35593d29d81a.
|
|
requiring a gem"
This reverts commit db44088c2a92040879386aa5f268db4c858e4e5b.
https://github.com/ruby/ruby/actions/runs/7578672002/job/20641640821
https://github.com/ruby/ruby/actions/runs/7578672002/job/20641641212
https://github.com/ruby/ruby/actions/runs/7578672002/job/20641642031
|
|
If a gem is required circular, and there are unresolved specs depending
on it, we may end up in an activation conflict.
The solution is to not try to activate unresolved gems when requiring a
default gem, regardless of it having already been activated or not.
https://github.com/rubygems/rubygems/commit/3b2b8f4e3e
|
|
depend on it
The following conditions must be met:
* A default gem is required.
* A previous require left some gems unresolved, and those dependencies
themselves depend on the default gem.
In this case, rubygems require will first activate the default version
of the gem, then try to activate another unresolved version of the
default gem that conflicts with the first activation.
The solution is, if we are in the middle of requiring a default gem,
skip this step, because we have already activated it successfully.
https://github.com/rubygems/rubygems/commit/8cd5608db5
Co-authored-by: Stan Hu <stanhu@gmail.com>
|
|
https://github.com/rubygems/rubygems/commit/b8ca5950a6
|
|
Original output:
~~~
Failure: test_realworld_upgraded_default_gem(TestGemRequire): <false> is not true.
/mnt/test/rubygems/test_require.rb:474:in `test_realworld_upgraded_default_gem'
471: File.write(path, code)
472:
473: output = Gem::Util.popen({ "GEM_HOME" => @gemhome }, *ruby_with_rubygems_in_load_path, path).strip
=> 474: assert $?.success?
475: refute_empty output
476: assert_equal "999.99.9", output.lines[0].chomp
477: # Make sure only files from the newer json gem are loaded, and no files from the default json gem
~~~
New output:
~~~
Failure: test_realworld_upgraded_default_gem(TestGemRequire)
/mnt/test/rubygems/test_require.rb:475:in `test_realworld_upgraded_default_gem'
472:
473: output = Gem::Util.popen({ "GEM_HOME" => @gemhome }, *ruby_with_rubygems_in_load_path, path).strip
474: refute_empty output
=> 475: assert_equal "999.99.9", output.lines[0].chomp
476: # Make sure only files from the newer json gem are loaded, and no files from the default json gem
477: assert_equal ["#{@gemhome}/gems/json-999.99.9/lib/json.rb"], output.lines.grep(%r{/gems/json-}).map(&:chomp)
478: assert $?.success?
<"999.99.9"> expected but was
<"/mnt/tmp/test_rubygems_20231110-36663-of405r/test_realworld_upgraded_default_gem.rb:3:in `<main>': undefined method `version' for nil:NilClass (NoMethodError)">
diff:
? 999 .99.9
? /mnt/tmp/test_rubygems_20231110-36663-of405r/test_realworld_upgraded_default_gem rb:3:in `<main>': undefined method `version' for nil:NilClass (NoMethodError)
? ??? ????
~~~
It is more valuable to check the command output then the error code. If
the command fails for some reason, the output probably contains some
detail, while checking the return code tells not much.
https://github.com/rubygems/rubygems/commit/b76062e852
|
|
https://github.com/rubygems/rubygems/commit/7f27ab32b8
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7582
|
|
https://github.com/rubygems/rubygems/commit/b595d3cf0f
|
|
https://github.com/rubygems/rubygems/commit/fa2e835ed2
|
|
https://github.com/rubygems/rubygems/commit/add44e56eb
|
|
https://github.com/rubygems/rubygems/commit/a875fdb535
|
|
https://github.com/rubygems/rubygems/commit/fba6e94de9
|
|
https://github.com/rubygems/rubygems/commit/d8efd919db
|
|
The output from the command is mixed in this test, even when
successful.
Use the output as a part of the message on failure instead.
https://github.com/rubygems/rubygems/commit/960509a133
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6987
|
|
The installed file not always have the `.so` extension.
https://github.com/rubygems/rubygems/commit/6f6681bcb9
Co-authored-by: Eloy Espinaco <eloyesp@gmail.com>
Notes:
Merged: https://github.com/ruby/ruby/pull/6966
|
|
Some tests check that the shared objects are actually installed, but
checking an intermediate build file instead of the installed one.
https://github.com/rubygems/rubygems/commit/ad526073b0
Notes:
Merged: https://github.com/ruby/ruby/pull/6966
|
|
from https://github.com/rubygems/rubygems/commit/bfb0ae69776069155d2092702bfbb5a12617d85a
Notes:
Merged: https://github.com/ruby/ruby/pull/6906
|
|
`Gem::Specification#load_paths` is actually a Bundler thing.
https://github.com/rubygems/rubygems/commit/d20b4d1950
|
|
Pick from https://github.com/rubygems/rubygems/commit/dfbb5a38114640e0d8d616861607f3de73ee0199
Notes:
Merged: https://github.com/ruby/ruby/pull/6224
|
|
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6054
|
|
https://github.com/rubygems/rubygems/commit/125415593ead9ab69a9f0bb5392c9d7ec61b1f51
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/5669
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/5669
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/5325
|
|
https://github.com/rubygems/rubygems/commit/c6ef75424d
|
|
https://github.com/rubygems/rubygems/commit/b0bbb27115
|
|
https://github.com/rubygems/rubygems/commit/9815a04e31
|
|
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4533
|
|
"test_" prefix
This changes "test/rubygems/test_case.rb" to "test/rubygems/helper.rb",
and "test/rubygems/test_utilities.rb" to "test/rubygems/utilities.rb".
The two files are a helper for tests, not test files. However, a file
starting with "test_" prefix is handled as a test file directly loaded
by test-unit because Rakefile specifies:
```
t.test_files = FileList['test/**/test_*.rb']
```
Directly loading test/rubygems/test_utilities.rb caused "uninitialized
constant Gem::TestCase". This issue was fixed by
59c682097197fee4052b47e4b4ab86562f3eaa9b, but the fix caused a
"circular require" warning because test_utilities.rb and test_case.rb
are now requiring each other.
Anyway, adding "test_" prefix to a test helper file is confusing, so
this changeset reverts the fix and solve the issue by renaming them.
https://github.com/rubygems/rubygems/commit/6460e018df
|
|
|
|
https://github.com/rubygems/rubygems/commit/c77868a555
|
|
https://github.com/rubygems/rubygems/commit/769e87f011
Notes:
Merged: https://github.com/ruby/ruby/pull/4491
|
|
of assert_path_exists and refute_path_exists
https://github.com/rubygems/rubygems/commit/a7c93558c3
Notes:
Merged: https://github.com/ruby/ruby/pull/4491
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/3864
|
|
31a6eaabc165d8a222e176f2c809d90622d88ec2 is obsoleted with
https://github.com/rubygems/rubygems/pull/3820
|
|
Enable Style/EmptyLinesAroundClassBody rubocop cop.
|
|
To normalize the code style with `bundler`.
Notes:
Merged: https://github.com/ruby/ruby/pull/3379
|