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
rbenv-gemset v0.5.0 seems broken with rbenv+jruby #56
Comments
thanks, @neovatar for the nice report! But shouldnt jruby be called as |
But if it's the case that for whatever reason, calling |
Calling it via The Problem ist that the following line in rbenv-gemset/etc/rbenv.d/exec/gemset.bash
seems to trigger the whole plugin circle again (calling rbenv-gemset/etc/rbenv.d/which/gemset.bash then calling rbenv-gemset/etc/rbenv.d/exec/gemset.bash again). Unfortunately I know nothing about rbenv plugin developement, so I cannot tell why it happens with jruby, but not with native ruby. Probably the way the binaries are called via rbenv differs? |
I think its a bug in ruby-build: .rbenv/versions/2.0.0-p353/bin/gem starts with:
but .rbenv/versions/jruby-1.7.9/bin/gem starts with:
this will trigger rbenv-gemsets plugin execution, resulting in an endless loop since rbenb-gemset also calls the gem command to get the gem environment. Changing And putting What would be the best way to proceed? |
Ok, it seems the gem tool wrapper is not created by ruby-build or rbenv but by jruby/rubygems. Actually putting Would it be ok for you to have a jruby specific fix in your plugin? |
Thanks for the hard work, @neovatar ! It's always good to see somebody putting in the effort. Let me get back to you on this? I'll see what can be done. |
I think its a little bit ugly, but it works. Maybe you can come up with something more elegant - its bedtime for me now ;) |
thanks, @neovatar . I like your approach. Definitely going down the right path here, but yeah as u say, not so clean... You can check the latest commit for what I deem to be a better approach. You definitely pointed me down the right path, and saved a lot of time for me. Thanks! |
Thanks for the fix! I still think ruby-build should patch the shebangs in gem and jgem, maybe I'll open a ticket. |
hey sorry, hang on there. I might have been too hasty there. I need to correct that patch! But yeah, definitely open the tickets with jruby, thanks! |
Just had a quick check of your fix, you're right, it does not work right. I do not have time to test it thoroughly before tonight. Seems some basically installed gems are missing with that method. Maybe create a branch for this fix until we are sure it works? |
Ah, you are mssing paths because you use
|
no... that's too much. I've checked in the fix already. |
Sorry but this does not work. You can also call The reason that jruby can be called as ruby is, that you can run script that have a shebang like Even if my first fix is ugly, it detects jruby usage, even if jruby is called via |
How are you installing your jruby? I dont have this setup where I can call |
|
duh, ok! It is mentioned in the docs, I'll grant you that. I really dont like "let's bundle everything" approaches (ie., using everything in Gem.path). Can you see if the latest commit works for you? I've fixed things by simply swopping the order around. So check for a If by "first fix" u mean faceebb, I'd say it's not foolproof. I dont want to have to rely on somebody naming their ruby version with "jruby". Even a "JRUBY-xxx" would fail. |
Thanks for really helping out, and participating in this issue, btw! |
Awww, thanks to you for maintainig the plugin :) Youre right, my suggestion was not foolproof. You last code works, but still seems a bit complicated to me. But I can live with it ;) I would suggest:
What do you think? It uses the output of the called ruby to check if it is jruby. That would rule out the academic corner case that is still left open with your last code. |
I dont know.... That corner case is practically only theoretical. And if somebody really chooses to do it that way (OR somebody else has written code that ended up on this machine that caused it to be this way!), methinks they should be punished... :} I do like how your suggestion is immediately more intuitively readable; but I dont exactly want to do one more call ("--version") if I can help it. So at least for the moment, I will pass on this... Nice code, though! (Just as a note - I would do |
I agree with you and I will have a look at ruby-build tonight, maybe its possible to replace the shebangs with correct rbenv ones (like in the cruby version). |
…benv The default shebang for binstubs in a JRuby installation is `#!/usr/bin/env jruby`. On a rbenv-managed JRuby, this will execute the `jruby` rbenv shim. In a situation where a JRuby tool like `gem` is executed from within a running rbenv by a rbenv plugin, (e.g. rbenv-gemset) this can trigger another rbenv run to resolve the shim. This can lead to endless recursion of rbenv calls. Fixes #471, closes #473 References jf/rbenv-gemset#56
Steps to reproduce:
rbenv install jruby-1.7.9
rbenv global jruby-1.7.9
ruby --version
, it seems to hangRBENV_DEBUG=true ruby --version
, seems rbenv + rbenv-gemset is caught in an endless loopIts works fine with rbenv-gemset v0.4.2
The text was updated successfully, but these errors were encountered: