Skip to content

BUNDLE_VERSION=system does not always use the default_gem of bundler #9534

@rwstauner

Description

@rwstauner

Describe the problem as clearly as you can

Currently ruby head is broken with any released version of bundler.
I was trying to force it to use the version that is distributed with ruby (the default gem version), but had a hard time figuring out how to do so.

I tried setting BUNDLE_VERSION=system but if a Gemfile.lock specifies a version of bundler that is already installed globally (4.0.9) it will be used rather than the "default" version (4.1.0.dev).

I am currently working around this by looking up the default version and then setting BUNDLER_VERSION (note the R)

export BUNDLER_VERSION="$(ruby -e 'puts Gem::Specification.find_all_by_name("bundler").find(&:default_gem?)&.version')"

which gets me what I want based on

v = ENV["BUNDLER_VERSION"]

but I am not convinced this is the intended behavior.

The docs say

* `version` (`BUNDLE_VERSION`):
The version of Bundler to use when running under Bundler environment.
Defaults to `lockfile`. You can also specify `system` or `x.y.z`.
`lockfile` will use the Bundler version specified in the `Gemfile.lock`,
`system` will use the system version of Bundler, and `x.y.z` will use
the specified version of Bundler.

Post steps to reproduce the problem

  • install ruby master
  • setup a gemfile with any gem in it (for example base64).
  • run bundle install (with any ruby just to create the lock file)
  • change the lockfile to use 4.0.9
  • with PATH pointing to ruby master install...
  • gem uninstall -v 4.0.9 bundler # in case you already have it
  • BUNDLE_VERSION=system bundle --version will be 4.1.0.dev
  • gem install bundler -v 4.0.9
  • BUNDLE_VERSION=system bundle --version is now 4.0.9

Should "system" mean
"the one installed by default"
or
"the one matching your gemfile.lock if it happens to be globally installed and if not use the one installed by default"?

If this is the intended behavior of "system", should there be another value that always means "the one installed by default"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions