Commit graph

3217 commits

Author SHA1 Message Date
David Rodríguez
7c115b8633 [rubygems/rubygems] Fix flaky test failures in mirror probing specs
The mirror probing spec file was moved to our regular suite, which runs
in parallel, recently. These specs rely on starting and stopping actual
servers in localhost, but this does not play nice with parallelization,
because a spec may kill the webserver another spec has created.

This commit moves mirror probing specs to not need to start servers in
localhost and do something more similar to what the other specs do.

ca9a19706f
2025-06-23 11:06:57 +09:00
David Rodríguez
441f18df52
Skip to Bundler 4 directly 2025-06-19 10:23:36 +09:00
David Rodríguez
6d8460e0a0
[rubygems/rubygems] Fix running gem commands in a bundle exec context
They should only load plugins from gems in the bundle.

a229507820
2025-06-19 10:23:36 +09:00
David Rodríguez
f3ea6c35cc
[rubygems/rubygems] Normalize Bundler version spec filters
28b6a7cf5e
2025-06-19 10:23:36 +09:00
David Rodríguez
4245d522b2
[rubygems/rubygems] Allow enabling "Bundler 3 mode" more easily
Currently to test Bundler 3 mode we have to actually edit the version
file to simulate we're running a future version. This is inconvenient.

Instead, allow passing an environment variable, `BUNDLER_3_MODE`, to set
the "working mode" Bundler should use.

This can now be set easily by end users to enable them to try out the
changes in the future version and give us feedback.

It's unclear how version auto-switching should work when this
environment variable is set, so the auto-switching feature will be
disabled in that case.

4e92e9b209
2025-06-19 10:23:36 +09:00
David Rodríguez
af0b184e83
[rubygems/rubygems] Never ignore gems from path sources during activation
The "ignore" attribute is a RubyGems thing to mark when a installed gem
should be ignored for activation because its extensions are not properly
compiled.

In the case of gems from path sources, the warning is not accurate
because extensions are compiled into the local lib path, which is not
where RubyGems leaves its sentinel `gem.build_complete` file.

Also, there's a single version of each gem in the path source available
to Bundler, so we always certainly want to consider that for activation
and never makes sense to ignore it.

ec5d33695e
2025-06-19 10:23:36 +09:00
Yusuke Endoh
10767283dd Exclude internal frames from backtrace
This changeset suppresses backtrace locations like
`<internal:array>:211` as much as possible.

Before the patch:
```
$ ruby -e '[1].fetch_values(42)'
<internal:array>:211:in 'Array#fetch': index 42 outside of array bounds: -1...1 (IndexError)
        from <internal:array>:211:in 'block in Array#fetch_values'
        from <internal:array>:211:in 'Array#map!'
        from <internal:array>:211:in 'Array#fetch_values'
        from -e:1:in '<main>'
```

After the patch:
```
$ ./miniruby -e '[1].fetch_values(42)'
-e:1:in 'Array#fetch_values': index 42 outside of array bounds: -1...1 (IndexError)
        from -e:1:in '<main>'
```

Specifically:

* The special backtrace handling of BUILTIN_ATTR_C_TRACE is now always
  applied to frames with `<internal:...>`.
* When multiple consecutive internal frames appear, all but the bottom
  (caller-side) frame are removed.

[Misc #20968]
2025-06-18 14:51:56 +09:00
David Rodríguez
4e2db1ff58
[rubygems/rubygems] Etc exemption on Windows is no longer necessary
228f59e3ab
2025-06-17 15:09:35 +09:00
David Rodríguez
89ce782fed
[rubygems/rubygems] Reword a couple of specs to further clarify them
e28b5e306f
2025-06-17 15:09:35 +09:00
David Rodríguez
632bf3b54b
[rubygems/rubygems] Migrate mirror probe specs to use the compact index API
Could potentially fix some flakies we're using and make the specs more
"modern" and simplifies them because less fallbacks are involved.

30da9a1a93
2025-06-17 15:09:35 +09:00
David Rodríguez
3319d3d76c
[rubygems/rubygems] Consistently use instance variables directly
I don't think the indirection improve things.

b408b28844
2025-06-17 15:09:35 +09:00
David Rodríguez
459f265b56
[rubygems/rubygems] Cleanup dead code, RubyGems 3.3 is no longer supported
945a29a477
2025-06-17 15:09:34 +09:00
Benoit Daloze
83fb07fb2c [Bug #20998] Check if the string is frozen in rb_str_locktmp() & rb_str_unlocktmp() 2025-06-16 22:59:10 +02:00
Jeremy Evans
f5ada7d1b2 Skip the optional capi digest specs if fiddle is not installed
Should fix a failure on the OpenBSD RubyCI machine.
2025-06-15 12:01:41 +09:00
Hiroshi SHIBATA
64c421db20 [rubygems/rubygems] Surpressing warning for CGI library of Ruby 3.5+
```
❯ bin/rspec ./spec/bundler/friendly_errors_spec.rb
/Users/hsbt/Documents/github.com/rubygems/rubygems/bundler/spec/bundler/friendly_errors_spec.rb:5: warning: CGI library is removed from Ruby 3.5. Please use cgi/escape instead for CGI.escape and CGI.unescape features.
If you need to use the full features of CGI library, Please install cgi gem.
```

a23a951004
2025-06-13 12:55:15 +09:00
David Rodríguez
3a6844a692
Tweak to spec setup so that rspec instead of our bin/rspec binstub still works 2025-06-12 08:45:02 +09:00
Hiroshi SHIBATA
a976fa1bb7 Followed up 002441da1e for ruby/spec 2025-06-11 13:57:08 +09:00
David Rodríguez
ec897fd204 Fix make test-bundler 2025-06-11 09:38:56 +09:00
Randy Stauner
b5beb19825 [rubygems/rubygems] Validate dependencies when doing bundle install
b0983f392f
2025-06-11 08:48:55 +09:00
Nobuyoshi Nakada
20adae4ad6
Fix up birthtime specs
There are two different possible messages: unsupported OS/version, and
unsupported filesystem on a supported system.
2025-06-10 15:05:39 +09:00
Nobuyoshi Nakada
f4135feafc [Feature #21219] Selective inspect of instance variables
Make Kernel#inspect ask which instance variables should be dumped by
the result of `#instance_variables_to_inspect`.

Co-Authored-By: Jean Boussier <byroot@ruby-lang.org>
2025-06-09 09:25:37 +02:00
Nobuyoshi Nakada
2eb0a1a749
Fix birthtime specs on old Linux 2025-06-06 14:16:37 +09:00
David Rodríguez
ca1c46d33c [rubygems/rubygems] Ignore local specifications if they have incorrect dependencies
Currently ruby-dev installs an incorrect gemspec for rdoc, that does not
declare its dependency on psych.

This seems like a ruby-core bug, but it seems best for Bundler to ignore
it, go with the remote specification instead, and print a warning.

227cafd657
2025-06-06 10:22:29 +09:00
Samuel Giddins
c0a1e877b3
Move most of Bundler::GemHelpers to Gem::Platform
This will help centralize wheel platform selection logic eventually

Signed-off-by: Samuel Giddins <segiddins@segiddins.me>
2025-06-06 10:22:18 +09:00
David Rodríguez
6a9af9f0b5
[rubygems/rubygems] Tweak to spec setup so that rspec instead of our bin/rspec binstub still works
24e6699316
2025-06-06 10:09:14 +09:00
David Rodríguez
3ba066e54f
[rubygems/rubygems] Improve more exec specs to avoid swallowing errors
439e9bcf81
2025-06-06 10:09:14 +09:00
David Rodríguez
3b2d068ac2
[rubygems/rubygems] Improve bundle exec with default gems specs
Make them more consistent and not silently pass even if something
regresses. These specs had a typo that made the assertion be that the
`erb --version` output includes the empty string which is always
obviously true.

451e07c305
2025-06-06 10:09:14 +09:00
David Rodríguez
d95f7a3c43
[rubygems/rubygems] Extract stdboth spec helper
bb13f4e702
2025-06-06 10:09:14 +09:00
Thomas Marshall
ee55b82b34
[rubygems/rubygems] Cache commit SHA ref revisions
If the `ref` option is a specific commit SHA, we can check to see if
it's already fetched locally. If it is, then we don't need to re-fetch
it from the remote.

The `ref` option might not be a commit SHA, so we're using the `#commit`
method which returns the full SHA if it's a commit ref, or the locked
revision, or nil.

This is a small improvement that will make `bundle update` slightly
faster in cases for git-sourced gems pinned to a specific commit.

f434c2e66c
2025-06-06 10:09:14 +09:00
Thomas Marshall
6839eadd53
[rubygems/rubygems] Add tests for GitProxy#checkout
This commit adds tests to capture the current behavior of `#checkout`.
They are not exhaustive, but they cover cases cloning and fetching the
repository with different ref types. This will make it easier to change
the caching behavior in a subsequent commit.

f637a412a6
2025-06-06 10:09:14 +09:00
Jeremy Evans
0b07d2a1e3 Deprecate passing arguments to Set#to_set and Enumerable#to_set
Array#to_a, Hash#to_h, Enumerable#to_a, and Enumerable#to_h do not
allow you to specify subclasses.  This has undesired behavior when
passing non-Set subclasses.  All of these are currently allowed, and
none make sense:

```ruby
enum = [1,2,3].to_enum

enum.to_set(Hash)
enum.to_set(Struct.new("A", :a))
enum.to_set(ArgumentError)
enum.to_set(Thread){}
```

Users who want to create instances of a subclass of Set from an
enumerable should pass the enumerable to SetSubclass.new instead of
using to_set.
2025-06-06 01:24:05 +09:00
David Rodríguez
970eac1530 [rubygems/rubygems] Fix git source unlocking for multi-gem repositories like Rails
If you have

```
gem "rails", git: "https://github.com/rails/rails"
```

and then explicitly pin to an older ref, like

```
gem "rails", git: "https://github.com/rails/rails", ref: "99bacb5aa8"
```

Then `bundle install` fails, because locked sources fail to be updated
to use the new source.

This commit fixes the problem by making sure get their source properly
replaced.

5de8c2e0cf
2025-06-05 19:12:46 +09:00
David Rodríguez
e4933e1d93 [rubygems/rubygems] Fix bundle update --bundler when restarts disabled
There's no reason why we should not update bundler as requested, even if
restarts are disabled.

e59acd2a0d
2025-06-05 19:12:45 +09:00
David Rodríguez
5cf07c1e8f [rubygems/rubygems] Look in configured path when checking if self-update version is installed
1ce0882e6f
2025-06-05 19:12:44 +09:00
David Rodríguez
1befc5d102 [rubygems/rubygems] Make update specs independent from version of Bundler
609b21a5fe
2025-06-05 19:12:44 +09:00
David Rodríguez
417210c0ec [rubygems/rubygems] Make self management specs independent from version of Bundler
1257bd161e
2025-06-05 19:12:42 +09:00
David Rodríguez
523f68c6ab [rubygems/rubygems] Compare major version only
6b4cf6713d
2025-06-05 19:12:42 +09:00
David Rodríguez
8b2145dc31 [rubygems/rubygems] Remove dead spec helpers
ee5a0158fd
2025-06-05 19:12:41 +09:00
David Rodríguez
e74008bfc9 [rubygems/rubygems] Reduce duplication a bit
0574c62fc0
2025-06-05 19:12:40 +09:00
Nicholas La Roux
803dae70cb [rubygems/rubygems] Deprecate x64-mingw32 legacy Windows platform in favor of x64-mingw-ucrt
71c969be44
2025-06-05 19:12:37 +09:00
David Rodríguez
21bce66f59 [rubygems/rubygems] Reset variables that can cause specs to fail if set
8df67b7322
2025-06-05 19:12:36 +09:00
Nobuyoshi Nakada
47f55b4b44
Mark as NORETURN 2025-06-04 15:27:45 +09:00
David Rodríguez
6f4eaa100f
Remove hardcoded version of rake from Bundler tests
Let them run against the version resolved by the `test_gems.rb` gemfile.

This should fix ruby-core CI job that was broken by the release of rake
13.3.0.
2025-06-03 08:12:09 +09:00
TangRufus
710f5b7711 [rubygems/rubygems] Follow coding style
bfac93100e
2025-06-03 08:06:50 +09:00
TangRufus
792414678d [rubygems/rubygems] Test bin/ is included in the ignore list
7afe81fd45
2025-06-03 08:06:45 +09:00
TangRufus
204e3c58e1 [rubygems/rubygems] Only ignore .gitignore when generating gems with git
aec5a7887d
2025-06-03 08:06:39 +09:00
TangRufus
9024caa1d6 [rubygems/rubygems] Ignore Gemfile, gems.rb & gems.locked according to init_gems_rb preference
88aeb66f41
2025-06-03 08:06:31 +09:00
TangRufus
582e2c7fe2 [rubygems/rubygems] Extract ignore_paths helper method
d45710ee53
2025-06-03 08:06:21 +09:00
TangRufus
68345e2930 [rubygems/rubygems] Only ignore test/ when generating gems with minitest or test-unit
c464f2036a
2025-06-03 08:05:31 +09:00
TangRufus
2745221ad8 [rubygems/rubygems] Test it does not add any CI config files into ignore list when not generating any CI config
018bb19244
2025-06-03 08:05:24 +09:00