summaryrefslogtreecommitdiff
path: root/lib/rubygems.rb
AgeCommit message (Collapse)Author
2026-04-08Merge RubyGems/Bundler 4.0.10Hiroshi SHIBATA
2026-04-08Merge RubyGems/Bundler 4.0.9Hiroshi SHIBATA
2026-04-08Merge RubyGems/Bundler 4.0.8Hiroshi SHIBATA
2026-04-08Merge RubyGems/Bundler 4.0.7Hiroshi SHIBATA
2026-04-08Merge RubyGems/Bundler 4.0.6Hiroshi SHIBATA
2026-04-03merge revision(s) 8ecf28f9384207590be73d5f2a95859cff9c526a: [Backport #21954]Takashi Kokubun
[ruby/rubygems] Fix NoMethodError in Gem.try_activate when activation conflicts occur
2026-02-09Merge RubyGems/Bundler 4.0.6Hiroshi SHIBATA
2026-02-09Merge RubyGems/Bundler 4.0.5Hiroshi SHIBATA
2026-02-09Merge RubyGems/Bundler 4.0.4Hiroshi SHIBATA
2025-12-23Merge RubyGems 4.0.3 and Bundler 4.0.3Hiroshi SHIBATA
2025-12-17Bundle RubyGems 4.0.2 and Bundler 4.0.2Hiroshi SHIBATA
2025-12-15[ruby/rubygems] Write gem files atomicallyeileencodes
This change updates `write_binary` to use a new class, `AtomicFileWriter.open` to write the gem's files. This implementation is borrowed from Active Support's [`atomic_write`](https://github.com/rails/rails/blob/main/activesupport/lib/active_support/core_ext/file/atomic.rb). Atomic write will write the files to a temporary file and then once created, sets permissions and renames the file. If the file is corrupted - ie on failed download, an error occurs, or for some other reason, the real file will not be created. The changes made here make `verify_gz` obsolete, we don't need to verify it if we have successfully created the file atomically. If it exists, it is not corrupt. If it is corrupt, the file won't exist on disk. While writing tests for this functionality I replaced the `RemoteFetcher` stub with `FakeFetcher` except for where we really do need to overwrite the `RemoteFetcher`. The new test implementation is much clearer on what it's trying to accomplish versus the prior test implementation. https://github.com/ruby/rubygems/commit/0cd4b54291
2025-12-09[ruby/rubygems] Bump Rubygems version to 4.0.1Hiroshi SHIBATA
(cherry picked from commit https://github.com/ruby/rubygems/commit/f3e5ebf5afe7) https://github.com/ruby/rubygems/commit/583b0222ad
2025-12-03[ruby/rubygems] Bump Rubygems version to 4.0.0Hiroshi SHIBATA
https://github.com/ruby/rubygems/commit/9d744beb56
2025-11-26[ruby/rubygems] Bump up to 4.0.0.beta2Hiroshi SHIBATA
https://github.com/ruby/rubygems/commit/b8529f48bf
2025-11-21[ruby/rubygems] create a gem version instead of comparing with a stringAaron Patterson
https://github.com/ruby/rubygems/commit/c1e3d4d63b
2025-11-20[ruby/rubygems] Bump up to 4.0.0.beta1Hiroshi SHIBATA
https://github.com/ruby/rubygems/commit/9be811c01a
2025-10-20[ruby/rubygems] Now ruby/rubygems is the canonical repository urlHiroshi SHIBATA
https://github.com/ruby/rubygems/commit/c637007e91
2025-10-09[rubygems/rubygems] Bump up to RubyGems 4.0.0.dev that is next major versionHiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/5b963fb7d3
2025-09-19[rubygems/rubygems] Pull `Gem.win_platform?` out of a hot pathAaron Patterson
`normalize_path` is a pretty hot path, it's called many times per file in each gem. Since the platform isn't going to change from call to call, we can conditionally define `normalize_path` based on the value of `Gem.win_platform?`. https://github.com/rubygems/rubygems/commit/d5e61411f2
2025-08-18[rubygems/rubygems] Use spaces around optional parameter valuesDavid Rodríguez
https://github.com/rubygems/rubygems/commit/b58829a868
2025-08-06[rubygems/rubygems] Removed compatibility.rb that file is for Ruby 1.9.Hiroshi SHIBATA
https://github.com/rubygems/rubygems/commit/120c174e7f
2025-07-22[rubygems/rubygems] Workaround RVM issue when using Bundler <= 2.5.22David Rodríguez
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. https://github.com/rubygems/rubygems/commit/e5ed95e242
2025-07-17Set development version to Bundler 2.8.0.dev and RubyGems 3.8.0.devDavid Rodríguez
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-14[rubygems/rubygems] Fix more warnings when running old Bundler with latest ↵David Rodríguez
RubyGems Also fix platform warnings when Bundler's entrypoint is bundler's binstub. https://github.com/rubygems/rubygems/commit/4b1df58403
2025-07-14[rubygems/rubygems] Avoid more warnings when using RubyGems with old BundlerDavid Rodríguez
We were only avoiding them when the RUBYGEMS_GEMDEPS variable is used. Avoid the warnings in general, whenever the entrypoint to Bundler is `require`. https://github.com/rubygems/rubygems/commit/8683faef36
2025-07-14[rubygems/rubygems] Change helper to load only Bundler extensions to RubyGemsDavid Rodríguez
We'll want to reuse this helper in other situations where we don't want all Bundler loaded. https://github.com/rubygems/rubygems/commit/9e7018b0a1
2025-07-14[rubygems/rubygems] Move loading Bundler without platform warnings to a methodDavid Rodríguez
https://github.com/rubygems/rubygems/commit/e068f0649a
2025-06-24Revert accidentally commit with 96a0c2065a95d076978de41e8bfacbd19858d0bbHiroshi SHIBATA
2025-06-23Mark RClass instance that may be namespaced with RCLASS_NAMESPACEABLEJean Boussier
2025-06-16[rubygems/rubygems] Fix redefinition warnings when using modern RubyGems ↵David Rodríguez
with old Bundler https://github.com/rubygems/rubygems/commit/ce7e8e92ca
2025-03-24[rubygems/rubygems] Default to a SOURCE_DATE_EPOCH of 315619200, to simplify ↵Ellen Marie Dash
reproducible builds. https://github.com/rubygems/rubygems/commit/1d5a627398 Notes: Merged: https://github.com/ruby/ruby/pull/12968
2025-01-14[rubygems/rubygems] Print message when blocking on a file lock.Ellen Marie Dash
https://github.com/rubygems/rubygems/commit/3ca7ef214c Notes: Merged: https://github.com/ruby/ruby/pull/12568
2024-12-26Bump up RubyGems 3.7.0.dev and Bundler 2.7.0.devHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/12469
2024-12-24Merge RubyGems-3.6.2 and Bundler-2.6.2David Rodríguez
Notes: Merged: https://github.com/ruby/ruby/pull/12444
2024-12-18Bump Rubygems version to 3.6.1David Rodríguez
2024-12-17Bump Rubygems version to 3.6.0David Rodríguez
2024-12-15[rubygems/rubygems] Fix broken link to license fileStan Lo
https://github.com/rubygems/rubygems/commit/76cb4aad70
2024-11-26[rubygems/rubygems] More aggressive `Performance/FlatMap` cop configurationDavid Rodríguez
https://github.com/rubygems/rubygems/commit/d8d68cc00e
2024-10-23[rubygems/rubygems] Improve Bundler errors when trying to install to a ↵David Rodríguez
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 ``` https://github.com/rubygems/rubygems/commit/345ec45f5a
2024-10-22[rubygems/rubygems] Remove patches for old TruffleRuby versionsDavid Rodríguez
https://github.com/rubygems/rubygems/commit/264c61eb8e
2024-10-11[rubygems/rubygems] Fix `gem install` on NFS sharesDavid Rodríguez
NFS shares seem to support flock these days, but they need read-write permissions. https://github.com/rubygems/rubygems/commit/1c492804cd
2024-09-16[rubygems/rubygems] Remove temporary `.lock` files left around by gem installerDavid Rodríguez
https://github.com/rubygems/rubygems/commit/edbb2e3475
2024-09-16[rubygems/rubygems] Make sure implementations of `Gem.open_file_with_flock` ↵David Rodríguez
match https://github.com/rubygems/rubygems/commit/174a8e5284
2024-09-06[rubygems/rubygems] Workaround for TruffleRubyNobuyoshi Nakada
https://github.com/rubygems/rubygems/commit/b82e43fd54
2024-09-06[rubygems/rubygems] Remove the lock file for binstubsNobuyoshi Nakada
https://github.com/rubygems/rubygems/pull/7806#issuecomment-2241662488 https://github.com/rubygems/rubygems/commit/4f06ee234a
2024-09-02[rubygems/rubygems] Simplify `Gem.read_binary` and `Gem.write_binary`Nobuyoshi Nakada
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`. https://github.com/rubygems/rubygems/commit/44df9045df
2024-09-02[rubygems/rubygems] Avoid another race condition of open modeNobuyoshi Nakada
Instead, just open in CREATE and APPEND mode. Also, move the workaround for old Solaris as fallback to retry. https://github.com/rubygems/rubygems/commit/2daad257be
2024-07-08[rubygems/rubygems] Properly protect writing binstubs with a file lockDavid Rodríguez
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+`. https://github.com/rubygems/rubygems/commit/ce8bcba90f
2024-07-08[rubygems/rubygems] Scope rescuing `Errno::ENOLCK` to just `File.open`David Rodríguez
https://github.com/rubygems/rubygems/commit/2a9d347d29