From 13a57c9c35866f25b0b12fbe4c4df475711b09eb Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 17 Sep 2025 08:16:14 +0900 Subject: [PATCH 01/10] sync_default_gems.rb: Set git configurations for EOL code of logs --- tool/sync_default_gems.rb | 9 ++++----- tool/test/test_sync_default_gems.rb | 3 ++- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tool/sync_default_gems.rb b/tool/sync_default_gems.rb index 35183bc706e7e0..366f64ddfcec9b 100755 --- a/tool/sync_default_gems.rb +++ b/tool/sync_default_gems.rb @@ -455,17 +455,16 @@ def message_filter(repo, sha, input: ARGF) end def log_format(format, args, &block) - IO.popen(%W[git log --no-show-signature --format=#{format}] + args, "rb", &block) + IO.popen(%W[git -c core.autocrlf=false -c core.eol=lf + log --no-show-signature --format=#{format}] + args, "rb", &block) end # Returns commit list as array of [commit_hash, subject]. def commits_in_ranges(gem, repo, default_branch, ranges) # If -a is given, discover all commits since the last picked commit if ranges == true - # \r? needed in the regex in case the commit has windows-style line endings (because e.g. we're running - # tests on Windows) - pattern = "https://github\.com/#{Regexp.quote(repo)}/commit/([0-9a-f]+)\r?$" - log = log_format('%B', %W"-E --grep=#{pattern} -n1", &:read) + pattern = "https://github\.com/#{Regexp.quote(repo)}/commit/([0-9a-f]+)$" + log = log_format('%B', %W"-E --grep=#{pattern} -n1 --", &:read) ranges = ["#{log[%r[#{pattern}\n\s*(?i:co-authored-by:.*)*\s*\Z], 1]}..#{gem}/#{default_branch}"] end diff --git a/tool/test/test_sync_default_gems.rb b/tool/test/test_sync_default_gems.rb index aa089f20687115..c84ebdb17e22a3 100755 --- a/tool/test/test_sync_default_gems.rb +++ b/tool/test/test_sync_default_gems.rb @@ -99,7 +99,8 @@ def setup # Generate a new unprotected key with default parameters that # expires after 30 seconds. if @gpgsign = system(*%w"gpg --quiet --batch --passphrase", "", - "--quick-generate-key", email, *%W"default default seconds=#{expire}") + "--quick-generate-key", email, *%W"default default seconds=#{expire}", + err: IO::NULL) # Fetch the generated public key. signingkey = IO.popen(%W"gpg --quiet --list-public-key #{email}", &:read)[/^pub .*\n +\K\h+/] end From 885860d233954facf47b279f47823aeabbd14c4a Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 17 Sep 2025 08:35:09 +0900 Subject: [PATCH 02/10] Fix git version comparison --- win32/Makefile.sub | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 21bd57e760e534..81a33277afb161 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -525,7 +525,8 @@ HAVE_GIT = no !if "$(HAVE_GIT)" == "no" !else if [for /f "tokens=3" %I in ('git --version') do @(\ for /f "delims=. tokens=1-2" %I in ("%I") do @(\ - if %I lss 2 (exit 1) else if %J lss 10 (exit 1) else (exit 0)\ + if %I lss 2 (exit 1) else if %I gtr 2 (exit 0) \ + else if %J lss 10 (exit 1) else (exit 0)\ )\ )] HAVE_GIT = no From fbc7e935761d892ba6c031256ccbb914963e4ce1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 17 Sep 2025 11:25:22 +0900 Subject: [PATCH 03/10] Already git 2.32 is expected in doc/contributing/building_ruby.md --- configure.ac | 5 ++--- win32/Makefile.sub | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index b035e1688a8461..6d91d764456e36 100644 --- a/configure.ac +++ b/configure.ac @@ -113,10 +113,9 @@ AC_ARG_WITH(git, { test x"$HAVE_GIT" = xyes && command -v "$GIT" > /dev/null && - # `git -C`: 1.8.5 - # `git log --no-show-signature`: 2.10.0 + # see Dependencies in doc/contributing/building_ruby.md AS_CASE([`$GIT -C . --version 2> /dev/null | sed 's/.* //'`], - [0.*|1.*|2.@<:@0-9@:>@.*], [false], + [0.*|1.*|2.@<:@0-9@:>@.*|2.@<:@12@:>@@<:@0-9@:>@.*|2.3@<:@01@:>@.*], [false], [true]) } || HAVE_GIT=no GIT=never-use AC_SUBST(GIT) diff --git a/win32/Makefile.sub b/win32/Makefile.sub index 81a33277afb161..917c407a006124 100644 --- a/win32/Makefile.sub +++ b/win32/Makefile.sub @@ -526,7 +526,7 @@ HAVE_GIT = no !else if [for /f "tokens=3" %I in ('git --version') do @(\ for /f "delims=. tokens=1-2" %I in ("%I") do @(\ if %I lss 2 (exit 1) else if %I gtr 2 (exit 0) \ - else if %J lss 10 (exit 1) else (exit 0)\ + else if %J lss 32 (exit 1) else (exit 0)\ )\ )] HAVE_GIT = no From e92543e76c13c257664e23d8f95a156e7cf9aef5 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Wed, 17 Sep 2025 11:31:34 +0900 Subject: [PATCH 04/10] Skip `TestSyncWithCommits` on other than particular platforms No one uses `sync_default_gems_with` on other platforms; it is used by the dedicated workflow and a few developers only. --- tool/test/test_sync_default_gems.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tool/test/test_sync_default_gems.rb b/tool/test/test_sync_default_gems.rb index c84ebdb17e22a3..adbde66fbff132 100755 --- a/tool/test/test_sync_default_gems.rb +++ b/tool/test/test_sync_default_gems.rb @@ -314,5 +314,5 @@ def test_delete_after_conflict assert_equal(":ok\n""Should.be_merged\n", File.read("src/lib/common.rb"), out) assert_not_operator(File, :exist?, "src/lib/bad.rb", out) end - end + end if /darwin|linux/ =~ RUBY_PLATFORM end From 19a363680f2e009df275c3f973a35a6a703033db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <2887858+deivid-rodriguez@users.noreply.github.com> Date: Tue, 9 Sep 2025 19:19:47 +0200 Subject: [PATCH 05/10] [rubygems/rubygems] Make `bundle remove --install` raise an error https://github.com/rubygems/rubygems/commit/444022cfd3 --- lib/bundler/cli.rb | 5 ++--- lib/bundler/man/bundle-remove.1 | 8 +------- lib/bundler/man/bundle-remove.1.ronn | 9 +-------- spec/bundler/commands/remove_spec.rb | 15 --------------- spec/bundler/other/major_deprecation_spec.rb | 8 +++----- 5 files changed, 7 insertions(+), 38 deletions(-) diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 8151de713ae1f7..87077f3c887630 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -187,12 +187,11 @@ def check long_desc <<-D Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If the gem is not found, Bundler prints a error message and if gem could not be removed due to any reason Bundler will display a warning. D - method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile" + method_option "install", type: :boolean, banner: "Runs 'bundle install' after removing the gems from the Gemfile (removed)" def remove(*gems) if ARGV.include?("--install") - message = "The `--install` flag has been deprecated. `bundle install` is triggered by default." removed_message = "The `--install` flag has been removed. `bundle install` is triggered by default." - SharedHelpers.major_deprecation(2, message, removed_message: removed_message) + raise InvalidOption, removed_message end require_relative "cli/remove" diff --git a/lib/bundler/man/bundle-remove.1 b/lib/bundler/man/bundle-remove.1 index 63ffe0f1576e39..4dc7a03b9f5de2 100644 --- a/lib/bundler/man/bundle-remove.1 +++ b/lib/bundler/man/bundle-remove.1 @@ -4,18 +4,12 @@ .SH "NAME" \fBbundle\-remove\fR \- Removes gems from the Gemfile .SH "SYNOPSIS" -\fBbundle remove [GEM [GEM \|\.\|\.\|\.]] [\-\-install]\fR +`bundle remove [GEM [GEM \|\.\|\.\|\.]] .SH "DESCRIPTION" Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid\. If a gem cannot be removed, a warning is printed\. If a gem is already absent from the Gemfile, and error is raised\. -.SH "OPTIONS" -.TP -\fB\-\-install\fR -Runs \fBbundle install\fR after the given gems have been removed from the Gemfile, which ensures that both the lockfile and the installed gems on disk are also updated to remove the given gem(s)\. .P Example: .P bundle remove rails .P bundle remove rails rack -.P -bundle remove rails rack \-\-install diff --git a/lib/bundler/man/bundle-remove.1.ronn b/lib/bundler/man/bundle-remove.1.ronn index ceb1a980be1a2b..49cb4dc1fdde77 100644 --- a/lib/bundler/man/bundle-remove.1.ronn +++ b/lib/bundler/man/bundle-remove.1.ronn @@ -3,21 +3,14 @@ bundle-remove(1) -- Removes gems from the Gemfile ## SYNOPSIS -`bundle remove [GEM [GEM ...]] [--install]` +`bundle remove [GEM [GEM ...]] ## DESCRIPTION Removes the given gems from the Gemfile while ensuring that the resulting Gemfile is still valid. If a gem cannot be removed, a warning is printed. If a gem is already absent from the Gemfile, and error is raised. -## OPTIONS - -* `--install`: - Runs `bundle install` after the given gems have been removed from the Gemfile, which ensures that both the lockfile and the installed gems on disk are also updated to remove the given gem(s). - Example: bundle remove rails bundle remove rails rack - -bundle remove rails rack --install diff --git a/spec/bundler/commands/remove_spec.rb b/spec/bundler/commands/remove_spec.rb index 3e163461959cd1..8a2e6778eafd4c 100644 --- a/spec/bundler/commands/remove_spec.rb +++ b/spec/bundler/commands/remove_spec.rb @@ -43,21 +43,6 @@ end end - context "when --install flag is specified" do - it "removes gems from .bundle" do - gemfile <<-G - source "https://gem.repo1" - - gem "myrack" - G - - bundle "remove myrack --install" - - expect(out).to include("myrack was removed.") - expect(the_bundle).to_not include_gems "myrack" - end - end - describe "remove single gem from gemfile" do context "when gem is present in gemfile" do it "shows success for removed gem" do diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index e9d62bc3b87df5..b3d631a19eb2e5 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -669,13 +669,11 @@ end context "with --install" do - it "shows a deprecation warning" do - bundle "remove myrack --install" + it "fails with a helpful message" do + bundle "remove myrack --install", raise_on_error: false - expect(err).to include "[DEPRECATED] The `--install` flag has been deprecated. `bundle install` is triggered by default." + expect(err).to include "The `--install` flag has been removed. `bundle install` is triggered by default." end - - pending "fails with a helpful message", bundler: "4" end end From 7c5613a63865553c4191e82249c157e8a16eca75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <2887858+deivid-rodriguez@users.noreply.github.com> Date: Tue, 9 Sep 2025 19:20:00 +0200 Subject: [PATCH 06/10] [rubygems/rubygems] Move `bundle install --binstubs` deprecation to cli.rb For consistency with the other deprecations. https://github.com/rubygems/rubygems/commit/28e300cee1 --- lib/bundler/cli.rb | 6 ++++++ lib/bundler/cli/install.rb | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 87077f3c887630..c667020f0aaeba 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -239,6 +239,12 @@ def install remembered_flag_deprecation("deployment", negative: true) + if ARGV.include?("--binstubs") + message = "The --binstubs option will be removed in favor of `bundle binstubs --all`" + removed_message = "The --binstubs option have been removed in favor of `bundle binstubs --all`" + SharedHelpers.major_deprecation(2, message, removed_message: removed_message) + end + require_relative "cli/install" Bundler.settings.temporary(no_install: false) do Install.new(options.dup).run diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index c4063f808ab64f..57c28379e5f57d 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -38,12 +38,6 @@ def run Bundler::Fetcher.disable_endpoint = options["full-index"] - if options["binstubs"] - Bundler::SharedHelpers.major_deprecation 2, - "The --binstubs option will be removed in favor of `bundle binstubs --all`", - removed_message: "The --binstubs option have been removed in favor of `bundle binstubs --all`" - end - Plugin.gemfile_install(Bundler.default_gemfile) if Bundler.feature_flag.plugins? # For install we want to enable strict validation From a16c88ec9d58e37f810ab1e35f0b1276a743cd4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <2887858+deivid-rodriguez@users.noreply.github.com> Date: Tue, 9 Sep 2025 19:20:10 +0200 Subject: [PATCH 07/10] [rubygems/rubygems] Fix grammar in `bundle install --binstubs` removal message https://github.com/rubygems/rubygems/commit/feb258c712 --- lib/bundler/cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index c667020f0aaeba..4bf75bb338aba9 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -241,7 +241,7 @@ def install if ARGV.include?("--binstubs") message = "The --binstubs option will be removed in favor of `bundle binstubs --all`" - removed_message = "The --binstubs option have been removed in favor of `bundle binstubs --all`" + removed_message = "The --binstubs option has been removed in favor of `bundle binstubs --all`" SharedHelpers.major_deprecation(2, message, removed_message: removed_message) end From 5a07417c6fb0009570a71c9ae40bb7dde5607c42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <2887858+deivid-rodriguez@users.noreply.github.com> Date: Tue, 9 Sep 2025 19:20:17 +0200 Subject: [PATCH 08/10] [rubygems/rubygems] Finalize `bundle install --binstubs` removal https://github.com/rubygems/rubygems/commit/ccb65ce0ea --- lib/bundler/cli.rb | 5 ++--- lib/bundler/man/bundle-install.1 | 5 ----- lib/bundler/man/bundle-install.1.ronn | 14 -------------- spec/bundler/other/major_deprecation_spec.rb | 8 +++----- 4 files changed, 5 insertions(+), 27 deletions(-) diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index 4bf75bb338aba9..0635260e95c2db 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -209,7 +209,7 @@ def remove(*gems) If the bundle has already been installed, bundler will tell you so and then exit. D - method_option "binstubs", type: :string, lazy_default: "bin", banner: "Generate bin stubs for bundled gems to ./bin" + method_option "binstubs", type: :string, lazy_default: "bin", banner: "Generate bin stubs for bundled gems to ./bin (removed)" method_option "clean", type: :boolean, banner: "Run bundle clean automatically after install (removed)" method_option "deployment", type: :boolean, banner: "Install using defaults tuned for deployment environments (removed)" method_option "frozen", type: :boolean, banner: "Do not allow the Gemfile.lock to be updated after this install (removed)" @@ -240,9 +240,8 @@ def install remembered_flag_deprecation("deployment", negative: true) if ARGV.include?("--binstubs") - message = "The --binstubs option will be removed in favor of `bundle binstubs --all`" removed_message = "The --binstubs option has been removed in favor of `bundle binstubs --all`" - SharedHelpers.major_deprecation(2, message, removed_message: removed_message) + raise InvalidOption, removed_message end require_relative "cli/install" diff --git a/lib/bundler/man/bundle-install.1 b/lib/bundler/man/bundle-install.1 index 47e8858f732940..2d7ef96b4490fd 100644 --- a/lib/bundler/man/bundle-install.1 +++ b/lib/bundler/man/bundle-install.1 @@ -13,11 +13,6 @@ If a \fBGemfile\.lock\fR does exist, and you have not updated your Gemfile(5), B If a \fBGemfile\.lock\fR does exist, and you have updated your Gemfile(5), Bundler will use the dependencies in the \fBGemfile\.lock\fR for all gems that you did not update, but will re\-resolve the dependencies of gems that you did update\. You can find more information about this update process below under \fICONSERVATIVE UPDATING\fR\. .SH "OPTIONS" .TP -\fB\-\-binstubs[=BINSTUBS]\fR -Binstubs are scripts that wrap around executables\. Bundler creates a small Ruby file (a binstub) that loads Bundler, runs the command, and puts it in \fBbin/\fR\. This lets you link the binstub inside of an application to the exact gem version the application needs\. -.IP -Creates a directory (defaults to \fB~/bin\fR when the option is used without a value, or to the given \fB\fR directory otherwise) and places any executables from the gem there\. These executables run in Bundler's context\. If used, you might add this directory to your environment's \fBPATH\fR variable\. For instance, if the \fBrails\fR gem comes with a \fBrails\fR executable, this flag will create a \fBbin/rails\fR executable that ensures that all referred dependencies will be resolved using the bundled gems\. -.TP \fB\-\-force\fR, \fB\-\-redownload\fR Force reinstalling every gem, even if already installed\. .TP diff --git a/lib/bundler/man/bundle-install.1.ronn b/lib/bundler/man/bundle-install.1.ronn index c37ec1eeb41c4c..b946cbf8322917 100644 --- a/lib/bundler/man/bundle-install.1.ronn +++ b/lib/bundler/man/bundle-install.1.ronn @@ -35,20 +35,6 @@ update process below under [CONSERVATIVE UPDATING][]. ## OPTIONS -* `--binstubs[=BINSTUBS]`: - Binstubs are scripts that wrap around executables. Bundler creates a small Ruby - file (a binstub) that loads Bundler, runs the command, and puts it in `bin/`. - This lets you link the binstub inside of an application to the exact gem - version the application needs. - - Creates a directory (defaults to `~/bin` when the option is used without a - value, or to the given `` directory otherwise) and places any - executables from the gem there. These executables run in Bundler's context. If - used, you might add this directory to your environment's `PATH` variable. For - instance, if the `rails` gem comes with a `rails` executable, this flag will - create a `bin/rails` executable that ensures that all referred dependencies - will be resolved using the bundled gems. - * `--force`, `--redownload`: Force reinstalling every gem, even if already installed. diff --git a/spec/bundler/other/major_deprecation_spec.rb b/spec/bundler/other/major_deprecation_spec.rb index b3d631a19eb2e5..1749d7e6827eaf 100644 --- a/spec/bundler/other/major_deprecation_spec.rb +++ b/spec/bundler/other/major_deprecation_spec.rb @@ -398,17 +398,15 @@ describe "bundle install --binstubs" do before do - install_gemfile <<-G, binstubs: true + install_gemfile <<-G, binstubs: true, raise_on_error: false source "https://gem.repo1" gem "myrack" G end - it "should output a deprecation warning" do - expect(deprecations).to include("The --binstubs option will be removed in favor of `bundle binstubs --all`") + it "fails with a helpful error" do + expect(err).to include("The --binstubs option has been removed in favor of `bundle binstubs --all`") end - - pending "fails with a helpful error", bundler: "4" end context "bundle install with both gems.rb and Gemfile present" do From e4fc0d4b3ff483224d7264d1c734532636840da5 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Tue, 16 Sep 2025 17:45:02 +0900 Subject: [PATCH 09/10] [rubygems/rubygems] Stop trying to remove every file on extraction When we're extracting a gem, it should be extracted to an empty directory. Trying to remove every file before extracting the file greatly slows the tar extraction process. This change increases tar extraction speed by about 10%: Master branch: ``` aaron@tc ~/g/tartest (main)> ruby -I../rubygems/lib:../vernier/lib test.rb {MEAN: 0.https://github.com/rubygems/rubygems/commit/670195550005} {stddev: 0.https://github.com/rubygems/rubygems/commit/029875687861} {"mib/s": 20.https://github.com/rubygems/rubygems/commit/889425481677} ``` This commit: ``` aaron@tc ~/g/tartest (main)> ruby -I../rubygems/lib:../vernier/lib test.rb {MEAN: 0.https://github.com/rubygems/rubygems/commit/600223749969} {stddev: 0.https://github.com/rubygems/rubygems/commit/037224226667} {"mib/s": 23.https://github.com/rubygems/rubygems/commit/324635189326} ``` https://github.com/rubygems/rubygems/commit/e40a153560 --- lib/rubygems/package.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/rubygems/package.rb b/lib/rubygems/package.rb index a8eba81ea06f4a..cd8dfdf37d1a15 100644 --- a/lib/rubygems/package.rb +++ b/lib/rubygems/package.rb @@ -436,8 +436,6 @@ def extract_tar_gz(io, destination_dir, pattern = "*") # :nodoc: symlinks << [full_name, link_target, destination, real_destination] end - FileUtils.rm_rf destination - mkdir = if entry.directory? destination From 6094cb51136418a7b545baa84b6ede0aaeb2eaac Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Wed, 17 Sep 2025 14:14:42 +0900 Subject: [PATCH 10/10] Revert "Handle `uninitialized constant JSON::GenericObject` at ruby/ruby." This reverts commit 0dc1cd407e7775610f2bcaef6c1282369867f91c. 1213adfe5526d65cce81a9fb127074130c8faea7 is fixed this issue. --- test/json/json_generic_object_test.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/json/json_generic_object_test.rb b/test/json/json_generic_object_test.rb index 71d105976d0cfa..57e3bf3c52b232 100644 --- a/test/json/json_generic_object_test.rb +++ b/test/json/json_generic_object_test.rb @@ -15,8 +15,6 @@ def setup else omit("JSON::GenericObject is not available") end - rescue NameError - omit("JSON::GenericObject is not available") end def test_attributes