jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • JRuby
  • JRUBY-1144

rails script shebang line causes incorrect interpretation

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.0.0
  • Fix Version/s: JRuby 1.1b1
  • Component/s: None
  • Labels:
    None
  • Environment:
    Hide
    > uname -a
    Linux caffe.sfbay.sun.com 2.6.20-1.2952.fc6 #1 SMP Wed May 16 18:18:22 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux
    > java -version
    java version "1.6.0_01"
    Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
    Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_01-b06, mixed mode)
    > rails --version
    Rails 1.2.3
    Show
    > uname -a Linux caffe.sfbay.sun.com 2.6.20-1.2952.fc6 #1 SMP Wed May 16 18:18:22 EDT 2007 x86_64 x86_64 x86_64 GNU/Linux > java -version java version "1.6.0_01" Java(TM) SE Runtime Environment (build 1.6.0_01-b06) Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_01-b06, mixed mode) > rails --version Rails 1.2.3

Description

After installing the rails gems and fixing the executable's permissions, when I try to create a new Rails app, the script fails with what appears to be an issue of how the script is interpreted.

> rails test
/opt/jruby-1.0/bin/rails: line 9: require: command not found
/opt/jruby-1.0/bin/rails: line 10: version: command not found
/opt/jruby-1.0/bin/rails: line 11: syntax error near unexpected token `('
/opt/jruby-1.0/bin/rails: line 11: `if ARGV.first =~ /^(.*)$/ and Gem::Version.correct? $1 then'

If I change the first line of the rails script to "#!/usr/bin/env jruby" (like the gem script) then it works fine, and it creates the test application. As with the rails executable permissions bug I reported earlier, I'm not sure where the problem lies, but I know this does not happen with the native Ruby interpreter.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Nick Sieger added a comment - 14/Jun/07 1:33 PM

What was the original shebang line in the rails bin-script before you changed it?

Show
Nick Sieger added a comment - 14/Jun/07 1:33 PM What was the original shebang line in the rails bin-script before you changed it?
Hide
Permalink
Nathan Fiedler added a comment - 14/Jun/07 7:00 PM

It was this: #!/opt/jruby-1.0/bin/jruby

Show
Nathan Fiedler added a comment - 14/Jun/07 7:00 PM It was this: #!/opt/jruby-1.0/bin/jruby
Hide
Permalink
Shane Witbeck added a comment - 12/Jul/07 11:48 PM

I had a similar issue before I realized I didn't have ruby in my PATH env variable. The difference was that I got the same exception just trying to run rails --version

Show
Shane Witbeck added a comment - 12/Jul/07 11:48 PM I had a similar issue before I realized I didn't have ruby in my PATH env variable. The difference was that I got the same exception just trying to run rails --version
Hide
Permalink
Charles Oliver Nutter added a comment - 22/Oct/07 12:40 AM

The shebang issue with installed gems has been fixed on 1.0 branch and trunk already; that caused this issue, I believe.

Show
Charles Oliver Nutter added a comment - 22/Oct/07 12:40 AM The shebang issue with installed gems has been fixed on 1.0 branch and trunk already; that caused this issue, I believe.
Hide
Permalink
Matt Nish-Lapidus added a comment - 08/Nov/07 8:22 PM

I'm having this exact issue with 1.0.2, just downloaded and installed from scratch this evening. (ruby 1.8.5 (2007-11-01 rev 4810) [i386-jruby1.0.2])

Changing the first first line of the rails script from #Unable to render embedded object: File (/usr/local/jruby-1.0.2/bin/jruby to #) not found./usr/bin/env jruby as the initial post suggested fixed the problem.

Show
Matt Nish-Lapidus added a comment - 08/Nov/07 8:22 PM I'm having this exact issue with 1.0.2, just downloaded and installed from scratch this evening. (ruby 1.8.5 (2007-11-01 rev 4810) [i386-jruby1.0.2]) Changing the first first line of the rails script from #Unable to render embedded object: File (/usr/local/jruby-1.0.2/bin/jruby to #) not found./usr/bin/env jruby as the initial post suggested fixed the problem.
Hide
Permalink
Kaj Hejer added a comment - 26/Dec/07 8:31 AM

I had the same issue with ruby 1.8.5 (2007-12-15 rev 5200) [i386-jruby1.0.3]

I found a fix on http://ashishwave.wordpress.com/category/ruby/ which was method 2 described on this page (method did not help). I changed the first line in $JRUBY_HOME/bin/rails to "#!/usr/bin/env jruby"

Show
Kaj Hejer added a comment - 26/Dec/07 8:31 AM I had the same issue with ruby 1.8.5 (2007-12-15 rev 5200) [i386-jruby1.0.3] I found a fix on http://ashishwave.wordpress.com/category/ruby/ which was method 2 described on this page (method did not help). I changed the first line in $JRUBY_HOME/bin/rails to "#!/usr/bin/env jruby"
Hide
Permalink
Charles Oliver Nutter added a comment - 26/Dec/07 1:47 PM

This was still broken on 1.0 branch....reopening.

Show
Charles Oliver Nutter added a comment - 26/Dec/07 1:47 PM This was still broken on 1.0 branch....reopening.
Hide
Permalink
Charles Oliver Nutter added a comment - 26/Dec/07 1:47 PM

This is already fixed on trunk, and I just fixed it on 1.0 branch (finally, correctly) in commit 5369.

Show
Charles Oliver Nutter added a comment - 26/Dec/07 1:47 PM This is already fixed on trunk, and I just fixed it on 1.0 branch (finally, correctly) in commit 5369.
Hide
Permalink
Charles Lowell added a comment - 16/Nov/09 11:27 AM

I'm experiencing something similar with jruby 1.4 using bundler. None of the scripts created by bundler will run, but if I change the shebang line to #!/usr/bin/env jruby they work just fine.

I don't know if this is a bug in jruby, or bundler.

legolas:Awacs cowboyd$ jruby -v
jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-05 6586) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [x86_64-java]
legolas:Awacs cowboyd$ bin/buildr
bin/buildr: line 2: syntax error near unexpected token `('
bin/buildr: line 2: `require File.join(File.dirname(_FILE_), "../vendor/bundler_gems/environment")'
legolas:Awacs cowboyd$ cat bin/buildr
#!/Users/cowboyd/Development/JRuby/Current/bin/jruby
require File.join(File.dirname(_FILE_), "../vendor/bundler_gems/environment")
load File.join(File.dirname(_FILE_), "../vendor/bundler_gems/gems/buildr-1.3.0-java/bin/buildr")

Show
Charles Lowell added a comment - 16/Nov/09 11:27 AM I'm experiencing something similar with jruby 1.4 using bundler. None of the scripts created by bundler will run, but if I change the shebang line to #!/usr/bin/env jruby they work just fine. I don't know if this is a bug in jruby, or bundler. legolas:Awacs cowboyd$ jruby -v jruby 1.4.0 (ruby 1.8.7 patchlevel 174) (2009-11-05 6586) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_15) [x86_64-java] legolas:Awacs cowboyd$ bin/buildr bin/buildr: line 2: syntax error near unexpected token `(' bin/buildr: line 2: `require File.join(File.dirname(_FILE_), "../vendor/bundler_gems/environment")' legolas:Awacs cowboyd$ cat bin/buildr #!/Users/cowboyd/Development/JRuby/Current/bin/jruby require File.join(File.dirname(_FILE_), "../vendor/bundler_gems/environment") load File.join(File.dirname(_FILE_), "../vendor/bundler_gems/gems/buildr-1.3.0-java/bin/buildr")
Hide
Permalink
Charles Lowell added a comment - 17/Nov/09 10:49 AM

Also, is jruby still using this instance of Jira?

Show
Charles Lowell added a comment - 17/Nov/09 10:49 AM Also, is jruby still using this instance of Jira?

People

  • Assignee:
    Charles Oliver Nutter
    Reporter:
    Nathan Fiedler
Vote (1)
Watch (3)

Dates

  • Created:
    14/Jun/07 12:57 PM
    Updated:
    17/Nov/09 10:49 AM
    Resolved:
    26/Dec/07 1:47 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.