StringIO doesn't work with frozen strings in 1.7.5.dev #1008

Closed
bensummers opened this Issue Sep 12, 2013 · 3 comments

Projects

None yet

3 participants

@bensummers

Regression from 1.7.4. Here's a short script:

require 'stringio'
str = "Hello".freeze
p StringIO.new(str).read

Running with 1.7.4 and 1.7.5:

$ jruby -v test/stringio_test_case.rb 
jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on Java HotSpot(TM) Server VM 1.7.0_25-b15 [SunOS-x86]
"Hello"

$ jruby -v test/stringio_test_case.rb 
jruby 1.7.5.dev (1.9.3p392) 2013-09-12 77a0453 on Java HotSpot(TM) Server VM 1.7.0_25-b15 [SunOS-x86]
IOError: not modifiable string
    read at org/jruby/ext/stringio/RubyStringIO.java:1002
  (root) at test/stringio_test_case.rb:3

I found this by trying to parse frozen strings with REXML.

@BanzaiMan
Member

Our check now includes one for frozenness, which didn't exist before… e14ea63 but I don't think the logic is quite right. https://github.com/ruby/ruby/blob/v1_9_3_448/ext/stringio/stringio.c#L167-L206

@bensummers

Is this one worth fixing in 1.7.5?

@headius
Member
headius commented Sep 13, 2013

Will fix.

@headius headius closed this in 6e4c3d3 Sep 13, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment