Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 120890 - /usr/bin/ruby18_with_gems is not a binary file
Summary: /usr/bin/ruby18_with_gems is not a binary file
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Ruby Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-29 17:31 UTC by Christoph Bussenius
Modified: 2006-02-22 10:58 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Bussenius 2006-01-29 17:31:57 UTC
I emerged rubygems and ran 'ruby-config ruby18_with_gems'.  Now /usr/bin/ruby is a symlink to /usr/bin/ruby18_with_gems.  This file contains only one line:
RUBYOPT="-rubygems" /usr/bin/ruby18 "$@"

It has not even "#!/bin/bash" at the beginning.

This works as long as you start ruby out of a shell as in 'ruby my_script.rb', because bash will treat /usr/bin/ruby as a shell script.  But if you start it e. g. out of strace (as in strace ruby -e 'puts "hello"'), you will get something like

execve("/usr/bin/ruby", ["ruby", "-e", "puts \"hello\""], [/* 63 vars */]) = -1 ENOEXEC (Exec format error)

Worse, you cannot use ruby in a she-bang:

pepe@cyan /tmp $ cat > test.rb
#!/usr/bin/ruby
puts 'hello'
pepe@cyan /tmp $ chmod 755 test.rb
pepe@cyan /tmp $ ./test.rb 
./test.rb: line 2: puts: command not found


To be used in a she-bang, /usr/bin/ruby has to be a binary program.
Comment 1 Christoph Bussenius 2006-01-29 17:36:10 UTC
I suggest that RUBYOPT=-rubygems be set in /etc/env.d
Comment 2 Caleb Tennis (RETIRED) gentoo-dev 2006-01-30 04:57:07 UTC
We tried it as an environment variable and it fails miserably, unfortunately.

This was the best solution.

I'll put a shebang in the ruby_with_gems script, but I think the easiest solution is to simply use #!/usr/bin/ruby18 in your ruby scripts.
Comment 3 Caleb Tennis (RETIRED) gentoo-dev 2006-02-22 10:58:32 UTC
Okay, I've just committed a new rubygems that gets away from using ruby18_with_gems.  Please go back to ruby18 with ruby-config, and after an uprade I think all will be well again.