Bug #18421
closed
`IO#readpartial` and `IO#read_nonblock` return non-empty string on empty file
Added by nobu (Nobuyoshi Nakada) over 2 years ago.
Updated about 2 years ago.
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"
https://github.com/ruby/ruby/pull/5323
- Description updated (diff)
- Status changed from Open to Closed
- 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.
- 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.
Also available in: Atom
PDF
Like0
Like0Like0Like0Like0