Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 08df7ae103ac
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 50c5434b3a59
Choose a head ref
  • 2 commits
  • 2 files changed
  • 2 contributors

Commits on Nov 7, 2014

  1. Fix ruby-bug 8625 and ruby-bug 9847

    Bug 9847 caused backing strings to be erroneously re-used when reading via IO
    Bug 8625 caused buffers to be errouneously sized, resulting in data loss
    
    Both patches are effectively direct ports of the MRI fixes
    cheald committed Nov 7, 2014
    Copy the full SHA
    5145b47 View commit details
  2. Merge pull request #2138 from cheald/fix_io_buffers

    Fix ruby-bug 8625 and ruby-bug 9847
    headius committed Nov 7, 2014
    Copy the full SHA
    50c5434 View commit details
Showing with 6 additions and 5 deletions.
  1. +5 −1 core/src/main/java/org/jruby/RubyIO.java
  2. +1 −4 core/src/main/java/org/jruby/util/io/EncodingUtils.java
6 changes: 5 additions & 1 deletion core/src/main/java/org/jruby/RubyIO.java
Original file line number Diff line number Diff line change
@@ -2972,7 +2972,10 @@ public IRubyObject read(ThreadContext context, IRubyObject length, IRubyObject s
boolean locked = fptr.lock();
try {
fptr.checkByteReadable(context);
if (len == 0) return str;
if (len == 0) {
((RubyString)str).setReadLength(0);
return str;
}

fptr.READ_CHECK(context);
// #if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
@@ -2982,6 +2985,7 @@ public IRubyObject read(ThreadContext context, IRubyObject length, IRubyObject s
} finally {
if (locked) fptr.unlock();
}

((RubyString)str).setReadLength(n);
// #if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
// if (previous_mode == O_TEXT) {
5 changes: 1 addition & 4 deletions core/src/main/java/org/jruby/util/io/EncodingUtils.java
Original file line number Diff line number Diff line change
@@ -1072,10 +1072,7 @@ public static IRubyObject setStrBuf(Ruby runtime, IRubyObject str, int len) {
RubyString s = str.convertToString();
int clen = s.size();
if (clen >= len) {
if (clen != len) {
s.modify();
s.getByteList().setRealSize(len);
}
s.modify();
return s;
}
str = s;