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

JRuby 1.6.4 shims seem broken #76

Closed
jmazzi opened this Issue Sep 7, 2011 · 14 comments

Comments

Projects
None yet
2 participants
@jmazzi

jmazzi commented Sep 7, 2011

Looks likes it's trying to execute bundle as a bash script

➜  helix git:(develop) ✗ rbenv |&  head -n 1
rbenv 0.2.0-pre
➜  helix git:(develop) ✗ rbenv version       
jruby-1.6.4 (set by RBENV_VERSION environment variable)
➜  helix git:(develop) ✗ bundle
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 9: require: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 11: version: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: syntax error near unexpected token `('
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: `if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then'
➜  helix git:(develop) ✗ 
@jmazzi

This comment has been minimized.

Show comment
Hide comment
@jmazzi

jmazzi Sep 7, 2011

This might provide some insight http://twitter.com/headius/status/111179885497679873

"Perhaps rbenv doesn't properly handle the fact that (ba)sh scripts can't shebang to other (ba)sh scripts."

jmazzi commented Sep 7, 2011

This might provide some insight http://twitter.com/headius/status/111179885497679873

"Perhaps rbenv doesn't properly handle the fact that (ba)sh scripts can't shebang to other (ba)sh scripts."

@sstephenson

This comment has been minimized.

Show comment
Hide comment
@sstephenson

sstephenson Sep 7, 2011

Contributor

Seems to be working fine here:

~$ rbenv version
jruby-1.6.4 (set by RBENV_VERSION environment variable)
~$ ruby --version
jruby 1.6.4 (ruby-1.8.7-p330) (2011-08-23 17ea768) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [darwin-x86_64-java]
~$ gem install bundler
Fetching: bundler-1.0.18.gem (100%)
Successfully installed bundler-1.0.18
1 gem installed
~$ rbenv rehash
~$ bundle
Could not locate Gemfile
Contributor

sstephenson commented Sep 7, 2011

Seems to be working fine here:

~$ rbenv version
jruby-1.6.4 (set by RBENV_VERSION environment variable)
~$ ruby --version
jruby 1.6.4 (ruby-1.8.7-p330) (2011-08-23 17ea768) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_26) [darwin-x86_64-java]
~$ gem install bundler
Fetching: bundler-1.0.18.gem (100%)
Successfully installed bundler-1.0.18
1 gem installed
~$ rbenv rehash
~$ bundle
Could not locate Gemfile
@jmazzi

This comment has been minimized.

Show comment
Hide comment
@jmazzi

jmazzi Sep 7, 2011

Weird. When I execute it directly it works fine


➜  helix git:(develop) ✗ bundle          
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 9: require: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 11: version: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: syntax error near unexpected token `('
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: `if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then'
➜  helix git:(develop) ✗ exec -a bundle /Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle
Fetching source index for http://rubygems.org/

jmazzi commented Sep 7, 2011

Weird. When I execute it directly it works fine


➜  helix git:(develop) ✗ bundle          
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 9: require: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 11: version: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: syntax error near unexpected token `('
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: `if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then'
➜  helix git:(develop) ✗ exec -a bundle /Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle
Fetching source index for http://rubygems.org/
@jmazzi

This comment has been minimized.

Show comment
Hide comment
@jmazzi

jmazzi Sep 7, 2011

Well, it works fine in zsh. Here is what happens I startup a default bash session


bash-3.2$ export PATH=$PATH:$HOME/.rbenv/bin
bash-3.2$ eval "$(rbenv init -)"
bash-3.2$ export RBENV_VERSION=jruby-1.6.4
bash-3.2$ bundle
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 9: require: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 11: version: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: syntax error near unexpected token `('
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: `if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then'
bash-3.2$ exec -a bundle /Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 9: require: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 11: version: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: syntax error near unexpected token `('

jmazzi commented Sep 7, 2011

Well, it works fine in zsh. Here is what happens I startup a default bash session


bash-3.2$ export PATH=$PATH:$HOME/.rbenv/bin
bash-3.2$ eval "$(rbenv init -)"
bash-3.2$ export RBENV_VERSION=jruby-1.6.4
bash-3.2$ bundle
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 9: require: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 11: version: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: syntax error near unexpected token `('
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: `if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then'
bash-3.2$ exec -a bundle /Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 9: require: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 11: version: command not found
/Users/justin/.rbenv/versions/jruby-1.6.4/bin/bundle: line 13: syntax error near unexpected token `('

@jmazzi

This comment has been minimized.

Show comment
Hide comment
@jmazzi

jmazzi Sep 7, 2011

Does your bundle look like this?


bash-3.2$ which bundle
/Users/justin/.rbenv/shims/bundle
bash-3.2$ cat `which bundle`
#!/usr/bin/env bash
set -e
exec rbenv exec "${0##*/}" "$@"
bash-3.2$ 

jmazzi commented Sep 7, 2011

Does your bundle look like this?


bash-3.2$ which bundle
/Users/justin/.rbenv/shims/bundle
bash-3.2$ cat `which bundle`
#!/usr/bin/env bash
set -e
exec rbenv exec "${0##*/}" "$@"
bash-3.2$ 
@sstephenson

This comment has been minimized.

Show comment
Hide comment
@sstephenson

sstephenson Sep 7, 2011

Contributor

Yes, my bundle looks the same. I'm using bash, not zsh.

~$ $SHELL --version
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)
Copyright (C) 2007 Free Software Foundation, Inc.
Contributor

sstephenson commented Sep 7, 2011

Yes, my bundle looks the same. I'm using bash, not zsh.

~$ $SHELL --version
GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)
Copyright (C) 2007 Free Software Foundation, Inc.
@jmazzi

This comment has been minimized.

Show comment
Hide comment
@jmazzi

jmazzi Sep 7, 2011

RVM had this issue too, a while back https://gist.github.com/842807. Still investigating.

jmazzi commented Sep 7, 2011

RVM had this issue too, a while back https://gist.github.com/842807. Still investigating.

@jmazzi

This comment has been minimized.

Show comment
Hide comment
@jmazzi

jmazzi Sep 7, 2011

Changing the shebang to #!/usr/bin/env /Users/justin/.rbenv/versions/jruby-1.6.4/bin/jruby fixes this problem for me.

Interestingly enough, /Users/justin/.rbenv/versions/jruby-1.6.4/bin/jruby itself is also a bash script. I bet if this was a binary file it would work fine.

jmazzi commented Sep 7, 2011

Changing the shebang to #!/usr/bin/env /Users/justin/.rbenv/versions/jruby-1.6.4/bin/jruby fixes this problem for me.

Interestingly enough, /Users/justin/.rbenv/versions/jruby-1.6.4/bin/jruby itself is also a bash script. I bet if this was a binary file it would work fine.

@sstephenson

This comment has been minimized.

Show comment
Hide comment
@sstephenson

sstephenson Sep 7, 2011

Contributor

I'd like to figure out why it works for me but not you.

Contributor

sstephenson commented Sep 7, 2011

I'd like to figure out why it works for me but not you.

@jmazzi

This comment has been minimized.

Show comment
Hide comment
@jmazzi

jmazzi Sep 7, 2011

Is your /Users/justin/.rbenv/versions/jruby-1.6.4/bin/jruby a binary file or a bash script?

jmazzi commented Sep 7, 2011

Is your /Users/justin/.rbenv/versions/jruby-1.6.4/bin/jruby a binary file or a bash script?

@sstephenson

This comment has been minimized.

Show comment
Hide comment
@sstephenson

sstephenson Sep 7, 2011

Contributor
~$ head -n 1 ~/.rbenv/versions/jruby-1.6.4/bin/jruby
#!/usr/bin/env bash
Contributor

sstephenson commented Sep 7, 2011

~$ head -n 1 ~/.rbenv/versions/jruby-1.6.4/bin/jruby
#!/usr/bin/env bash
@jmazzi

This comment has been minimized.

Show comment
Hide comment
@jmazzi

jmazzi Sep 7, 2011

Do you have any suggestions or things to try?

jmazzi commented Sep 7, 2011

Do you have any suggestions or things to try?

@jmazzi

This comment has been minimized.

Show comment
Hide comment
@jmazzi

jmazzi Sep 7, 2011

rm -f ~/.rbenv/shims/* && rbenv rehash fixed it for me. Previous to running this I ran rbenv rehash multiple times without any improvement.

I suppose it's possible that the ruby-build PREFIX bug yesterday could have caused some weirdness with my shims.

jmazzi commented Sep 7, 2011

rm -f ~/.rbenv/shims/* && rbenv rehash fixed it for me. Previous to running this I ran rbenv rehash multiple times without any improvement.

I suppose it's possible that the ruby-build PREFIX bug yesterday could have caused some weirdness with my shims.

@jmazzi jmazzi closed this Sep 7, 2011

@sstephenson

This comment has been minimized.

Show comment
Hide comment
@sstephenson

sstephenson Sep 7, 2011

Contributor

Weird. Glad you were able to fix it though. Thanks for helping me debug.

Contributor

sstephenson commented Sep 7, 2011

Weird. Glad you were able to fix it though. Thanks for helping me debug.

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