Commit graph

14675 commits

Author SHA1 Message Date
Edouard CHIN
7a10ce8c95
[rubygems/rubygems] Diagnose the RubyGems connection
bf63859e1e
2025-04-22 11:27:23 +09:00
Edouard CHIN
cba7408017
[rubygems/rubygems] Diagnose the bundler connection
0aae094c89
2025-04-22 11:27:23 +09:00
Edouard CHIN
ae308ae523
[rubygems/rubygems] Diagnose when OpenSSL can't be loaded.
e6aa8aabcd
2025-04-22 11:27:23 +09:00
Edouard CHIN
cda29294a9
[rubygems/rubygems] Add the bundle doctor subcommand skeleton:
- The command can either be run using:

  1. `bundle doctor --ssl`
  2. `bundle doctor ssl`

  The later is most useful when you need to specify
  custom ssl options (such as the verify mode or the
  TLS version when running the diagnostic).

  The implementation will follow in the next commits.

993d12874c
2025-04-22 11:27:23 +09:00
Edouard CHIN
c2e58a9043
[rubygems/rubygems] Define bundler doctor as a subcommand
- See explanation in previous commit 170890befb

8f1b5a4479
2025-04-22 11:27:23 +09:00
Edouard CHIN
89d1af9af3
Move the doctor command into a subfolder:
- Adding a new `ssl` option to bundle doctor will make the `Doctor`
  command quite bloated. The "diagnose ssl" option will also have
  children option to allow passing which host or which tls version
  you want to diagnose and I feel these options don't belong in the
  doctor command.
  So my intention in this commit is to prepare to have a new `Doctor`
  subcommand and allow for better organisation of the code:

  The command will be:

  `bundle doctor` -> Run exactly the same as before.
  `bundle doctor --ssl` -> Run the doctor command and diagnose SSL
  with default options (rubygems.org as the host and verify peer as
  the verify mode)
  `bundle doctor ssl --host github.com` -> Run the ssl subcommand and
  pass a specific host.

  This commit just renames a file in order to avoid big diff chunks.
2025-04-22 11:27:23 +09:00
Mari Imaizumi
63b07cdcbb [Feature #20724] Bump Unicode version to 16.0.0 2025-04-18 19:50:23 +09:00
Martin Dürst
900ece77b2 prepare Unicode normalization for Unicode 16.0.0 2025-04-18 16:07:17 +09:00
David Rodríguez
b8b4c15695 [rubygems/rubygems] Let bundle lock --normalize-platforms remove invalid platforms
c39d2f84fd
2025-04-15 16:47:22 +09:00
David Rodríguez
1929e73a36 [rubygems/rubygems] Raise an error if bundle lock target platform is incompatible
282e4a8593
2025-04-15 16:47:21 +09:00
David Rodríguez
1b18810ed9 [rubygems/rubygems] Rename resolution_packages to resolution_base
It handles resolution packages but also other stuff.

4baec92c20
2025-04-15 16:47:21 +09:00
David Rodríguez
c910e85b02 [rubygems/rubygems] Extract some logic to a method and expand comment
ed31e888fd
2025-04-15 16:47:19 +09:00
David Rodríguez
0ad7cf17a0 [rubygems/rubygems] Clarify comment
42534e746b
2025-04-15 16:47:19 +09:00
David Rodríguez
806fbb1e47 [rubygems/rubygems] Comparing platforms is only needed for dependency validation
If we materialized to a different platform, then the dependencies may
actually be different so the validation does not really make sense.

68fad98e6f
2025-04-15 16:47:18 +09:00
David Rodríguez
3cb573ee55 [rubygems/rubygems] Only platforms are relevant here
4b6f07f634
2025-04-15 16:47:17 +09:00
David Rodríguez
00389b664b [rubygems/rubygems] Fix false positive warning about insecurely materialized gem
In frozen mode, the previous logic would not set the platform locked
originally in the materialized specification, and that would trigger the
warning about insecure materialization incorrectly.

a18001e10c
2025-04-15 16:47:16 +09:00
David Rodríguez
38024772ca [rubygems/rubygems] Refine bundle update --verbose logs
Don't mention "Found changes from the lockfile" because that's not
really true in general.

0181c278e8
2025-04-14 16:17:50 +09:00
David Rodríguez
ce2640dde8 [rubygems/rubygems] Fix edge case making bundle update behave incorrectly
If both a native and a generic version are locked, but the native
version is incompatible with the running Ruby, Bundler will still keep
the native version in the lockfile, since it could be potentially useful
when using other rubies.

However, when `bundle update` is run, this was not the case because the
locked native gems were not using the right source when materializing.
They were using the lockfile source instead of the Gemfile source, and
that meant they could not be found when materializing, because the
lockfile source always uses local mode so does not see them.

The effect of this was normally that they were incorrectly removed from
the lockfile and a strange "this spec has been possibly yanked" was
printed in verbose mode. However, in certain situations (i.e., when the
generic gem would bring extra dependencies), it could also make `bundle
update` crash.

The solution is, when adding this extra locked specs to the result after
resolving, maybe sure they inherit the source from the resolved specs,
so they can be found when materializing.

`bundle install` did not have the issue because it passes locked specs
to the resolver, and assigns the right source to them in
`Definition#converge_locked_specs`.

91ce881fda
2025-04-14 16:17:50 +09:00
David Rodríguez
66aa713980 [rubygems/rubygems] Materialize specs just once in installer
`Definition#specs` does the same thing but memoizes the result.

b62bf9fe41
2025-04-14 16:17:49 +09:00
David Rodríguez
c4a2f72b1b [rubygems/rubygems] Fix bundle lock --normalize-platforms regression
458fa5dc4c
2025-04-14 16:17:48 +09:00
Nobuyoshi Nakada
8c9cd65d82
Fix unnecessary false in CLEANLIBS 2025-04-13 16:53:18 +09:00
viralpraxis
543dd77cc3 [ruby/prism] Fix parsing rescued exception via indexed assignment
Given this code

```ruby
begin
  raise '42'
rescue => A[]
end
```

Prism fails with this backtrace

```
Error: test_unparser/corpus/literal/rescue.txt(Prism::ParserTest): NoMethodError: undefined method `arguments' for nil
prism/lib/prism/translation/parser/compiler.rb:1055:in `visit_index_target_node'
prism/lib/prism/node.rb:9636:in `accept'
prism/lib/prism/compiler.rb:30:in `visit'
prism/lib/prism/translation/parser/compiler.rb:218:in `visit_begin_node'
```

Seems like

```diff
-            visit_all(node.arguments.arguments),
+            visit_all(node.arguments&.arguments || []),
```

fixes the problem.

76d01aeb6c
2025-04-12 17:43:57 +00:00
HoneyryderChuck
e3dd766e99 [ruby/resolv] refactoring class-hash to be ractor-safe
mutable constants can't be shared across ractors; this changes that design to define the required variables as constants on the Resource class, which makes them reachable using ractors; the ClassHash is kept in order not to break integrations relying on its existence, but under the hood it's doing the same thing

639c01dc7f
2025-04-10 15:58:04 +00:00
HoneyryderChuck
54a85caed4 [ruby/resolv] config read from file should return frozen data!
afb57f40a1
2025-04-10 15:58:03 +00:00
Hiroshi SHIBATA
b47a04eb91 Refactor bundled condition 2025-04-10 17:29:39 +09:00
Hiroshi SHIBATA
598b0e8b72 The current force_activate always fails without Gemfile 2025-04-10 17:29:39 +09:00
David Rodríguez
f8c0225971 [rubygems/rubygems] Improve bug report instructions
* Explicitly recommend copying full command output and not just the bug
  report template part.
* Include quadruple quotes in the "What actually happened section" and
  tell users to copy full command output inside. Hopefully quadruple
  quotes will make the error report information (which includes triple
  quotes itself) render fine by default.
* Avoid "actually" as per quality_spec.rb recommendation.

0a3bf2edb1
2025-04-04 08:54:47 +09:00
Earlopain
334c261cc9 [ruby/prism] Fix parser translator when splatting in pattern matching pin
Because it ends up treating it as a local variable, and `a.x`
is not a valid local variable name.

I'm not big on pattern matching, but conceptually it makes sense to me
to treat anything inside ^() to not be
pattern matching syntax?

80dbd85c45
2025-04-02 20:51:54 +00:00
Hiroshi SHIBATA
938db05361 Removed the warning targets for Ruby 3.1 because 3.1 is already EOL 2025-04-02 10:52:26 +09:00
David Rodríguez
79f3167e0b [rubygems/rubygems] Let compact index response parser consistently return a mutable dependencies array
That restores support for compact index dummy implementations that only lists
versions, without checksums or dependencies.

This format is undocumented, so we may want to get rid of it in the
future. However, some of our tests rely on it, and some implementations
did use it (gems.mutant.dev at least). And the way the code was written
suggest that support was intentional.

So for now, we should restore it.

0427d8c983
2025-04-01 09:57:40 +09:00
David Rodríguez
92422576c6
Remove compact index response parser from Bundler
It's available in RubyGems since 3.2.3 and we no longer support that old
version.
2025-04-01 09:56:56 +09:00
Giacomo Benedetti
fce2c386a5 [rubygems/rubygems] Sorting files in metadata for reproducibility
792117980b
2025-04-01 09:55:19 +09:00
David Rodríguez
dea505dea0
[rubygems/rubygems] Allow ruby platform to be remove also when dependencies have changed
Since we will now add it back if the final resolution is compatible, we
can also get this kind of edge case (`bundle add`) working.

cdc5ebec77
2025-03-31 09:39:22 +09:00
David Rodríguez
b2bcd36044
[rubygems/rubygems] Remove edge cases for not removing invalid platforms
Instead, remove them anytime we find dependencies don't match the
lockfile for a platform, and then add them back after resolution if
they ended up being valid.

220bd77887
2025-03-31 09:39:22 +09:00
David Rodríguez
f72d5effb7
[rubygems/rubygems] SpecSet#add_extra_platforms! doesn't need to return anything
9fd92ade54
2025-03-31 09:39:22 +09:00
David Rodríguez
91df1795c5
[rubygems/rubygems] Split finding and removing invalid platforms
I don't like traversing the array and modifying it at the same time
while it seems to work.

6551c74c27
2025-03-31 09:39:22 +09:00
Earlopain
d7e46543b5 [ruby/prism] Fix parser translator when pinning hash with string keys
`StringNode` and `SymbolNode` don't have the same shape
(`content` vs `value`) and that wasn't handled.

I believe the logic for the common case can be reused.
I simply left the special handling for implicit nodes in pattern matching
and fall through otherwise.

NOTE: patterns.txt is not actually tested at the moment,
because it contains syntax that `parser` mistakenly rejects.
But I checked manually that this doesn't introduce other failures.
https://github.com/whitequark/parser/pull/1060

55adfaa895
2025-03-30 17:24:05 +00:00
Kevin Newton
052794bfe1 [ruby/prism] Accept a newline after the defined? keyword
[Bug #21197]

22be955ce9
2025-03-30 13:22:41 -04:00
Hiroshi SHIBATA
df08cc629e
[rubygems/rubygems] Bump up connection_pool-2.5.0 with rake vendor:install
33c3caa63f
2025-03-27 16:57:10 +09:00
Hiroshi SHIBATA
62a026a425
[rubygems/rubygems] Fix Style/RedundantParentheses by bin/rubocop -a
4bbf02493e
2025-03-27 16:57:10 +09:00
Hiroshi SHIBATA
c9e07da51d
[rubygems/rubygems] Resolved Lint/ShadowingOuterLocalVariable warning
01a14a7073
2025-03-27 16:57:10 +09:00
Hartley McGuire
752a1d7854 [rubygems/rubygems] Implement pub_grub strategy interface
My application spends more than 30% of time during `bundle update`
comparing versions due to versions being sorted inside
next_package_to_try. This has been addressed in pub_grub by defining a
strategy interface (a `#next_package_and_version` method) which allows
consumers to have finer control over the heuristic to select the next
package to try.

This commit implements the new strategy interface to remove extraneous
version sorting (previously in next_package_to_try) since only the final
count of versions is used.

Combined with a previous change to pub_grub (already applied to
Bundler), this commit results in `bundle update` taking only half the
time it did on 2.6.5.

62f69e27f0
2025-03-27 13:57:26 +09:00
Ellen Marie Dash
af594f5166 [rubygems/rubygems] Have "gem exec" sort executable names in error message.
This decouples `gem exec` behavior (and tests) from the sort order of
the gemspec.

911cd29159
2025-03-27 13:57:25 +09:00
David Rodríguez
1427629a5f [rubygems/rubygems] Remove specs with bad sources when converging dependencies
a0f7851451
2025-03-25 10:36:33 +09:00
David Rodríguez
fd43aca13b [rubygems/rubygems] Tweak to check specs size just once
4497555023
2025-03-25 10:36:33 +09:00
David Rodríguez
55930987e1 [rubygems/rubygems] Raise an error in frozen mode if CHECKSUMS entries are missing
054a0cd76c
2025-03-24 13:25:07 +09:00
David Rodríguez
131559f671 [rubygems/rubygems] Rename block variable
It's a dependency, not a specification.

9d78f5aa14
2025-03-24 13:25:07 +09:00
David Rodríguez
9c1be12f99 [rubygems/rubygems] Add Specification#lock_name and use that when dealing with checksums
8e2c5748d9
2025-03-24 13:25:07 +09:00
David Rodríguez
5bff692346 [rubygems/rubygems] Refactor replacing locked specification path sources
Instead of doing an explicit pass, let sources be replaced while checking
if specifications are up to date.

676271e804
2025-03-24 13:25:07 +09:00
David Rodríguez
28943c2820 [rubygems/rubygems] Refactor replacement of locked path sources
Instead of doing an explicit pass to preserve the source from the
Gemfile when it's a `Source::Gemspec`, add a special case to our generic
source replacement method.

20c8c42380
2025-03-24 13:25:07 +09:00