jruby doesn't startup correctly with absolute path in shebang line, problem 
shows up when using rvm to copy gemsets
-------------------------------------------------------------------------------------------------------------------

                 Key: JRUBY-5031
                 URL: http://jira.codehaus.org/browse/JRUBY-5031
             Project: JRuby
          Issue Type: Bug
          Components: Launcher
    Affects Versions: JRuby 1.5.1
         Environment: Mac OS X 10.6.4
            Reporter: Stephen Bannasch
            Assignee: Thomas E Enebo


When the shebang line in a ruby executable uses an absolute path to the JRuby 
executable the command only operates when prefixed with 'jruby -S'.

Here's a very simple RakeFile:

{code}
[jruby-bug]$ ls -l
total 8
-rw-r--r--  1 stephen  staff  67 Aug 22 13:53 RakeFile

[jruby-bug]$ cat RakeFile 
desc 'list files in this directory'
task :ls do
  puts Dir['*']
end

[jruby-bug]$ rake ls
(in /Users/stephen/dev/test/jruby-bug)
RakeFile
{code}

I have jruby 1.5.1 and 1.5.2 installed with rvm. I'll remove and reinstall 
jruby-1.5.2.

{code}
[jruby-bug]$ rvm list

rvm rubies

   jruby-1.5.1 [ x86_64-java ]
   jruby-1.5.2 [ x86_64-java ]
   jruby-head [ x86_64-java ]
   rbx-1.0.1-20100603 [ x86_64 ]
   ree-1.8.7-2010.02 [ x86_64 ]
   ruby-1.8.7-head [ i386 ]
   ruby-1.8.7-p248 [ i386 ]
   ruby-1.8.7-p249 [ i386 ]
   ruby-1.8.7-p299 [ x86_64 ]
   ruby-1.9.1-p378 [ x86_64 ]
   ruby-1.9.2-head [ x86_64 ]
   ruby-1.9.2-p0 [ x86_64 ]

[jruby-bug]$ rvm remove jruby-1.5.2

info: Removing /Users/stephen/.rvm/src/jruby-1.5.2...

info: Removing /Users/stephen/.rvm/rubies/jruby-1.5.2...

info: Removing jruby-1.5.2 aliases...

info: Removing jruby-1.5.2 wrappers...

info: Removing jruby-1.5.2 environments...

info: Removing jruby-1.5.2 binaries...

[jruby-bug]$ rvm install jruby

info: Extracting jruby-bin-1.5.2 ...

info: Building Nailgun

info: Installing JRuby to /Users/stephen/.rvm/rubies/jruby-1.5.2

info: Importing initial gems...

info: Installing rake

info: Installing jruby-openssl
{code}

When JRuby installs rake it uses 'env' in the shebang:

{code}
[jruby-bug]$ rvm use jruby

info: Using jruby 1.5.2

[jruby-bug]$ which rake
/Users/stephen/.rvm/gems/jruby-1.5.2/bin/rake

[jruby-bug]$ head -1 /Users/stephen/.rvm/gems/jruby-1.5.2/bin/rake
#!/usr/bin/env jruby
{code}

I can use either 'rake' or jruby -S rake' when using jruby-1.5.2 installed by 
RVM

{code}
[jruby-bug]$ rake ls
(in /Users/stephen/dev/test/jruby-bug)
RakeFile

[jruby-bug]$ jruby -S rake ls
(in /Users/stephen/dev/test/jruby-bug)
RakeFile
{code}

When I use rvm to copy my gemset from jruby-1.5.1 to jruby 1.5.2 the shebang 
lines are changed
to use an absolute path to the jruby executable:

{code}
[jruby-bug]$ rvm gemset copy jruby-1.5.1 jruby-1.5.2

info: Copying gemset from jruby-1.5.1 to jruby-1.5.2

info: Making gemset for jruby-1.5.2 pristine.

[jruby-bug]$ head -1 /Users/stephen/.rvm/gems/jruby-1.5.2/bin/rake
#!/Users/stephen/.rvm/rubies/jruby-1.5.2/bin/jruby
{code}

Using 'rake' no longer works but 'jruby -S rake' still works:

{code}
[jruby-bug]$ rake ls
/Users/stephen/.rvm/gems/jruby-1.5.2/bin/rake: line 9: require: command not 
found
/Users/stephen/.rvm/gems/jruby-1.5.2/bin/rake: line 11: version: command not 
found
/Users/stephen/.rvm/gems/jruby-1.5.2/bin/rake: line 13: syntax error near 
unexpected token `('
/Users/stephen/.rvm/gems/jruby-1.5.2/bin/rake: line 13: `if ARGV.first =~ 
/^_(.*)_$/ and Gem::Version.correct? $1 then'

[jruby-bug]$ jruby -S rake ls
(in /Users/stephen/dev/test/jruby-bug)
RakeFile
{code}


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to