Calling realpath on Solaris symlink causes NPE
----------------------------------------------

                 Key: JRUBY-2155
                 URL: http://jira.codehaus.org/browse/JRUBY-2155
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1RC2
         Environment: Solaris
            Reporter: Rod Cope
            Priority: Blocker
             Fix For: JRuby 1.1


Looks like RubyFile.readlink blows up on Solaris.  This same code works fine on 
various flavors of Windows and Linux and on Solaris with MRI.  The issue may be 
resolved when JRUBY-1889 is implemented, but I don't think it should NPE in any 
case.

I'd like to make a special request to have this fixed quickly as we're planning 
to release a private beta of the Open Source Census (osscensus.org) by Monday, 
February 25.  I really want to use JRuby for a number of reasons, but will have 
to fall back to Ruby for our Solaris distribution until this issue is resolved. 
 Thanks for your consideration.

-------------------

Details:

1) Environment stuff:

'java -version' returns:
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03) Java 
HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)


'uname -a' returns:
SunOS sundev1 5.10 Generic_118833-33 sun4u sparc SUNW,Sun-Blade-1000


2) Doing an 'ls -l' in the directory '/home/tester/tmp/jruby-npe-test' shows 
this:

total 2
-rw-r--r--   1 tester   other          0 Feb 19 15:02 a_file
lrwxrwxrwx   1 tester   other         38 Feb 19 15:04 a_link_to_file -> 
/home/tester/tmp/jruby-npe-test/a_file


3) The contents of the file '/home/tester/jruby_solaris_symlink_bug.rb' are:

require 'pathname'

symlink_path = "/home/tester/tmp/jruby-npe-test/a_link_to_file"
puts "symlink_path = '#{symlink_path}'"
val_pathname = Pathname.new(symlink_path) 
puts "val_pathname = '#{val_pathname}'"
val_realpath = val_pathname.realpath
puts "val_realpath = '#{val_realpath}'"


4) Running this command '/home/tester/jruby-1.1RC2/bin/jruby 
/home/tester/jruby_solaris_symlink_bug.rb' produces the following output:

symlink_path = '/home/tester/tmp/jruby-npe-test/a_link_to_file'
val_pathname = '/home/tester/tmp/jruby-npe-test/a_link_to_file'
Exception in thread "main" java.lang.NullPointerException
        at org.jruby.util.ByteList.plain(ByteList.java:683)
        at org.jruby.RubyString.<init>(RubyString.java:127)
        at org.jruby.RubyString.newString(RubyString.java:499)
        at org.jruby.Ruby.newString(Ruby.java:2106)
        at org.jruby.RubyFile.readlink(RubyFile.java:1404)
        at org.jruby.RubyFileInvoker$readlink_method_1_0.call(Unknown Source)
        at 
org.jruby.internal.runtime.methods.JavaMethod$JavaMethodOne.call(JavaMethod.java:120)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:166)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:301)
        at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:657)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
        at 
org.jruby.evaluator.ASTInterpreter.setupArgs(ASTInterpreter.java:2155)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1095)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:354)
        at 
org.jruby.evaluator.ASTInterpreter.toAryNode(ASTInterpreter.java:1681)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:474)
        at 
org.jruby.evaluator.ASTInterpreter.multipleAsgnNode(ASTInterpreter.java:1329)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:399)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at 
org.jruby.evaluator.ASTInterpreter.untilNode(ASTInterpreter.java:1711)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:480)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:166)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:301)
        at 
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1100)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:354)
        at 
org.jruby.evaluator.ASTInterpreter.toAryNode(ASTInterpreter.java:1681)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:474)
        at 
org.jruby.evaluator.ASTInterpreter.multipleAsgnNode(ASTInterpreter.java:1329)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:399)
        at org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
        at 
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:302)
        at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:168)
        at 
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:176)
        at 
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:70)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:181)
        at 
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:329)
        at 
ruby.home.tester.jruby_solaris_symlink_bug.__file__(/home/tester/jruby_solaris_symlink_bug.rb:7)
        at 
ruby.home.tester.jruby_solaris_symlink_bug.load(/home/tester/jruby_solaris_symlink_bug.rb)
        at org.jruby.Ruby.runScript(Ruby.java:491)
        at org.jruby.Ruby.runNormally(Ruby.java:411)
        at org.jruby.Ruby.runFromMain(Ruby.java:291)
        at org.jruby.Main.run(Main.java:142)
        at org.jruby.Main.run(Main.java:88)
        at org.jruby.Main.main(Main.java:79)



-- 
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