in terminal opened inside rvm project, cding out uses system ruby instead of rvm default #2531

Closed
ethco opened this Issue Jan 9, 2014 · 32 comments

6 participants

@ethco

this one is weird.

  • open a new terminal tab in a rvm-enabled project (for me, ~/oauthr)
    • rvm correctly uses the ruby for that project
  • cd out of the project into a non-rvm directory
    • rvm switches to the system ruby instead of the default ruby configured for rvm

this continues if I then cd back into any rvm project (switches to the project's ruby) and then back out to any non-rvm directory (uses system ruby instead of rvm default ruby)

this doesn't happen when the terminal is initially opened outside of an rvm-enabled project - it correctly uses the rvm default ruby, switches correctly when cding into a rvm project, and switches back to the rvm default ruby when cding back out.

@mpapis mpapis closed this in 0b72c17 Jan 9, 2014
@mpapis
Ruby enVironment Manager member

this should do it, please let me know if it does not

@ethco

yup, that got it. thanks.

@ethco

... however, this seems to have reverted the effects of the fix for #2519. now when I open a new tab inside a rvm project, the rvm default ruby is used instead of the project's ruby. (gemset is set correctly though)

@mpapis mpapis reopened this Jan 10, 2014
@mpapis
Ruby enVironment Manager member

has to be a bug, I will investigate

@mpapis
Ruby enVironment Manager member

the above should improve things, I have also added extra test - but it works (compared to the other failing one which seams to be related to this problem) ... can someone retest it after rvm get head

@hiattp

Didn't fix the problem I was having on #2527

@ethco

no, I still have the same behavior as #2519 (not the behavior described actually in this issue)

@mpapis
Ruby enVironment Manager member

yeah, I know there is something, I just can not find a test that will reproduce it and tell me what is wrong

@mpapis
Ruby enVironment Manager member

added more tests and a small fix, please give it a go after rvm get head

@mpapis
Ruby enVironment Manager member

ok so I have finally reproduced the problem on travis, I can not reproduce it locally, but maybe I can debug it on travis, it will take some time, but it's progress

@mpapis mpapis added a commit that referenced this issue Jan 12, 2014
@mpapis mpapis fix removing rvm_silence_path_mismatch_check_flag and rvm_project_rvm…
…rc from ~/.rvmrc, update #2531
b916a08
@mpapis
Ruby enVironment Manager member

hmm, so the test passes after removing rvm_project_rvmrc=0 from ~/.rvmrc - are you using the cd function wrapper or is it disabled like it is by default on travis?

@mpapis mpapis added a commit to rvm/rvm-test that referenced this issue Jan 12, 2014
@mpapis mpapis improved rvmrc-create test with reseting 1.9.3 environment and extra …
…confirmations ruby is loaded, update rvm/rvm#2531
e504d17
@mpapis
Ruby enVironment Manager member

ok so I have added tests simulating the problem and none of them fails right now, I had to do one change to make the tests work - it could be the one that will make it work for you, please test again after rvm get head.

@hiattp

Still no luck unfortunately :/

@mpapis
Ruby enVironment Manager member

please download this two files (click on the raw link):

and then run:

gem install tf
tf --text load_ruby-version_comment_test.sh rvm_project_rvmrc_comment_test.sh

gist the output

@hiattp

Here is the gist. Thanks to the test I discovered that everything works fine so long as I don't have a default ruby set, so rvm alias delete default is a temporary fix.

@mpapis
Ruby enVironment Manager member

this is interesting all the tests pass, the load_ruby-version_comment_test.sh is specifically designed to simulate your problem and it passes, can you review it and maybe suggest extra steps to simulate your setup? maybe you set default ruby using PATH before sourcing rvm?

@hiattp

I'll poke around but it sounds like it's pretty idiosyncratic to my setup so I must just have something weird somewhere, not a big deal

@mpapis
Ruby enVironment Manager member

actually I was getting this report for some time, but I can not reproduce this in tests, as I can not reproduce it - I do not know what to fix.

@ethco

gist for me of tf --text load_ruby-version_comment_test.sh rvm_project_rvmrc_comment_test.sh : https://gist.github.com/ethco/6ac6964160491ec6e760

@mpapis
Ruby enVironment Manager member

@ethco oh it looks like you can reproduce the problem! please confirm you get the same after:

rvm get head
rvm reload
@ethco

one fewer failure after get head: https://gist.github.com/ethco/6890585e6ddf1f9b9481

@mpapis
Ruby enVironment Manager member

@ethco please get this test https://gist.github.com/mpapis/001a76111d9f42a8e1e7 and run it with:

tf --text failing_load_comment_test.sh 2>&1 | tee big.log

please gist big.log file.

@mpapis
Ruby enVironment Manager member

it looks like i found one, please retest after rvm get head ; rvm reload

@elia

works for me 👍

@ethco

looks good. behavior seems correct now and the tf tests all pass.

@mpapis
Ruby enVironment Manager member

assuming it's all good now, will release new version after reviewing rest of the tickets

@mpapis mpapis closed this Jan 15, 2014
@hiattp

Fixed for me too!

@ethco

yay!

@mpapis
Ruby enVironment Manager member

and released as 1.25.15

@vipin8169

Still getting the same problem with "rvm 1.26.11"
When opening new tab, I've to cd into the directory to make it work
cd ./

@SubhashShah-BTC

Didn't work for me on Ubuntu 14.04 64-bit.

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