Repository navigation
Warn about downgrading default gems in bundle install - #10026
Merged
hsbt merged 2 commits intoNov 10, 2026
Merged
Conversation
rhenium
force-pushed
the
ky/bundler-warn-downgrade-default-gems
branch
2 times, most recently
from
November 6, 2026 16:31
c88261b to
6cfcba0
Compare
ENV["BUNDLER_GEM_DEFAULT_DIR"] is a Bundler test helper that overrides Gem.default_dir. Make spec/support/hax.rb rebuild the cache used by Gem.find_default_spec, which otherwise continues to reference the original default gems. Existing tests worked around the stale cache by copying gemspecs, but this should not be necessary.
Downgrading a gem below the default gem version shipped with the running Ruby version is not guaranteed to work. Warn when the bundle contains an older version of a default gem during "bundle install" or "bundle update". This can be particularly confusing because downgrading a default gem often works, but may also result in a cryptic error. One such case was reported at <ruby/net-http#362>, where the bundle contains an old version of net-protocol but does not include net-http. When the application calls require "net/http", the default net-http is loaded as a standard library. Its version requirement on net-protocol is then not honored.
rhenium
force-pushed
the
ky/bundler-warn-downgrade-default-gems
branch
from
November 6, 2026 16:42
6cfcba0 to
e99212f
Compare
Member
|
I'll look tomorrow. |
hsbt
approved these changes
Nov 10, 2026
This was referenced Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Downgrading a gem below the default gem version shipped with the running Ruby version is not guaranteed to work. Warn when the bundle contains an older version of a default gem during
bundle installorbundle update.This can be particularly confusing because downgrading a default gem often works, but may also result in a cryptic error. One such case was reported at ruby/net-http#362, where the bundle contains an old version of net-protocol but does not include net-http.
When the application calls
require "net/http", the default net-http is loaded as a standard library. Its version requirement on net-protocol is then not honored.Fixes ruby/net-http#362
For example, if the Gemfile.lock specifies an old version of
net-protocolfor some reason,bundle installwill now warn:A concern is that this might be annoying for Ruby master users where the default gems set often contains unreleased versions. You'll get a warning whenever the Gemfile contains stringio, since Ruby master currently includes stringio 3.2.1.dev.
BTW there is also a related issue about downgrading Bundler which this PR does not cover: ruby/ruby#16909
I think a warning would be useful there, too, but it will have to be taken care of separately.
What do you think?
What was the end-user or developer problem that led to this PR?
What is your fix for the problem, implemented in this PR?
Make sure the following tasks are checked