From: Markus Schirp Date: 2008-12-16T04:42:34+09:00 Subject: [ruby-core:20586] StringIO bug? Hello, Im not shure weather this is the correct place to do bug reports. If I am not at the correct place here, pls give me a pointer to the correct location, and sry for the noise! After unit testing some IO code, using stringio and variable io chunk size, i found this unexpected behaviour: (stripped down) ####################### Begin Code require 'stringio' #disfunctional io = StringIO.new("123456789") acc = Array.new buff = String.new until(io.eof?) io.read(1,buff) p buff acc << buff p acc end #functional io = StringIO.new("123456789") acc = Array.new until(io.eof?) buff = String.new io.read(1,buff) p buff acc << buff p acc end ######################### End Code The only difference here is the position of buff = String.new On all tested plattforms the code prints as follows: "1" ["1"] "2" ["2", "2"] "3" ["3", "3", "3"] "4" ["4", "4", "4", "4"] "5" ["5", "5", "5", "5", "5"] "6" ["6", "6", "6", "6", "6", "6"] "7" ["7", "7", "7", "7", "7", "7", "7"] "8" ["8", "8", "8", "8", "8", "8", "8", "8"] "9" ["9", "9", "9", "9", "9", "9", "9", "9", "9"] "1" ["1"] "2" ["1", "2"] "3" ["1", "2", "3"] "4" ["1", "2", "3", "4"] "5" ["1", "2", "3", "4", "5"] "6" ["1", "2", "3", "4", "5", "6"] "7" ["1", "2", "3", "4", "5", "6", "7"] "8" ["1", "2", "3", "4", "5", "6", "7", "8"] "9" ["1", "2", "3", "4", "5", "6", "7", "8", "9"] Plattforms: Gentoo/x86 (-O2 -fomit-frame-pointer, nothing special): - 1.8.6 (2008-08-11 patchlevel 287) [i686-linux] - ruby 1.9.1 (2008-12-16 revision 20768) [i686-linux] Ubuntu8.10/x86_64: 2007-09-24 patchlevel 111 Pls inform me if you need additional information. -- Markus Schirp Seonic IT-Systems GbR Anton Shatalov & Markus Schirp Altenessenerstra�e 50 D-45141 Essen www.seonic.net info@seonic.net