FileTest module not compliant with MRI when given filename is empty
-------------------------------------------------------------------

                 Key: JRUBY-1363
                 URL: http://jira.codehaus.org/browse/JRUBY-1363
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.0.2
         Environment: Linux 2.6, JRuby from trunk (r4329) compared against MRI 
1.8.6
            Reporter: Luke Monahan
         Attachments: fix-file-test-with-empty-filename.diff

The behaviour of methods in the FileTest module are inconsistent with the 
behaviour within the MRI when the filename is empty.

Example:

{{FileTest.exists?("")}}

returns {{false}} in MRI, but {{true}} in JRuby.

Ultimately comes from the fact that canonical filenames are used in 
{{src/org/jruby/util/JRubyFile.java}} which causes an empty filename to be 
interpreted as the current working directory.

Attached is a fairly naive patch that intercepts empty pathnames in 
{{JRubyFile.create}} and processes differently, but I have no idea whether this 
has flow on effects (all tests pass correctly).  Also included are extra tests 
in {{test/testFileTest.rb}} for this.  Patch is against r4329.

Note: Found this whilst running Rails Edge under JRuby, and is the reason why 
there may be problems finding rjs and possibly other templates as the routing 
code makes use of {{FileTest.exists?}} with the expectation of correct 
behaviour for an empty filename.

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