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

Dir[] results in NPE depending on permissions

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.1.4
  • Fix Version/s: JRuby 1.2
  • Component/s: Core Classes/Modules
  • Labels:
    None
  • Environment:
    Solaris 10, JRuby 1.1.4

Description

This simple script on Solaris 10 demonstrates the problem:

Dir["/proc/0/path/*"] # jtest.rb

The /proc/0 directory, and all files in it, are owned by root. If I try to read that file as a non-root user I get this:

>jruby jtest.rb 
org.jruby.util.Dir:535:in `files': java.lang.NullPointerException
        from org.jruby.util.Dir:654:in `glob_helper'
        from org.jruby.util.Dir:451:in `push_globs'
        from org.jruby.util.Dir:425:in `push_braces'
        from org.jruby.util.Dir:304:in `push_glob'
        from org.jruby.RubyDir:165:in `aref'
        from org.jruby.RubyDir$s_method_0_0$RUBYINVOKER$aref:-1:in `call'
        from org.jruby.internal.runtime.methods.JavaMethod$JavaMethodNoBlock:62:in `call'
        from org.jruby.internal.runtime.methods.DynamicMethod:242:in `call'
        from org.jruby.internal.runtime.methods.DynamicMethod:151:in `call'
        from org.jruby.runtime.CallSite$InlineCachingCallSite:156:in `cacheAndCall'
        from org.jruby.runtime.CallSite$InlineCachingCallSite:394:in `call'
        from jtest:1:in `__file__'
        from jtest:-1:in `__file__'
        from jtest:-1:in `load'
        from org.jruby.Ruby:544:in `runScript'
        from org.jruby.Ruby:457:in `runNormally'
        from org.jruby.Ruby:330:in `runFromMain'
        from org.jruby.Main:214:in `run'
        from org.jruby.Main:100:in `run'
        from org.jruby.Main:84:in `main'

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Daniel Berger added a comment - 12/Sep/08 9:17 PM

BTW, MRI's behavior is to just return an empty array.

Show
Daniel Berger added a comment - 12/Sep/08 9:17 PM BTW, MRI's behavior is to just return an empty array.
Hide
Permalink
Charles Oliver Nutter added a comment - 12/Sep/08 9:47 PM

Fixed in r7686. Keeping open pending specs.

Show
Charles Oliver Nutter added a comment - 12/Sep/08 9:47 PM Fixed in r7686. Keeping open pending specs.
Hide
Permalink
Charles Oliver Nutter added a comment - 09/Feb/09 1:39 PM

Spec added in RubySpec@6a8da84.

Show
Charles Oliver Nutter added a comment - 09/Feb/09 1:39 PM Spec added in RubySpec@6a8da84.

People

  • Assignee:
    Charles Oliver Nutter
    Reporter:
    Daniel Berger
Vote (0)
Watch (1)

Dates

  • Created:
    12/Sep/08 5:09 PM
    Updated:
    21/Mar/09 1:14 PM
    Resolved:
    09/Feb/09 1:39 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.