From: Federico Builes Date: 2008-08-05T23:01:20+09:00 Subject: [ruby-core:18132] Another question about IO#ungetc Hello, While studying the specs for IO#ungetc (http://redmine.ruby-lang.org/issues/show/400 ) we came across the following test case: According to the docs IO#ungetc "has no effect with unbuffered reads (such as IO#sysread)" but irb(main):001:0> file = File.open(".bashrc", "r") => # irb(main):002:0> length = File.size(".bashrc") => 1181 irb(main):003:0> content = file.sysread(length) => "export PS1=..." irb(main):004:0> file.rewind => 0 irb(main):005:0> file.ungetc(100) => nil irb(main):006:0> file.sysread(length) IOError: sysread for buffered IO from (irb):6:in `sysread' from (irb):6 from :0 $ uname -a Darwin korobushka 9.4.0 Darwin Kernel Version 9.4.0: Mon Jun 9 19:30:53 PDT 2008; root:xnu-1228.5.20~1/RELEASE_I386 i386 $ ruby -v ruby 1.8.6 (2008-07-17 patchlevel 279) [i686-darwin9.4.0] This happens in 1.8.6, 1.8.7 and 1.9. Was this changed without an update to the docs or are we missing something in the test case? Thanks. -- Federico