[MacRuby] #1402: Errno::EBADF occurs when repeats reading/writing the file.

MacRuby ruby-noreply at macosforge.org
Wed Oct 5 20:58:44 PDT 2011


#1402: Errno::EBADF occurs when repeats reading/writing the file.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 Using IO's object which is created by IO.new, [[BR]]
 Errno::EBADF occurs when repeats reading/writing the file.

 Test Script:
 {{{
 #!ruby
 path = "/tmp/test.txt"

 def new_io(name, mode)
   fd = IO.sysopen(name, mode)
   IO.new(fd, mode)
 end


 100.times do
   io = new_io(path, "w")
   io.puts "Hello, world"
   io.close

   io = new_io(path, "r")
   io.read
   io.close
 end
 }}}

 Result:
 {{{
 $ macruby t.rb
 /Users/watson/tmp/t.rb:5:in `new_io': Bad file descriptor (Errno::EBADF)
         from /Users/watson/tmp/t.rb:10:in `block'
         from /Users/watson/tmp/t.rb:9:in `<main>'
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1402>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list