Fall back to lockfile version when BUNDLE_VERSION is "lockfile"#9545
Merged
Conversation
Bundler treats "lockfile" as a special value for the version setting, meaning "use the version recorded in BUNDLED WITH". BundlerVersionFinder was passing the raw string to Gem::Version.new and raising ArgumentError both from the env var added in #9538 and from .bundle/config.
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes Gem::BundlerVersionFinder to recognize the special value "lockfile" for the BUNDLE_VERSION setting (and BUNDLE_VERSION env var added in #9538). Previously, the literal string "lockfile" was passed to Gem::Version.new, raising ArgumentError. Now the finder skips assigning that sentinel and falls through to lockfile_version.
Changes:
- Capture
bundle_config_versiononce intobcvand short-circuit on"system"as before. - Skip using
bcvas the version when its value is the sentinel"lockfile", so the lockfile'sBUNDLED WITHvalue is used. - Add tests covering both the
BUNDLE_VERSION=lockfileenv var path and the.bundle/configBUNDLE_VERSION: "lockfile"path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| lib/rubygems/bundler_version_finder.rb | Treat "lockfile" as a sentinel and fall back to the lockfile-recorded version instead of passing the literal to Gem::Version.new. |
| test/rubygems/test_gem_bundler_version_finder.rb | Adds two tests covering the new sentinel behavior via env var and via global bundle config. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What was the end-user or developer problem that led to this PR?
Bundler treats "lockfile" as a special value for the version setting, meaning "use the version recorded in BUNDLED WITH".
BundlerVersionFinderwas passing the raw string toGem::Version.newand raisingArgumentErrorboth from the env var added in #9538 and from.bundle/config.Make sure the following tasks are checked