Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rindex() fails on strings read from binary files #2784

Closed
e2 opened this issue Mar 30, 2015 · 2 comments
Closed

rindex() fails on strings read from binary files #2784

e2 opened this issue Mar 30, 2015 · 2 comments

Comments

@e2
Copy link

e2 commented Mar 30, 2015

Fails on jruby-head, works on jruby-1.7.19

IO.write("data", ":/c")

data = File.open("data", "rb").readlines.first.split(':').last     # => "/c"

result = data.rindex("c")   # => should be 1, but is nil on jruby-head

fail "expected 1, got: #{result.inspect}" unless result == 1

Expected: no failure
Actual: failure on jruby-head (because rindex returns nil)

JRuby: jruby 9.0.0.0-SNAPSHOT (2.2.1) 2015-03-30 8d7c1b1 OpenJDK 64-Bit Server VM 24.75-b04 on 1.7.0_75-b13 +jit [linux-amd64]

@headius
Copy link
Member

headius commented Apr 2, 2015

Appears to work after my recent encoding fixes, which included a rewrite (ported from MRI) of String#rindex. We'll call this fixed, but please test updated jruby-head and let us know if you see any further issues.

@headius headius closed this as completed Apr 2, 2015
@headius headius added this to the 9.0.0.0.pre2 milestone Apr 2, 2015
@e2
Copy link
Author

e2 commented Apr 2, 2015

Sure - will do. And thanks so much @headius for all your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants