Hi,

In message "Re: Errno::ENOMEM reading a device in Ruby, not in Java thou"
    on Tue, 17 Nov 2009 02:40:50 +0900, Roger Pack <rogerpack2005 / gmail.com> writes:

|As a followup gotcha (in case anybody runs into this).
|
|irb(main):001:0> a = File.open('/dev/nst2', 'rb')
|=> #<File:/dev/nst2>
|irb(main):002:0> a.eof?
|irb(main):005:0> a.sysread 64*1024
|IOError: sysread for buffered IO
|        from (irb):5:in `sysread'
|        from (irb):5
|
|meant "when you call eof? it actually converts the file descriptor 
|internally into buffered mode, and read a byte from it to see if it 
|reads zero bytes (implying EOF), thus you cannot call sysread after a 
|buffered read call like eof?"

rewind it first to clear buffering.

							matz.