bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fseek/ftell tests on platforms with bad ungetc


From: Eric Blake
Subject: Re: fseek/ftell tests on platforms with bad ungetc
Date: Wed, 25 Feb 2009 20:49:34 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Gary V. Vaughan <gary <at> gnu.org> writes:

Hi Gary,
> ...
> PASS: test-binary-io.sh
> PASS: test-errno
> PASS: test-fseek.sh

Thanks for the rapid feedback.  Good - I made progress.  I successfully split 
fseek.c into two tests, successfully isolating the first test from buggy ungetc.

> ../../gltests/test-fseek.c:68: assertion failed
> FAIL: test-fseek2.sh

Hmm.  I suspect that ungetc.m4 needs work.  Can you confirm that 
FUNC_UNGETC_BROKEN did not get defined?  On a working platform, the configure 
output includes:

checking whether ungetc works on arbitrary bytes... yes

and when I run by hand with 'gl_cv_func_ungetc_works=no ./gnulib-tool ...'

I confirmed that the skip logic works:

checking whether ungetc works on arbitrary bytes... no (cached)
...
Skipping test: ungetc cannot handle arbitrary bytes
SKIP: test-fseek2.sh

Our goal here is to write ungetc.m4 in such a way that you don't have to prime 
the cache on systems with losing ungetc.

> ../../gltests/test-ftell.c:108: assertion failed
> ../../gltests/test-ftell.sh: line 3: 18761 Aborted
> ./test-ftell${EXEEXT} 1 <"$srcdir/test-ftell.sh"
> FAIL: test-ftell.sh

Ouch.  I got past the ungetc-induced failure (line 86 moved to 97), but 
uncovered an independent failure (failure at line 108 states that fseek appears 
to be unable to set the file offset beyond EOF).  I'm not sure what to do about 
this one, yet.

> ../../gltests/test-ftell.c:97: assertion failed
> FAIL: test-ftell2.sh

Again, if FUNC_UNGETC_BROKEN were set, this test should have been skipped.

I'm applying this interdiff; would you mind trying again?

git pull git://repo.or.cz/gnulib/ericb.git master

diff --git i/m4/ungetc.m4 w/m4/ungetc.m4
index 67a8607..9236d4c 100644
--- i/m4/ungetc.m4
+++ w/m4/ungetc.m4
@@ -19,9 +19,12 @@ AC_DEFUN_ONCE([gl_FUNC_UNGETC_WORKS],
           if (fgetc (f) != 'a') return 3;
           if (fgetc (f) != 'b') return 4;
           if (ungetc ('d', f) != 'd') return 5;
-          if (fseek (f, 0, SEEK_CUR) != 0) return 6;
-          if (ftell (f) != 1) return 7;
-          if (fgetc (f) != 'b') return 8;
+          if (ftell (f) != 1) return 6;
+          if (fgetc (f) != 'd') return 7;
+          if (ftell (f) != 2) return 8;
+          if (fseek (f, 0, SEEK_CUR) != 0) return 9;
+          if (ftell (f) != 2) return 10;
+          if (fgetc (f) != 'c') return 11;
           fclose (f); remove ("conftest.tmp");])],
        [gl_cv_func_ungetc_works=yes], [gl_cv_func_ungetc_works=no],
        [gl_cv_func_ungetc_works='guessing no'])






reply via email to

[Prev in Thread] Current Thread [Next in Thread]