-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Fix bundler/setup
unintendedly writing to the filesystem
#6814
Conversation
0ba5fda
to
ae41177
Compare
Thank you for doing this! I like the new test case. Were the other test failures random or from this change/fix? |
Previously, when sorting and comparing git Gemfile vs lockfile sources during `bundler/setup` to figure out whether we need to re-resolve or not, we would try to find the default branch if nothing more specific was specified in the Gemfile. If the git cache has been deleted thought, that would fail. The error would still be swallowed (and the branch would simply not be displayed), but trying to clone would still generate the side effect of creating the parent folder for the clone. That could affect non-writable systems that don't expect `bundler/setup` to write to the filesystem at all. To fix this, override `Bundler::Source::Git#identifier` to use exclusively static information, so it does not even try to clone the repo nor generate any side effects.
ae41177
to
582eb2e
Compare
@metaskills They were directly related to this change. I pushed one more tweak that I expect to fix them 🤞. |
YUP! Looks green now. I really appreciate this followup. Is there anything I can do to help test/QA/etc? |
You can try to checkout related branch and add to path.
|
Thanks! Confirmed working from my end. |
@simi !!!! How are you doing? Nice to see you around. |
All good. :) |
Fix `bundler/setup` unintendedly writing to the filesystem (cherry picked from commit 8e10600)
What was the end-user or developer problem that led to this PR?
After #6786,
bundler/setup
would write to the filesystem when dealing with git sources.What is your fix for the problem, implemented in this PR?
When sorting and comparing git Gemfile vs lockfile sources during
bundler/setup
to figure out whether we need to re-resolve or not, we would try to find the default branch if nothing more specific was specified in the Gemfile.If the git cache has been deleted though, that would fail.
The error would still be swallowed (and the branch would simply not be displayed), but trying to clone would still generate the side effect of creating the parent folder for the clone.
That could affect non-writable systems that don't expect
bundler/setup
to write to the filesystem at all.To fix this, override
Bundler::Source::Git#identifier
to use exclusively static information, so it does not even try to clone the repo nor generate any side effects.This is essentially a rework of the original attempt to fix #6743, but without the problems discussed in that PR.
Fixes #6813.
Make sure the following tasks are checked