Commit graph

336 commits

Author SHA1 Message Date
Hiroshi SHIBATA
19336a6392 [rubygems/rubygems] Removed compatibility.rb that file is for Ruby 1.9.
120c174e7f
2025-08-06 06:23:01 +09:00
David Rodríguez
9f961a4b30 [rubygems/rubygems] Workaround RVM issue when using Bundler <= 2.5.22
Old versions of BUndler need a workaround to support nested `bundle
exec` invocations by overriding `Gem.activate_bin_path`. However,
RubyGems now uses this new `Gem.activate_and_load_bin_path` helper in
binstubs, which is of course not overridden in those Bundler versions
since it didn't exist at the time.

So, include the override here to workaround that.

e5ed95e242
2025-07-22 10:01:28 +09:00
David Rodríguez
d5f98b9e7e
Set development version to Bundler 2.8.0.dev and RubyGems 3.8.0.dev
Next version for both will be 4.0.0, however, extra work is necessary to
get CI passing against the new major. So for now, I'm bumping just the
minor version.
2025-07-17 11:13:16 +09:00
David Rodríguez
7a03a02bee
[rubygems/rubygems] Fix more warnings when running old Bundler with latest RubyGems
Also fix platform warnings when Bundler's entrypoint is bundler's
binstub.

4b1df58403
2025-07-14 11:52:14 +09:00
David Rodríguez
c3d41492e1
[rubygems/rubygems] Avoid more warnings when using RubyGems with old Bundler
We were only avoiding them when the RUBYGEMS_GEMDEPS variable is used.
Avoid the warnings in general, whenever the entrypoint to Bundler is
`require`.

8683faef36
2025-07-14 11:52:14 +09:00
David Rodríguez
a93c684077
[rubygems/rubygems] Change helper to load only Bundler extensions to RubyGems
We'll want to reuse this helper in other situations where we don't want
all Bundler loaded.

9e7018b0a1
2025-07-14 11:52:14 +09:00
David Rodríguez
1c48aa6f4a
[rubygems/rubygems] Move loading Bundler without platform warnings to a method
e068f0649a
2025-07-14 11:52:14 +09:00
Hiroshi SHIBATA
7a5e46cff2
Revert accidentally commit with 96a0c2065a 2025-06-24 12:10:50 +09:00
Jean Boussier
96a0c2065a Mark RClass instance that may be namespaced with RCLASS_NAMESPACEABLE 2025-06-23 10:04:58 +01:00
David Rodríguez
ddb412f680 [rubygems/rubygems] Fix redefinition warnings when using modern RubyGems with old Bundler
ce7e8e92ca
2025-06-16 10:03:36 +09:00
Ellen Marie Dash
6982b80a8b [rubygems/rubygems] Default to a SOURCE_DATE_EPOCH of 315619200, to simplify reproducible builds.
1d5a627398
2025-03-24 13:25:07 +09:00
Ellen Marie Dash
7389ca87b3 [rubygems/rubygems] Print message when blocking on a file lock.
3ca7ef214c
2025-01-14 12:24:37 +09:00
Hiroshi SHIBATA
0c0b739d97 Bump up RubyGems 3.7.0.dev and Bundler 2.7.0.dev 2024-12-26 10:27:24 +09:00
David Rodríguez
9e0eb9778d Merge RubyGems-3.6.2 and Bundler-2.6.2 2024-12-24 07:21:10 +09:00
David Rodríguez
b3abdd4cf4
Bump Rubygems version to 3.6.1 2024-12-18 10:05:21 +09:00
David Rodríguez
047a87bd7a
Bump Rubygems version to 3.6.0 2024-12-17 09:39:03 +09:00
Stan Lo
16b84b72a4 [rubygems/rubygems] Fix broken link to license file
76cb4aad70
2024-12-15 18:46:51 +00:00
David Rodríguez
4addaaf4df [rubygems/rubygems] More aggressive Performance/FlatMap cop configuration
d8d68cc00e
2024-11-26 15:11:05 +09:00
David Rodríguez
f2380081df [rubygems/rubygems] Improve Bundler errors when trying to install to a protected folder in macOS
### Before

```
$ GEM_HOME=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/ bundle
Fetching gem metadata from https://rubygems.org/.
Source rubygems repository https://rubygems.org/ or installed locally is ignoring #<Bundler::StubSpecification name=sqlite3 version=1.3.13 platform=ruby> because it is missing extensions
Source rubygems repository https://rubygems.org/ or installed locally is ignoring #<Bundler::StubSpecification name=nokogiri version=1.13.8 platform=ruby> because it is missing extensions
Source rubygems repository https://rubygems.org/ or installed locally is ignoring #<Bundler::StubSpecification name=libxml-ruby version=3.2.1 platform=ruby> because it is missing extensions
Resolving dependencies...
Fetching ruby2_keywords 0.0.5

Retrying download gem from https://rubygems.org/ due to error (2/4): Bundler::GenericSystemCallError There was an error accessing `/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem`.
The underlying system error is Errno::EPERM: Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem

Retrying download gem from https://rubygems.org/ due to error (3/4): Bundler::GenericSystemCallError There was an error accessing `/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem`.
The underlying system error is Errno::EPERM: Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem

Retrying download gem from https://rubygems.org/ due to error (4/4): Bundler::GenericSystemCallError There was an error accessing `/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem`.
The underlying system error is Errno::EPERM: Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem

Bundler::GenericSystemCallError: There was an error accessing `/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem`.
The underlying system error is Errno::EPERM: Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/cache/ruby2_keywords-0.0.5.gem
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/shared_helpers.rb:119:in `rescue in filesystem_access'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/shared_helpers.rb:104:in `filesystem_access'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/rubygems_integration.rb:431:in `block in download_gem'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/retry.rb:40:in `run'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/retry.rb:30:in `attempt'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/rubygems_integration.rb:423:in `download_gem'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/source/rubygems.rb:479:in `download_gem'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/source/rubygems.rb:436:in `fetch_gem'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/source/rubygems.rb:420:in `fetch_gem_if_possible'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/source/rubygems.rb:162:in `install'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/installer/gem_installer.rb:55:in `install'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/installer/gem_installer.rb:17:in `install_from_spec'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/installer/parallel_installer.rb:133:in `do_install'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/installer/parallel_installer.rb:124:in `block in worker_pool'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/worker.rb:62:in `apply_func'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/worker.rb:57:in `block in process_queue'
  <internal:kernel>:187:in `loop'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/worker.rb:54:in `process_queue'
  /Users/deivid/code/rubygems/rubygems/bundler/lib/bundler/worker.rb:90:in `block (2 levels) in create_threads'

An error occurred while installing ruby2_keywords (0.0.5), and Bundler cannot continue.

In Gemfile:
  ruby2_keywords
```

### After

```
$ GEM_HOME=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/ bundle
There was an error creating `/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/bundler.lock`.
The underlying system error is Errno::EPERM: Operation not permitted @ rb_sysopen - /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/bundler.lock
```

345ec45f5a
2024-10-23 08:53:19 +00:00
David Rodríguez
b39b998a17 [rubygems/rubygems] Remove patches for old TruffleRuby versions
264c61eb8e
2024-10-22 20:32:56 +00:00
David Rodríguez
aad4bfd7bc [rubygems/rubygems] Fix gem install on NFS shares
NFS shares seem to support flock these days, but they need read-write
permissions.

1c492804cd
2024-10-11 09:42:08 +00:00
David Rodríguez
fab01b15e9 [rubygems/rubygems] Remove temporary .lock files left around by gem installer
edbb2e3475
2024-09-16 11:37:58 +00:00
David Rodríguez
7411caa103 [rubygems/rubygems] Make sure implementations of Gem.open_file_with_flock match
174a8e5284
2024-09-16 11:37:58 +00:00
Nobuyoshi Nakada
6dd917bd01 [rubygems/rubygems] Workaround for TruffleRuby
b82e43fd54
2024-09-06 14:46:42 +00:00
Nobuyoshi Nakada
5afee4d795 [rubygems/rubygems] Remove the lock file for binstubs
https://github.com/rubygems/rubygems/pull/7806#issuecomment-2241662488

4f06ee234a
2024-09-06 14:46:42 +00:00
Nobuyoshi Nakada
c1fecc5eab [rubygems/rubygems] Simplify Gem.read_binary and Gem.write_binary
Since `Gem.open_file` no longer locks the target file and is same as
`File.open` now, simply `Gem.read_binary` should read in binary mode.
Also the body of `Gem.write_binary` is same as `File.binwrite`.

44df9045df
2024-09-02 17:28:50 +00:00
Nobuyoshi Nakada
1f00f6a09e [rubygems/rubygems] Avoid another race condition of open mode
Instead, just open in CREATE and APPEND mode.
Also, move the workaround for old Solaris as fallback to retry.

2daad257be
2024-09-02 15:51:10 +00:00
David Rodríguez
d90a930ede [rubygems/rubygems] Properly protect writing binstubs with a file lock
There's an issue when multiple processes try to write the same binstub.
The problem is that our file locking mechanism is incorrect because
files are truncated _before_ they are locked. So it can happen that:

* Process A truncates binstub FOO.
* Process B truncates binstub FOO.
* Process A writes binstub FOO for gem BAR from the beginning of file.
* Process B writes binstub FOO for gem BAZ from the beginning of file.

If binstub FOO for gem BAR is bigger than binstub FOO for gem BAZ, then
some bytes will be left around at the end of the binstub, making it
corrupt.

This was not a problem in our specs until the spec testing binstubs with
the same name coming from different gems changed from using gems named
"fake" and "rack" to using gems named "fake" and "myrack". Because of
the difference in gem name length, the generated binstub for gem
"myrack" is now longer, causing the above problem if binstub for gem
myrack is written first.

The solution is to make sure when using flock to always use modes that
DON'T truncate the file when opening it. So, we use `r+` if the file
exists previously (it requires the file to exist previously), otherwise
we use `a+`.

ce8bcba90f
2024-07-08 14:38:30 +09:00
David Rodríguez
da12d63431 [rubygems/rubygems] Scope rescuing Errno::ENOLCK to just File.open
2a9d347d29
2024-07-08 14:38:29 +09:00
David Rodríguez
7cf7e7e2c0 [rubygems/rubygems] Add missing blank line after method documentation
2df7560ade
2024-07-08 14:38:29 +09:00
David Rodríguez
5c826ebea5 [rubygems/rubygems] Protect binstub access during creation with a flock
88e3f1d23c
2024-06-28 10:49:07 +00:00
David Rodríguez
091a6ea8c1 [rubygems/rubygems] Move flock logic to its own method
91274128a8
2024-06-28 10:49:06 +00:00
David Rodríguez
f41a2c96c3 [rubygems/rubygems] More compact open_file fallback on Windows
8f34396af6
2024-06-28 10:49:06 +00:00
Yuta Saito
273d41b9e3 [rubygems/rubygems] Add --target-rbconfig option to gem install and gem update commands
This patch adds `--target-rbconfig` option to specify the rbconfig.rb file
for the deployment target platform. This is useful when cross-compiling
gems. At the moment, this option is only available for `extconf.rb`-based
extensions.

cf2843f7a2
2024-06-18 00:59:35 +00:00
David Rodriguez
4db76d198b [rubygems/rubygems] Add a FreeBSD platform helper
535c83d5be
2024-05-16 09:20:16 +00:00
Hiroshi SHIBATA
00dc1cace8 Reapply "[rubygems/rubygems] Fix activation conflicts when circularly requiring a gem"
This reverts commit 04cf66765a.
2024-01-22 09:57:10 +09:00
Hiroshi SHIBATA
04cf66765a
Revert "[rubygems/rubygems] Fix activation conflicts when circularly requiring a gem"
This reverts commit db44088c2a.

  2064164082
  2064164121
  2064164203
2024-01-19 11:54:17 +09:00
David Rodríguez
db44088c2a [rubygems/rubygems] Fix activation conflicts when circularly requiring a gem
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.

3b2b8f4e3e
2024-01-19 11:28:11 +09:00
Hiroshi SHIBATA
0e8b1973b4 [rubygems/rubygems] bin/rubocop -A --only Style/RedundantReturn
ade728914f
2024-01-11 13:51:52 +09:00
Hiroshi SHIBATA
1966a61a1e Merge RubyGems-3.6.0.dev and Bundler-2.6.0.dev from master branch 2023-12-25 21:12:49 +09:00
Hiroshi SHIBATA
7d7a84e99f Merge RubyGems-3.5.3 and Bundler-2.5.3 2023-12-23 09:34:26 +09:00
Hiroshi SHIBATA
82496f2b38 Merge RubyGems-3.5.2 and Bundler-2.5.2 2023-12-22 07:24:04 +09:00
Hiroshi SHIBATA
711e85674e
Pin versions that are RubyGems 2.5.1 and Bundler 2.5.1 2023-12-16 10:13:35 +08:00
Benoit Daloze
a94a2eea34 [rubygems/rubygems] Upstream RubyGems changes from TruffleRuby
749a508968
2023-12-08 17:01:23 +00:00
Eric Mueller
b1b78c4f9f [rubygems/rubygems] Introduce the Gem::CIDetector
This is based on the list in Gem::UpdateSuggestion and Bundler::Fetcher;
these have similar purposes (determining whether/what CI we're executing
in), and can benefit from being combined and updated (they're both
slightly out of date).

Noteable changes:
* We'll consider ourselves to be on a CI in more cases - if CI_NAME or
  TASKCLUSTER_ROOT_URL are set specifically, since those represent two
  cases that were either overlooked or are no longer covered by the
  existing implementation. (Or possibly TaskCluster still does provide
  RUN_ID, but failed to document it)
* We will notice/track a few additional services in ci_strings (cirrus,
  dsari, taskcluster), stop tracking 'snap' (they went under in 2017),
  and update buildbox to buildkite (they've been called that for 8
  years, and the BUILDBOX envs have been deprecated for 3).
* We'll also sort/uniq/downcase the values (all of which only matter
  because of the special case of CI_NAME).

60652b942f
2023-12-06 20:05:23 +00:00
David Rodríguez
a4d80eee17 [rubygems/rubygems] Let RuboCop target Ruby 3.0
70243b1d72
2023-11-13 11:06:10 +09:00
David Rodríguez
54511303a4 [rubygems/rubygems] Drop support for Ruby 2.6 and Ruby 2.7 in RubyGems
10c26a483d
2023-11-13 11:06:10 +09:00
Josef Šimánek
25b536cc2f
[rubygems/rubygems] Fix invalid links in documentation. - wrap ENV variables in <code> - fix rubygems.org link - fix zenspider.com link
9eaac94a63
2023-10-03 16:13:18 +09:00
Samuel Giddins
d182d83ce9 [rubygems/rubygems] Add a Marshal.load replacement that walks an AST to safely load permitted classes/symbols
7e4478fe73
2023-09-20 02:02:58 +00:00
Hiroshi SHIBATA
d89cc317c6
util/rubocop -A --only Style/NumericLiteralPrefix 2023-04-11 19:12:28 +09:00