[#121215] [Ruby master Bug#21166] Fiber Scheduler is unable to be interrupted by `IO#close`. — "ioquatix (Samuel Williams) via ruby-core" <ruby-core@...>

Issue #21166 has been reported by ioquatix (Samuel Williams).

13 messages 2025/03/02

[#121222] [Ruby master Bug#21167] Visual Studio 2022 17.13.x couldn't build ruby.exe — "hsbt (Hiroshi SHIBATA) via ruby-core" <ruby-core@...>

Issue #21167 has been reported by hsbt (Hiroshi SHIBATA).

8 messages 2025/03/03

[#121234] [Ruby master Bug#21168] Prism doesn't require argument parentheses (in some cases) when a block is present but parse.y does — "Earlopain (Earlopain _) via ruby-core" <ruby-core@...>

Issue #21168 has been reported by Earlopain (Earlopain _).

8 messages 2025/03/04

[#121389] [Ruby Bug#21187] Strings concatenated with `\` getting frozen with literal hashes (PRISM only) — LocoDelAssembly via ruby-core <ruby-core@...>

Issue #21187 has been reported by LocoDelAssembly (Hern=E1n Pereira).

12 messages 2025/03/17

[#121413] [Ruby Bug#21193] Inherited callback returns `nil` for `Object.const_source_location` — "eileencodes (Eileen Uchitelle) via ruby-core" <ruby-core@...>

Issue #21193 has been reported by eileencodes (Eileen Uchitelle).

15 messages 2025/03/20

[#121451] [Ruby Bug#21201] Performance regression when defining methods inside `refine` blocks — "alpaca-tc (Hiroyuki Ishii) via ruby-core" <ruby-core@...>

Issue #21201 has been reported by alpaca-tc (Hiroyuki Ishii).

8 messages 2025/03/27

[ruby-core:121384] [Ruby Bug#21131] IO.copy_stream: yielded string changes value when duped

From: "nagachika (Tomoyuki Chikanaga) via ruby-core" <ruby-core@...>
Date: 2025-03-16 12:22:23 UTC
List: ruby-core #121384
Issue #21131 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 3.1: REQUIRED, 3.2: DONE, 3.3: REQUIRED, 3.4: DONE to 3.1: REQUIRED, 3.2: DONE, 3.3: DONE, 3.4: DONE

ruby_3_3 commit:f85e5e01bafeca387e833b9d79cab43a8b22aa3d merged revision(s) commit:f423f6e10c0c226dfed98e7cb7a5d489191dfa35.

----------------------------------------
Bug #21131: IO.copy_stream: yielded string changes value when duped
https://bugs.ruby-lang.org/issues/21131#change-112355

* Author: chucke (Tiago Cardoso)
* Status: Closed
* ruby -v: ruby 3.4.1 (2024-12-25 revision 48d4efcb85) +PRISM [x86_64-darwin23]
* Backport: 3.1: REQUIRED, 3.2: DONE, 3.3: DONE, 3.4: DONE
----------------------------------------
I found an odd situation, when using IO.copy_stream with a File writer quack class, where the data passed to #write somehow ends overwritten, despite the instance being duped.

    class ProcIO
      def initialize(block)
        @block = block
      end
    
      # Implementation the IO write protocol, which yield the given chunk to +@block+.
      def write(data)
        @block.call(data.dup)
        data.bytesize
      end
    end
    
    rng = Random.new(42)
    body = Tempfile.new("ruby-bug", binmode: true)
    body.write(rng.bytes(16_385))
    body.rewind
    
    payload = []
    
    block = ->(data){ payload << data.dup }
    
    IO.copy_stream(body, ProcIO.new(block)) 
    
    body.rewind
    
    if payload.join != body.read
      puts "it's a bug"
    end


if you use the debugger, you'll see that the first yielded chunk has the correct bytes when yielded the first time, but when the second 1 byte chunk is yielded (IO.copy_stream reads in chunks of 16384 bytes), the first chunk string value suddenly changes. This should not happen, as the first yielded chunk was a string duped from the string yielded by IO.copy_stream (which is expected to be a buffer).



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/


In This Thread

Prev Next