This is the mail archive of the
mauve-discuss@sources.redhat.com
mailing list for the Mauve project.
Re: Killer bug in gnu.testlet.java.io.RandomAccessFile.raf
- From: Brian Jones <cbj at gnu dot org>
- To: Stephen Crawley <crawley at dstc dot edu dot au>
- Cc: mauve-discuss at sources dot redhat dot com
- Date: 14 Sep 2002 09:53:48 -0400
- Subject: Re: Killer bug in gnu.testlet.java.io.RandomAccessFile.raf
- References: <200209111217.g8BCHVMB006628@piglet.dstc.edu.au>
I think this has been recently patched in Classpath. Thanks very much
for the bug report. It would probably be useful to change the Mauve
test to detect when it has skipped further than it should be possible
to skip and indicate the error.
Brian
Stephen Crawley <crawley@dstc.edu.au> writes:
> Folks,
>
> There is a bug in this testcase that puts it into an infinite loop
> when you run it against the Classpath libraries.
>
> The problem is here:
>
> int skipped;
> while ((skipped = raf.skipBytes(1)) == 1)
> harness.debug("skipped 1 byte");
>
> This is fine with the Sun JDK implementation of skipBytes. After 6
> iterations, the skipBytes reaches the end of file and returns zero,
> and the loop exits.
>
> But Classpath behaves differently (incorrectly, IMO). Here, skipBytes
> will happily seek past the end of file, so the loop in the testcase
> keeps going and going and ...
>
> Can someone fix the Mauve testcase to avoid the infinite loop? For
> example, change the above code to the following:
>
> int skipped = 0;
> for (int i = 0; i <= "foobar".length(); i++) {
> skipped = raf.skipBytes(1);
> if (skipped != 1) {
> break;
> }
> harness.debug("skipped 1 byte");
> }
>
> -- Steve
>
--
Brian Jones <cbj@gnu.org>