Commit graph

3217 commits

Author SHA1 Message Date
Hiroshi SHIBATA
3a2415cc47 Skip failing example on Ubuntu runner of ruby/ruby
4091045314
2025-04-22 15:34:56 +09:00
Edouard CHIN
56c1a15eb7
[rubygems/rubygems] Warn if TLS 1.2 is not supported
e4f70a3e4f
2025-04-22 11:27:24 +09:00
Edouard CHIN
ff2e0e4173
[rubygems/rubygems] Summarize the diagnostic
40cf54d256
2025-04-22 11:27:24 +09:00
Edouard CHIN
19477ef287
[rubygems/rubygems] Diagnose the bare net/http connection
38a0bdc123
2025-04-22 11:27:23 +09:00
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
Mari Imaizumi
ccc7493308 U+036F is now alnum
0363..036F    ; Alphabetic # Mn  [13] COMBINING LATIN SMALL LETTER A..COMBINING LATIN SMALL LETTER X
2025-04-18 19:50:23 +09:00
Mari Imaizumi
63b07cdcbb [Feature #20724] Bump Unicode version to 16.0.0 2025-04-18 19:50:23 +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
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
Samuel Williams
4e970c5d5a Expose ruby_thread_has_gvl_p. 2025-04-14 18:28:09 +09:00
Samuel Williams
22667fcc38 Add RUBY_VERSION_IS_3_5. 2025-04-14 18:28:09 +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
c4a2f72b1b [rubygems/rubygems] Fix bundle lock --normalize-platforms regression
458fa5dc4c
2025-04-14 16:17:48 +09:00
David Rodríguez
756479324f Sync Bundler and adapt to new spec setup 2025-04-10 19:21:51 +09:00
Xavier Noria
08ce6268ee Document order of execution const_added vs inherited 2025-04-10 10:33:36 +02:00
Hiroshi SHIBATA
b47a04eb91 Refactor bundled condition 2025-04-10 17:29:39 +09:00
Hiroshi SHIBATA
3390b6a515 Added simple failing example 2025-04-10 17:29:39 +09:00
Xavier Noria
c5c0bb5afc Restore the original order of const_added and inherited callbacks
Originally, if a class was defined with the class keyword, the cref had a
const_added callback, and the superclass an inherited callback, const_added was
called first, and inherited second.

This was discussed in

    https://bugs.ruby-lang.org/issues/21143

and an attempt at changing this order was made.

While both constant assignment and inheritance have happened before these
callbacks are invoked, it was deemed nice to have the same order as in

    C = Class.new

This was mostly for alignment: In that last use case things happen at different
times and therefore the order of execution is kind of obvious, whereas when the
class keyword is involved, the order is opaque to the user and it is up to the
interpreter.

However, soon in

    https://bugs.ruby-lang.org/issues/21193

Matz decided to play safe and keep the existing order.

This reverts commits:

    de097fbe5f
    de48e47ddf
2025-04-10 10:20:31 +02:00
David Rodríguez
ab4a25e48e [rubygems/rubygems] Follow up to removal of rubyinstaller2 workaround
5b312fd040
2025-04-09 08:11:10 +09:00
David Rodríguez
710bf4a472 [rubygems/rubygems] Rubyinstaller2 fixed this
08b3c48f41
2025-04-04 08:54:47 +09:00
Hiroshi SHIBATA
e71192da69 Removed Solaris conditions from optional and shared directories 2025-04-02 16:24:47 +09:00
Hiroshi SHIBATA
3d4ea45411 Removed Solaris conditions from library directory 2025-04-02 16:24:47 +09:00
Hiroshi SHIBATA
8cb61b00fd Removed Solaris conditions from core directory 2025-04-02 16:24:47 +09:00
David Rodríguez
cd1952484c [rubygems/rubygems] Stay away from FileUtils.rm_rf in Bundler specs
Instead, skip the spec when run by ruby-core. Maybe the root cause can
be fixed at some point.

09594ae5b8
2025-04-01 13:31:48 +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
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
Hiroshi SHIBATA
2ba37d24e8 spec/mspec/tool/wrap_with_guard.rb 'ruby_version_is ...3.5' spec/ruby/security/cve_2020_10663_spec.rb 2025-03-28 12:44:53 +09:00
Jeremy Evans
67d1dd2ebd Avoid array allocation for *nil, by not calling nil.to_a
The following method call:

```ruby
a(*nil)
```

A method call such as `a(*nil)` previously allocated an array, because
it calls `nil.to_a`, but I have determined this array allocation is
unnecessary.  The instructions in this case are:

```
0000 putself                                                          (   1)[Li]
0001 putnil
0002 splatarray                             false
0004 opt_send_without_block                 <calldata!mid:a, argc:1, ARGS_SPLAT|FCALL>
0006 leave
```

The method call uses `ARGS_SPLAT` without `ARGS_SPLAT_MUT`, so the
returned array doesn't need to be mutable.  I believe all cases where
`splatarray false` are used allow the returned object to be frozen,
since the `false` means to not duplicate the array.  The optimization
in this case is to have `splatarray false` push a shared empty frozen
array, instead of calling `nil.to_a` to return a newly allocated array.

There is a slightly backwards incompatibility with this optimization,
in that `nil.to_a` is not called.  However, I believe the new behavior
of `*nil` not calling `nil.to_a` is more consistent with how `**nil`
does not call `nil.to_hash`.  Also, so much Ruby code would break if
`nil.to_a` returned something different from the empty hash, that it's
difficult to imagine anyone actually doing that in real code, though
we have a few tests/specs for that.

I think it would be bad for consistency if `*nil` called `nil.to_a`
in some cases and not others, so this changes other cases to not
call `nil.to_a`:

For `[*nil]`, this uses `splatarray true`, which now allocates a
new array for a `nil` argument without calling `nil.to_a`.

For `[1, *nil]`, this uses `concattoarray`, which now returns
the first array if the second array is `nil`.

This updates the allocation tests to check that the array allocations
are avoided where possible.

Implements [Feature #21047]
2025-03-27 11:17:40 -07:00
Étienne Barrié
6ecfe643b5 Freeze $/ and make it ractor safe
[Feature #21109]

By always freezing when setting the global rb_rs variable, we can ensure
it is not modified and can be accessed from a ractor.

We're also making sure it's an instance of String and does not have any
instance variables.

Of course, if $/ is changed at runtime, it may cause surprising behavior
but doing so is deprecated already anyway.

Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-03-27 17:54:56 +01:00
Andrew Konchin
bac22c985e Update to ruby/spec@5e579e2 2025-03-27 11:09:24 +01:00
Andrew Konchin
53a930f157 Update to ruby/mspec@484310d 2025-03-27 11:09:24 +01:00
Hiroshi SHIBATA
88f0c04174 Use release version of turbo_tests 2025-03-26 19:37:22 +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
Randy Stauner
2eb5690ab6 [rubygems/rubygems] Add test for fixing mismatched versions in lockfile
This test confirms that a bug that existed in 2.6.3
was fixed by b8e55087f0

9e4ca5c5b2
2025-03-25 10:36:32 +09:00
Hiroshi SHIBATA
ef7c7f9e77 Revert "Fix broken CI. (#12963)"
This reverts commit eb91c664dc.
2025-03-24 13:25:07 +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
60d00da083 [rubygems/rubygems] Fix redundant path configurations
The deployment setting already does this implicitly.

402b11fa39
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
58663e8e2c [rubygems/rubygems] Change behavior when gemfile and gemspec dep deps conflict
7026b5f2e5
2025-03-24 13:25:07 +09:00
David Rodríguez
afda30774c [rubygems/rubygems] Reword log message about current platform being missing
It reads better this way I think.

ce9743290d
2025-03-24 13:25:07 +09:00
David Rodríguez
4e1df25b15 [rubygems/rubygems] Improve grammar of some error messages
558a4765c7
2025-03-24 13:25:07 +09:00
David Rodríguez
bb1b5877a7 [rubygems/rubygems] Consistently use "lockfile" over "lock file"
e891be9197
2025-03-24 13:25:07 +09:00
Samuel Williams
eb91c664dc
Fix broken CI. (#12963)
* Increase timeout to fix flaky tests?

* Fix bundler test - wording changed.

expect "fatal: Remote branch deadbeef not found in upstream origin" to
include "Revision deadbeef does not exist in the repository"
2025-03-23 12:49:18 +13:00