Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundler 2 does not auto-switch versions when BUNDLE_GEMFILE is set via .bundle/config #7445

Closed
jtokoph opened this issue Nov 19, 2019 · 2 comments

Comments

@jtokoph
Copy link

@jtokoph jtokoph commented Nov 19, 2019

Bundler 2 is supposed to detect if a project was bundled with v1 based on the BUNDLED WITH lines in the lockfile.

This is not working correctly if:

  1. The Gemfile is in a subdirectory or with an alternate name
  2. The alternate location is specified in .bundle/config with BUNDLE_GEMFILE
  3. bundle update is run from the project root directory

Note: This is working correctly if one of the following is true:

  • bundle update is run from the subdirectory that includes the Gemfile
  • or bundle update is run with BUNDLE_GEMFILE env var set to the alternate location

Expected result

Running bundler 2.x on a project that was bundled with 1.x would be that BUNDLED_WITH would not be updated.

Observed result

BUNDLED WITH is updated to 2.x

Example repo to reproduce

A repository that demonstrates this behavior is located here: https://github.com/jtokoph/bundler2bug

The readme has steps to reproduce.

@jtokoph

This comment has been minimized.

Copy link
Author

@jtokoph jtokoph commented Nov 19, 2019

I realized that this is actually a rubygems issue and opened an issue there: rubygems/rubygems#2991

@jtokoph jtokoph closed this Nov 19, 2019
@deivid-rodriguez

This comment has been minimized.

Copy link
Contributor

@deivid-rodriguez deivid-rodriguez commented Nov 19, 2019

Hi @jtokoph!

I think, this is actually a bug in bundler, and it should get fixed by #6713, which I just rebased.

It would be great if you could try it, but it's kind of complicated due to the following explanation. The changes in that PR led to a single test failure in bundler's test suite when I implemented it. So I figured it could be considered backwards incompatible, so I placed the fix under an environment variable flag. So, if you wanted to try whether the fix works for you, you would have to:

  • Clone my PR.
  • Install it with bin/rake install:local from the clone.
  • Run bundler with the BUNDLE_CONFIG_RELATIVE_TO_CWD environment variable.

I realize that this is a cumbersome way to try it, and I'm open to consider the spec being broken as a bug in our specs, and thus enable this fix by default without the need for any environment variable being set.

Let me know if you're able to follow these steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.