Giter VIP home page Giter VIP logo

Comments (19)

databus23 avatar databus23 commented on June 7, 2024 2

It also stopped working for me. I haven't used it in a while but somehow now I'm always stuck with the system ruby on OSX and chruby seems to do nothing.

from chruby-fish.

JeanMertz avatar JeanMertz commented on June 7, 2024

Interesting πŸ€”

I can't see any reason why this shouldn't work. The only curious thing is that your echo $PATH shows a completely default list of PATH values, nothing being injected by chruby-fish, but also nothing injected by VMWare Fusion, or any other utility.

What is the output of echo $PATH before you invoke chruby-fish?

My initial guess would be that there's something wrong with your $PATH regardless of what chruby-fish is doing, but that's just a guess right now.

from chruby-fish.

thornomad avatar thornomad commented on June 7, 2024

Hi @JeanMertz - I cropped the path so it wouldn't be so long .... /Applications/VMware Fusion.app/Contents/Public is at the end of both (bash and fish) echo $PATH commands. Sorry if that threw you off, was just trying to be concise.

For now, I am manually exporting the path before before I execute the rails commands:

set PATH -gx /Users/damon/.gem/ruby/2.5.0/bin /Users/damon/.rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/bin /Users/damon/.rubies/ruby-2.5.0/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin; and bundle exec rails server

This works ... but am not sure why chruby 2.5.0 isn't able to do the same thing in fish.

from chruby-fish.

JeanMertz avatar JeanMertz commented on June 7, 2024

I checked, but chrubby hasn't been updated, chruby-fish also hasn't needed an update in a long time, so something else must have changed. Did you perhaps recently update your Fish version?

from chruby-fish.

thornomad avatar thornomad commented on June 7, 2024

I just received a brand new mac (yesterday) and installed it all fresh via homebrew. Am at versions:

~ fish --version
fish, version 2.7.1
~ chruby --version
chruby: 0.3.9
chruby-fish: 0.8.1

It isn't working for me straight of the box anymore either.

I tested bash again (as in my first post) and that does work. Are you at the same fish version ? Not sure what else could be interfering.

PS: I might try and install fish 2.6.x and see if that's what broke it ... if I can figure out how to do that easily. Smile. Unless you all are at 2.7.x. @databus23 - what version of fish are you using?

from chruby-fish.

willcosgrove avatar willcosgrove commented on June 7, 2024

I'm having the same issue. I'm almost certain it was working for me with fish 2.7.1, because I only switched to fish a few months ago, and 2.7.1 came out Dec 2017, which was before I switched. So unless the version had not been updated in homebrew by the time I switched to fish, I should have been running 2.7.1.

@thornomad It's interesting that you mention installing VMware Fusion, I also installed that yesterday, and today I just experienced the problem for the first time. I uninstalled VMware Fusion yesterday as well. I'm not sure what the VMware Fusion install could have done that would break this.

from chruby-fish.

willcosgrove avatar willcosgrove commented on June 7, 2024

Wow that ended up being it (for me) @thornomad. I'm glad you mentioned VMware, I never would have made that connection.

https://communities-gbot.vmware.com/thread/574038

I had to cd /etc/paths.d and then sudo rm com.vmware.fusion.public which removed the path addition, and fixed the problem for me.

from chruby-fish.

databus23 avatar databus23 commented on June 7, 2024

VMware Fusion injects a path with a space in the PATH environment variable. Maybe that is messing things up. I have fusion installed as well and it’s not working me. Havenβ€˜t tried removing it.

from chruby-fish.

thornomad avatar thornomad commented on June 7, 2024

Wow - glad we know what's causing it ... I wonder if it's the way chruby.sh is handling the : to space swapping when it is reading the $PATH variable and creating a new one ... I can imagine an unexpected space could be throwing that off.

set bash_path (echo $PATH | tr ' ' ':')

That would likely break with a space in one of the path variables I would guess ...

from chruby-fish.

JeanMertz avatar JeanMertz commented on June 7, 2024

Could any of you having this problem show the (full, but with any sensitive paths scrambled, if you want) output of these three commands:

echo $PATH
printf '%s\n' $PATH
bash -c "printf '%s\n' \$PATH"

from chruby-fish.

databus23 avatar databus23 commented on June 7, 2024

@JeanMertz Here you go.
The third command output looks fishy...

>> echo $PATH
/Users/user/bin /Users/user/Development/go/bin /usr/local/bin /usr/local/sbin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Applications/VMware Fusion.app/Contents/Public

>> printf '%s\n' $PATH
/Users/user/bin
/Users/user/Development/go/bin
/usr/local/bin
/usr/local/sbin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Applications/VMware Fusion.app/Contents/Public

>> bash -c "printf '%s\n' \$PATH"
/Users/user/bin:/Users/user/Development/go/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware
Fusion.app/Contents/Public

from chruby-fish.

JeanMertz avatar JeanMertz commented on June 7, 2024

Thanks @databus23. The first and second one are interesting. I'm guessing in your .fish config, you have quotes around the VMWare Fusion path, like "/Applications/VMware Fusion.app/Contents/Public"?

I think the easiest fix for this is to make this change in chruby.fish:

- set bash_path (echo $PATH | tr ' ' ':')
+ set bash_path (string join ':' $PATH)

Could you see if that works as expected? The only problem is I don't know since when Fish supports the builtin string join, but that's a problem for later.

from chruby-fish.

databus23 avatar databus23 commented on June 7, 2024

@JeanMertz I didn't put this Vmware path in my PATH manually. That is happening by installing VMware fusion 10 which drops a file in /etc/paths.d:

>> cat /etc/paths.d/com.vmware.fusion.public
/Applications/VMware Fusion.app/Contents/Public

Unfortunately set bash_path (string join ':' $PATH) does not seem to change anything.

Calling chruby 2.5.0 still silently fails (exit: 1) and leaves me with the system ruby.
( I verified with functions bchruby that the change is loaded)

from chruby-fish.

databus23 avatar databus23 commented on June 7, 2024

I think I know what the problem is now:
when invoking this in chruby_use

  bchruby 'chruby_use' $argv $args | read -l ch_ruby_root ch_rubyopt ch_gem_home \
                                         ch_gem_path ch_gem_root ch_path \
                                         ch_ruby_engine ch_ruby_version \
                                         ch_status

the resulting whitespace in ch_path is causing an "off by one" error when read populates the variables. (Printing $ch_status afterwards yields 2.5.0)

from chruby-fish.

databus23 avatar databus23 commented on June 7, 2024

Played around a bit:
Setting this before calling bchruby 'chruby_use' $argv $args | read ... seems to fix it in my case:

  set -l args '; echo "$RUBY_ROOT;${RUBYOPT:-_};${GEM_HOME:-_};${GEM_PATH:-_};${GEM_ROOT:-_};$PATH;$RUBY_ENGINE;$RUBY_VERSION;$?"'
  set -l IFS ";"

Not sure if ; is the best separator or if this might break for other setups though.

from chruby-fish.

JeanMertz avatar JeanMertz commented on June 7, 2024

@databus23 could you show me the following output in your Fish shell?

$ echo $PATH | tr ' ' ':'
$ string join ':' $PATH

I suspect the first problem was that you'd end up with a string like:

/sbin:/Applications/VMware:Fusion.app/Contents/Public

Now you should end up with:

/sbin:/Applications/VMware Fusion.app/Contents/Public

But now we're onto the second problem, as you described.

from chruby-fish.

databus23 avatar databus23 commented on June 7, 2024

I created a PR to track the discovered problems. I think it makes most sense to continue the discussion there now that we know the root cause of the problem.

from chruby-fish.

dwaite avatar dwaite commented on June 7, 2024

I manually applied this PR and it fixed my issue (also likely due to VMware Fusion)

from chruby-fish.

JeanMertz avatar JeanMertz commented on June 7, 2024

Thanks for the pR @databus23 and for the validation @dwaite. I no longer actively develop in Ruby, so I haven't used chruby-fish in a long time.

I'll reserve some time to merge the PR this weekend and do a new release. If that solves everything then πŸŽ‰, if not, I might consider looking for someone to take stewardship of the project.

I haven't heard any other complaints besides this one though, so hopefully when this is fixed, we'll have a smooth couple of years ahead of us πŸ˜„

from chruby-fish.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.