Is this a bug?

irb(main):001:0> f = File.open(“empty.txt”)
#<File:empty.txt>
irb(main):002:0> f.read
nil
irb(main):003:0> f = File.open(“empty.txt”)
#<File:empty.txt>
irb(main):004:0> f.read(0)
""

$ ruby --version
ruby 1.7.2 (2002-07-02) [i386-mswin32]
(Andy’s 1.7.2-4)

In 1.6.[67] IO.read would never return nil in the first call to read even if
the file is empty.

Cheers,

Thomas

Hi,

···

In message “Is this a bug?” on 02/09/14, Thomas Søndergaard tsondergaard@speakanet.com writes:

irb(main):001:0> f = File.open(“empty.txt”)
#<File:empty.txt>
irb(main):002:0> f.read
nil

Fixed in the latest 1.7.3

						matz.