-
-
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
Avoid duplicates -rbundler/setup in RUBYOPT with Ruby preview #7002
Conversation
Thanks for opening a pull request and helping make RubyGems and Bundler better! Someone from the RubyGems team will take a look at your pull request shortly and leave any feedback. Please make sure that your pull request has tests for any changes or added functionality. We use GitHub Actions to test and make sure your change works functionally and uses acceptable conventions, you can review the current progress of GitHub Actions in the PR status window below. If you have any questions or concerns that you wish to ask, feel free to leave a comment in this PR or join our #rubygems or #bundler channel on Slack. For more information about contributing to the RubyGems project feel free to review our CONTRIBUTING guide |
I think there are specs for this at |
90d454d
to
2e284a3
Compare
Of course! Added a test. |
2e284a3
to
f526158
Compare
Just noticed the failure, will fix it |
Thank you! |
f526158
to
843edfa
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super minor comment on the spec. Feel free to address it if you think it's a improvement!
When using a Ruby preview the require path of `bundler/setup` is similar to `-r/opt/ruby3.3.0-preview2/lib/ruby/3.3.0+0/bundler/setup`. The special character `+` in the string makes the Regexp fail, leading to multiple addition of the same require statement each time `set_rubyopt` is called (e.g. server reloading). Escaping the characters in the string esure a correct match with all the different Ruby versions.
843edfa
to
dd43dfa
Compare
I'm having trouble reproducing the failure locally because It's triggered only in some combination of the test matrix. I've added a stub which "should" help but I have zero knowledge of this codebase, so let's wait for CI 🤞😅. |
@deivid-rodriguez CI is green now |
Looks great, thank you! |
Avoid duplicates -rbundler/setup in RUBYOPT with Ruby preview (cherry picked from commit 6f7e7a9)
Avoid duplicates -rbundler/setup in RUBYOPT with Ruby preview (cherry picked from commit 6f7e7a9)
Avoid duplicates -rbundler/setup in RUBYOPT with Ruby preview (cherry picked from commit 6f7e7a9)
Avoid duplicates -rbundler/setup in RUBYOPT with Ruby preview (cherry picked from commit 6f7e7a9)
What was the end-user or developer problem that led to this PR?
When using a Ruby preview version the require path of
bundler/setup
is similar to-r/opt/ruby3.3.0-preview2/lib/ruby/3.3.0+0/bundler/setup
. The special character+
in the string makes the Regexp matching fail leading to the addition of duplicate require statements to RUBYOPT (e.g. server reloading).Example:
What is your fix for the problem, implemented in this PR?
Escaping the characters in the string ensure a correct match with all the different Ruby versions.
Example: