Actions
Bug #18421
closed`IO#readpartial` and `IO#read_nonblock` return non-empty string on empty file
Description
With an empty file empty_file
, this seems indisputably correct.
File.open("empty_file") {|f| f.read(0, "abc")} #=> ""
OTOH, obviously these seem bugs.
File.open("empty_file") {|f|f.readpartial(0, "abc")} #=> "abc"
File.open("empty_file") {|f|f.read_nonblock(0, "abc")} #=> "abc"
Updated by nobu (Nobuyoshi Nakada) over 2 years ago
- Status changed from Open to Closed
Applied in changeset git|fdf39963490cf2cf95b30d91bb9b35964c2c2350.
Empty and return the buffer if zero size is given [Bug #18421]
In IO#readpartial
and IO#read_nonblock
, as well as IO#read
.
Updated by usa (Usaku NAKAMURA) about 2 years ago
- Backport changed from 2.6: REQUIRED, 2.7: REQUIRED, 3.0: REQUIRED to 2.6: REQUIRED, 2.7: DONE, 3.0: REQUIRED
ruby_2_7 c4a5eaf37b9bf87f8324a7070c8dbc597b89c4fc merged revision(s) fdf39963490cf2cf95b30d91bb9b35964c2c2350.
Updated by nagachika (Tomoyuki Chikanaga) about 2 years ago
- Backport changed from 2.6: REQUIRED, 2.7: DONE, 3.0: REQUIRED to 2.6: REQUIRED, 2.7: DONE, 3.0: DONE
ruby_3_0 7c0537906314f0c2a317b37661ccdec8dddc6277 merged revision(s) fdf39963490cf2cf95b30d91bb9b35964c2c2350.
Actions
Like0
Like0Like0Like0Like0