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

bundle check causes file modifications to Gemfile.lock #7587

Closed
andyw8 opened this issue Apr 17, 2024 · 2 comments · Fixed by #7613
Closed

bundle check causes file modifications to Gemfile.lock #7587

andyw8 opened this issue Apr 17, 2024 · 2 comments · Fixed by #7613

Comments

@andyw8
Copy link
Contributor

andyw8 commented Apr 17, 2024

Describe the problem as clearly as you can

Nothing in the docs indicates that bundle check should modify Gemfile.lock, but it seems to be doing so.

Did you try upgrading rubygems & bundler?

Yes: ruby 3.3.0, rubygems 3.5.3, bundler 2.5.9

Post steps to reproduce the problem

Create a new Gemfile, e.g.:

source "https://rubygems.org"

Run bundle to create an almost-empty Gemfile.lock.

Edit the Gemfile and add gem "mocha".

Run bundle check.

What were you expecting to happen?

Unsure, but Gemfile.lock should not change.

What actually happened?

Gemfile.lock is changed and now includes mocha.

cc @vinistock

@andyw8 andyw8 added the Bundler label Apr 17, 2024
@deivid-rodriguez
Copy link
Member

The way bundle check works is:

  • Tries to resolve your bundle using only locally installed gems.
  • If it finds any gem is missing, it throws an error.
  • If nothing is missing, it succeeds, and potentially "completes" the lockfile if anything was missing from it.

In other words, in your example, I think it succeeds (and fixes the lockfile) because you had mocha previously installed. If mocha had not been installed, it would've given an error.

I think the easiest way to fix this is to document the current behavior?

@andyw8
Copy link
Contributor Author

andyw8 commented Apr 27, 2024

Thanks, that matches the behaviour I'm seeing. Here's a possible update to the docs: #7613

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants