Dir#pos= dies if negative value provided
----------------------------------------

                 Key: JRUBY-5640
                 URL: http://jira.codehaus.org/browse/JRUBY-5640
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.6
         Environment: jruby 1.6.0 (ruby 1.8.7 patchlevel 330) (2011-03-15 
f3b6154) (OpenJDK Client VM 1.6.0_20) [linux-i386-java]
            Reporter: Daniel Berger
            Priority: Minor
         Attachments: test_pos_set.rb

In MRI the Dir#pos= method accepts a negative value. It's effectively a no-op 
if a read has not occurred yet, or returns nil if at least one read has already 
occurred, which I assume moves the pointer to the end of the stream. The 
behavior is curious, and I suspect it's driven by the rules of the underlying 
seekdir() function, though I haven't thoroughly scoured the source, and the man 
page for seekdir() made no mention of negative values.

JRuby fails with an Java::JavaLang::ArrayIndexOutOfBoundsException.

I've attached the test suite I'm using for berger_spec.

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