[MacRuby-devel] [MacRuby] #577: EXC_BAD_ACCESS in IO.read

MacRuby ruby-noreply at macosforge.org
Wed Jan 27 00:34:29 PST 2010


#577: EXC_BAD_ACCESS in IO.read
---------------------------------+------------------------------------------
 Reporter:  spamtrap1@…          |       Owner:  lsansonetti@…        
     Type:  defect               |      Status:  new                  
 Priority:  minor                |   Milestone:                       
Component:  MacRuby              |    Keywords:                       
---------------------------------+------------------------------------------

Comment(by spamtrap1@…):

 I've been looking a little bit at this, but since i'm unable to build
 trunk, all i can do is pen & paper, and guess :)

 in io.c:1108 (io_read), a distinction is made between reading x bytes, or
 reading the whole file.
 If we're reading the whole file
 {{{
     if (NIL_P(len)) {
         return rb_io_read_all(io_struct, outbuf);
     }
 }}}

 Or we're reading part of the file io.c:1145 (io_read)
 {{{
     const long data_read = rb_io_read_internal(io_struct, buf, size);
     if (data_read == 0) {
         return Qnil;
     }
     CFDataSetLength(data, data_read);
 }}}

 So far, so good.
 The very last thing '''rb_io_read_internal''' io.c:983
 (rb_io_read_internal) does, is to call
 {{{
     rb_io_read_update(io_struct, n);

 }}}

 Which positions the file pointer at the position we just read to.
 This part isn't done by '''rb_io_read_all'''

 Could this be why the eof? call fails after having called IO.read(nil) ?

 Just my $0.02 after a good nights sleep :)

 /Jimmy

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/577#comment:1>
MacRuby <http://macruby.org/>



More information about the MacRuby-devel mailing list