JRuby

If 'jruby' executable is a relative symlink, JRuby won't start

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.1.6
  • Fix Version/s: JRuby 1.2
  • Component/s: Miscellaneous
  • Labels:
    None
  • Environment:
    Mac OS X 10.5.6, but likely affects all Un*x-derived platforms
  • Patch Submitted:
    Yes
  • Number of attachments :
    1

Description

If the 'jruby' executable in your PATH is actually a symlink with a relative (not absolute) path to the real 'jruby' shell script, then the real 'jruby' shell script calculates JRUBY_HOME incorrectly and JRuby will, in general, refuse to start. (It incorrectly treats the symlink as relative to the current directory; relative symlinks are of course relative to the directory that they're in.)

Because the 'jruby' shell script ignores any setting of JRUBY_HOME in your environment, it does not seem possible to override this.

Steps to reproduce – apologies; I couldn't see any place to put this kind of test in the test suite:

(make sure there is no 'jruby' in your PATH)
tar zxf jruby-1.1.6-bin.tar.gz
mkdir mylink && cd mylink
ln -s ../jruby-1.1.6/bin/jruby .
cd ..
mylink/jruby -e 'puts "hello, world"'
--> Exception in thread "main" java.lang.NoClassDefFoundError: org/jruby/Main

The attached patch corrects this issue; it checks to see if the symlink is relative, and, if so, prepends the directory that the symlink is in.

Activity

Hide
Charles Oliver Nutter added a comment -

Applied, thanks!

Show
Charles Oliver Nutter added a comment - Applied, thanks!

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: