[ruby-core:112098] [Ruby master Bug#19389] StringIO gets(..., chomp: true) behaves differently to File/IO.

Issue #19389 has been reported by ioquatix (Samuel Williams). ---------------------------------------- Bug #19389: StringIO gets(..., chomp: true) behaves differently to File/IO. https://bugs.ruby-lang.org/issues/19389 * Author: ioquatix (Samuel Williams) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- It seems like `StringIO` and `File` `#gets(..., chomp: true)` have different behaviour. ``` irb(main):003:0> io = StringIO.new("foo\r\nbar\r\n\r\n") => #<StringIO:0x00000001077e2018> irb(main):004:0> io.gets("\r\n", chomp: true) => "foo" irb(main):005:0> io.gets("\r\n", chomp: true) => "bar" irb(main):006:0> io.gets("\r\n", chomp: true) => "\r\n" ``` compared with File: ``` irb(main):008:0> io = Tempfile.new => #<File:/var/folders/cm/p8lkj40s0vz_vgx_b5df9dkm0000gn/T/20230128-37714-107ims> irb(main):009:0> io.write("foo\r\nbar\r\n\r\n") => 12 irb(main):012:0> io.rewind => 0 irb(main):013:0> io.gets("\r\n", chomp: true) => "foo" irb(main):014:0> io.gets("\r\n", chomp: true) => "bar" irb(main):015:0> io.gets("\r\n", chomp: true) => "" ``` -- https://bugs.ruby-lang.org/

Issue #19389 has been updated by naruse (Yui NARUSE). Backport changed from 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: REQUIRED to 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE ruby_3_2 1689d8bb4843f92c1805e4a4bdd94049569198f4 merged revision(s) 21dced8b01823a991829b66ffdc8ffc635965c76. ---------------------------------------- Bug #19389: StringIO gets(..., chomp: true) behaves differently to File/IO. https://bugs.ruby-lang.org/issues/19389#change-101565 * Author: ioquatix (Samuel Williams) * Status: Closed * Priority: Normal * Backport: 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE ---------------------------------------- It seems like `StringIO` and `File` `#gets(..., chomp: true)` have different behaviour. ``` irb(main):003:0> io = StringIO.new("foo\r\nbar\r\n\r\n") => #<StringIO:0x00000001077e2018> irb(main):004:0> io.gets("\r\n", chomp: true) => "foo" irb(main):005:0> io.gets("\r\n", chomp: true) => "bar" irb(main):006:0> io.gets("\r\n", chomp: true) => "\r\n" ``` compared with File: ``` irb(main):008:0> io = Tempfile.new => #<File:/var/folders/cm/p8lkj40s0vz_vgx_b5df9dkm0000gn/T/20230128-37714-107ims> irb(main):009:0> io.write("foo\r\nbar\r\n\r\n") => 12 irb(main):012:0> io.rewind => 0 irb(main):013:0> io.gets("\r\n", chomp: true) => "foo" irb(main):014:0> io.gets("\r\n", chomp: true) => "bar" irb(main):015:0> io.gets("\r\n", chomp: true) => "" ``` -- https://bugs.ruby-lang.org/

Issue #19389 has been updated by ioquatix (Samuel Williams). Team, thanks for your hard work dealing with this bug. ---------------------------------------- Bug #19389: StringIO gets(..., chomp: true) behaves differently to File/IO. https://bugs.ruby-lang.org/issues/19389#change-101566 * Author: ioquatix (Samuel Williams) * Status: Closed * Priority: Normal * Backport: 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE ---------------------------------------- It seems like `StringIO` and `File` `#gets(..., chomp: true)` have different behaviour. ``` irb(main):003:0> io = StringIO.new("foo\r\nbar\r\n\r\n") => #<StringIO:0x00000001077e2018> irb(main):004:0> io.gets("\r\n", chomp: true) => "foo" irb(main):005:0> io.gets("\r\n", chomp: true) => "bar" irb(main):006:0> io.gets("\r\n", chomp: true) => "\r\n" ``` compared with File: ``` irb(main):008:0> io = Tempfile.new => #<File:/var/folders/cm/p8lkj40s0vz_vgx_b5df9dkm0000gn/T/20230128-37714-107ims> irb(main):009:0> io.write("foo\r\nbar\r\n\r\n") => 12 irb(main):012:0> io.rewind => 0 irb(main):013:0> io.gets("\r\n", chomp: true) => "foo" irb(main):014:0> io.gets("\r\n", chomp: true) => "bar" irb(main):015:0> io.gets("\r\n", chomp: true) => "" ``` -- https://bugs.ruby-lang.org/

Issue #19389 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.7: REQUIRED, 3.0: REQUIRED, 3.1: REQUIRED, 3.2: DONE to 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE, 3.2: DONE ruby_3_1 1d24a931c458c93463da1d5885f33edef3677cc2 merged revision(s) 21dced8b01823a991829b66ffdc8ffc635965c76. ---------------------------------------- Bug #19389: StringIO gets(..., chomp: true) behaves differently to File/IO. https://bugs.ruby-lang.org/issues/19389#change-102486 * Author: ioquatix (Samuel Williams) * Status: Closed * Priority: Normal * Backport: 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE, 3.2: DONE ---------------------------------------- It seems like `StringIO` and `File` `#gets(..., chomp: true)` have different behaviour. ``` irb(main):003:0> io = StringIO.new("foo\r\nbar\r\n\r\n") => #<StringIO:0x00000001077e2018> irb(main):004:0> io.gets("\r\n", chomp: true) => "foo" irb(main):005:0> io.gets("\r\n", chomp: true) => "bar" irb(main):006:0> io.gets("\r\n", chomp: true) => "\r\n" ``` compared with File: ``` irb(main):008:0> io = Tempfile.new => #<File:/var/folders/cm/p8lkj40s0vz_vgx_b5df9dkm0000gn/T/20230128-37714-107ims> irb(main):009:0> io.write("foo\r\nbar\r\n\r\n") => 12 irb(main):012:0> io.rewind => 0 irb(main):013:0> io.gets("\r\n", chomp: true) => "foo" irb(main):014:0> io.gets("\r\n", chomp: true) => "bar" irb(main):015:0> io.gets("\r\n", chomp: true) => "" ``` -- https://bugs.ruby-lang.org/

Issue #19389 has been updated by ioquatix (Samuel Williams). Thanks for your hard work. ---------------------------------------- Bug #19389: StringIO gets(..., chomp: true) behaves differently to File/IO. https://bugs.ruby-lang.org/issues/19389#change-102497 * Author: ioquatix (Samuel Williams) * Status: Closed * Priority: Normal * Backport: 2.7: REQUIRED, 3.0: REQUIRED, 3.1: DONE, 3.2: DONE ---------------------------------------- It seems like `StringIO` and `File` `#gets(..., chomp: true)` have different behaviour. ``` irb(main):003:0> io = StringIO.new("foo\r\nbar\r\n\r\n") => #<StringIO:0x00000001077e2018> irb(main):004:0> io.gets("\r\n", chomp: true) => "foo" irb(main):005:0> io.gets("\r\n", chomp: true) => "bar" irb(main):006:0> io.gets("\r\n", chomp: true) => "\r\n" ``` compared with File: ``` irb(main):008:0> io = Tempfile.new => #<File:/var/folders/cm/p8lkj40s0vz_vgx_b5df9dkm0000gn/T/20230128-37714-107ims> irb(main):009:0> io.write("foo\r\nbar\r\n\r\n") => 12 irb(main):012:0> io.rewind => 0 irb(main):013:0> io.gets("\r\n", chomp: true) => "foo" irb(main):014:0> io.gets("\r\n", chomp: true) => "bar" irb(main):015:0> io.gets("\r\n", chomp: true) => "" ``` -- https://bugs.ruby-lang.org/
participants (4)
-
ioquatix (Samuel Williams)
-
ioquatix (Samuel Williams)
-
nagachika (Tomoyuki Chikanaga)
-
naruse (Yui NARUSE)