-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Support gemification of pathname
#4992
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
Conversation
e57cefa
to
ff77a3b
Compare
59c57c9
to
2ea0e8e
Compare
command_execution.exitstatus = if status.exited? | ||
status.exitstatus | ||
elsif status.signaled? | ||
128 + status.termsig |
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.
\nit 128 is a magic number. I think it would add to maintainability if the number would live in a constant.
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.
Sure, that can be improved, we should probably add a link to https://tldp.org/LDP/abs/html/exitcodes.html and move it to a constant/variable with some non magical name. But it's unrelated to this PR, here I'm just moving this code around, the magic number is already present in the current master branch.
I think it could be confusing for bundler's users if |
This way users should be able to use the whole set of root = Bundler.root
# stuff
if root.is_a?(Pathname)
# stuff
end or things like that, since that will change after this PR. I think that should be weird enough to ignore it? Another possibility could be to define some set of public bundler methods, and keep returning But I tend to think the current approach is fine. |
Yeah, the current approach seems fine to me. The potential problem seems very niche and pretty easy to resolve for the developer. Not sure why someone would need to check if |
Got a |
@andrewfader Interesting error. There is an issue in bootsnap that suggests that the error is caused by multiple gem activation of |
@doodzik I believe so, I ran setup.rb from this branch and then I was able to do it without error. |
Actually it may still be broken. Here's the new error |
Is that all? It would seem to me that backtrace is missing some entries. |
Here you go. Sorry about that:
|
What are the contents of |
@deivid-rodriguez I deleted my whole project and did
|
Mmm, alright. I was blind guessing that maybe your |
I'm guessing I didn't completely eradicate something - or something to do with rvm or bootsnap/spring running in the background |
Not that I need it, but reads better.
When launching bundler subprocesses for end to end testing, all of them will load the `spec/support/rubygems_version_manager.rb` file passed as a ruby's `-r` flag. Unfortunately this file depends on `pathname`, so unless we drop that dependency, we can't really test support for including the `pathname` gem in the `Gemfile`. This commit implements some refactorings to avoid loading `pathname` inside `bundler` test subprocesses.
`Pathname#sub` returns a new `Pathname` already.
We can use strings earlier on.
2ea0e8e
to
d266753
Compare
For backwards compatibility.
d266753
to
f62cad4
Compare
Alright I implemented the whole Pathname API in ruby, except for I guess next step is to vendor the pathname test suite and make sure it passes against our pure ruby implementation. |
Looking at the linked PR in the pathname repo, pathname doesn't support rubies older than 2.7. We probably need to vendor an earlier version of the library to be used with rubygems, correct? Or would it make more sense to wait with vendoring pathname before we deprecated an older ruby version #3260. |
That's a good point! Given that CI is fully green, my guess is that issues on old rubies are C-related (they were surfaced at gem compilation time) and that our pure ruby implementation doesn't suffer from them. But I think we'll find out for sure once I vendor pathname's test suite too, and see how our implementation behaves against it. |
Maybe I could help or pair on this. Lmk? |
This is only missing, I believe, to make sure that it's fully compatible with the real |
Thanks! |
What was the end-user or developer problem that led to this PR?
The
pathname
library has been gemified, so users should be able to specify it inside theirGemfile
's. However,bundler
uses thepathname
library internally for a lot of things. This causes thepathname
gem to be activated too early, possibly conflicting with user's choice of the gem.What is your fix for the problem, implemented in this PR?
My fix is:
pathname
usages when possible.pathname
gem, together with a pure ruby implementation of its C extension.The one concern I have here is that now some widely used methods, such as
Bundler.root
will return aBundler::Pathname
, not aPathname
. If people are using normal typing on the result, rather than duck typing, things will break since the result is an object of a different class now. If we can rely on people not doing this, I can fully implementPathname
's interface to avoid any other breakage (right now I have only implemented the subset of functionality that bundler uses internally).Fixes #5016.
Fixes ruby/pathname#12.
Make sure the following tasks are checked