* [9fans] bio bug
@ 2003-09-17 9:08 Caerwyn Jones
2003-09-29 14:34 ` David Presotto
0 siblings, 1 reply; 2+ messages in thread
From: Caerwyn Jones @ 2003-09-17 9:08 UTC (permalink / raw)
To: 9fans
The following bug in libbio occurs when seeking within the buffer:
; cat b1.c
#include <u.h>
#include <libc.h>
#include <bio.h>
void
main(int, char *argv[])
{
Biobuf *bin;
long r, n;
bin = Bopen(argv[1], OREAD);
n = Bseek(bin, 0, 2);
Bseek(bin, n/2, 0);
while((r = Bgetrune(bin)) != Beof)
print("%C", r);
Bseek(bin, 0, 0);
while((r = Bgetrune(bin)) != Beof)
print("%C", r);
exits(0);
}
; 8c b1.c ; 8l b1.8
; cat t1
a
b
; ./8.out t1
b
b
;
What I should be getting is
b
a
b
Here is the fix.
; diff /sys/src/libbio/bgetc.c bgetc.c
29a30
> bp->state = Bracteof;
-Caerwyn
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [9fans] bio bug
2003-09-17 9:08 [9fans] bio bug Caerwyn Jones
@ 2003-09-29 14:34 ` David Presotto
0 siblings, 0 replies; 2+ messages in thread
From: David Presotto @ 2003-09-29 14:34 UTC (permalink / raw)
To: 9fans
[-- Attachment #1: Type: text/plain, Size: 55 bytes --]
Sorry, it tool me so long. Your fix is now on sources.
[-- Attachment #2: Type: message/rfc822, Size: 2457 bytes --]
From: Caerwyn Jones <caerwyn@comcast.net>
To: 9fans@cse.psu.edu
Subject: [9fans] bio bug
Date: Wed, 17 Sep 2003 09:08:33 GMT
Message-ID: <YBO9b.367920$cF.108332@rwcrnsc53>
The following bug in libbio occurs when seeking within the buffer:
; cat b1.c
#include <u.h>
#include <libc.h>
#include <bio.h>
void
main(int, char *argv[])
{
Biobuf *bin;
long r, n;
bin = Bopen(argv[1], OREAD);
n = Bseek(bin, 0, 2);
Bseek(bin, n/2, 0);
while((r = Bgetrune(bin)) != Beof)
print("%C", r);
Bseek(bin, 0, 0);
while((r = Bgetrune(bin)) != Beof)
print("%C", r);
exits(0);
}
; 8c b1.c ; 8l b1.8
; cat t1
a
b
; ./8.out t1
b
b
;
What I should be getting is
b
a
b
Here is the fix.
; diff /sys/src/libbio/bgetc.c bgetc.c
29a30
> bp->state = Bracteof;
-Caerwyn
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-09-29 14:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-17 9:08 [9fans] bio bug Caerwyn Jones
2003-09-29 14:34 ` David Presotto
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).