Skip to content

Fix IO#write frozen string issue in textmode#2593

Merged
enebo merged 1 commit intojruby:masterfrom
lumeet:file_text_mode
Feb 13, 2015
Merged

Fix IO#write frozen string issue in textmode#2593
enebo merged 1 commit intojruby:masterfrom
lumeet:file_text_mode

Conversation

@lumeet
Copy link
Contributor

@lumeet lumeet commented Feb 12, 2015

The bug affects write operations at least when Tempfile.create is
used in text mode. This patch aims to make IO#write consistent with
MRI's io_write.

I saw no test failing because of the patch. Neither could I find an obvious reason for str being dup'ed or frozen.

The bug is only present on master:

$ bin/jruby -e "require 'tempfile'; Tempfile.create('test', textmode: true) { |f| f.write 'x' }"
RuntimeError: can't modify frozen string
               write at org/jruby/RubyIO.java:1429
               write at org/jruby/RubyIO.java:1399

The bug affects write operations at least when Tempfile.create is
used in text mode. This patch aims to make IO#write consistent with
MRI's io_write.
enebo added a commit that referenced this pull request Feb 13, 2015
Fix IO#write frozen string issue in textmode. We will give it a whirl and see if something breaks.  If so we will have a test case we can add somewhere as a result.
@enebo enebo merged commit 20cd102 into jruby:master Feb 13, 2015
@enebo enebo added this to the 9.0.0.0.pre2 milestone Feb 13, 2015
@lumeet lumeet deleted the file_text_mode branch February 28, 2015 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants