it turns out that the problem with ndb is actually a bio
problem Brdline() freaks out and returns nil if the line
in question is longer than b->bsize and doesn't increment
the file pointer, so you've got an infinite loop.

i had thought that this was clearly in violation of
what the man page says, but on second read, i'm not so
sure.  i would think that Brdline() should return a
buffer if there are bytes available—otherwise it
could be confused with eof,  but that's clearly not
what the code does.

it seems from the existing bio code the only reasonable way
eat lines that are too long is 

        /* get a line (ignoreing long ones) */
        dump = 0;
        for(;;){
                if((line = Brdline(b, '\n')) == 0){
                        if(Blinelen(b)>0){
                                Bseek(b, Blinelen(b), 1);
                                dump = 1;
                                continue;
                        }
                        break;
                }
                if(dump){
                        dump = 0;
                        continue;
                }
                break;
        }

that seems a bit ... goofy. it would seem better for
bio to do this internally?  surely there isn't code that
relies on this behavior?

- erik

Reply via email to