[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fflush after ungetc
From: |
Eric Blake |
Subject: |
Re: fflush after ungetc |
Date: |
Sat, 29 Mar 2008 07:17:40 -0600 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/20080213 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Bruno Haible on 3/29/2008 5:59 AM:
| At this point, waiting for a resolution by the Austin Group (Geoff Clare's
| mail is an important opinion, but not yet a decision), I prefer to not
change
| the code, but just disable the test.
Thanks. I'm committing this followup, which fixes a typo, and makes the
test-freadseek test pass on cygwin (at first I thought it was another
instance of ungetc undefined behavior, but on closer inspection, your
definition of freadseek is well-defined without any reliance on fflush -
the real bug was that freadseek was incrementing the in-memory pointer
beyond the bounds of the ungetc buffer).
Maybe we should add an even more fundamental test for ftell behavior after
both types of ungetc?
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkfuQXMACgkQ84KuGfSFAYDTRgCeIFlnFVRnvHSBRY6Eb2st4gWz
ejUAn0+s97w0gInDkMfMbVF1s/Fazg9U
=/evQ
-----END PGP SIGNATURE-----
>From 16e403776065fa5173be83ccf84004b287b72dc7 Mon Sep 17 00:00:00 2001
From: Eric Blake <address@hidden>
Date: Sat, 29 Mar 2008 07:15:50 -0600
Subject: [PATCH] Pass test-freadseek on cygwin.
* modules/freadseek (Depends-on): Use freadptr, not freadseek.
* lib/freadseek.c (freadseek): Don't increment beyond bounds of
ungetc buffer.
* tests/test-fflush2.c (main): Fix typo.
Signed-off-by: Eric Blake <address@hidden>
---
ChangeLog | 8 ++++++++
lib/freadseek.c | 4 ++--
modules/freadseek | 2 +-
tests/test-fflush2.c | 2 +-
4 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index bee33a2..5b5933c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-03-29 Eric Blake <address@hidden>
+
+ Pass test-freadseek on cygwin.
+ * modules/freadseek (Depends-on): Use freadptr, not freadseek.
+ * lib/freadseek.c (freadseek): Don't increment beyond bounds of
+ ungetc buffer.
+ * tests/test-fflush2.c (main): Fix typo.
+
2008-03-29 Bruno Haible <address@hidden>
* tests/test-fflush2.c (main): Temporarily disable the contents of
diff --git a/lib/freadseek.c b/lib/freadseek.c
index b3f2b18..37aeab7 100644
--- a/lib/freadseek.c
+++ b/lib/freadseek.c
@@ -22,7 +22,7 @@
#include <stdlib.h>
#include <unistd.h>
-#include "freadahead.h"
+#include "freadptr.h"
int
freadseek (FILE *fp, size_t offset)
@@ -34,7 +34,7 @@ freadseek (FILE *fp, size_t offset)
return 0;
/* Increment the in-memory pointer. This is very cheap (no system calls).
*/
- buffered = freadahead (fp);
+ freadptr (fp, &buffered);
if (buffered > 0)
{
size_t increment = (buffered < offset ? buffered : offset);
diff --git a/modules/freadseek b/modules/freadseek
index ce19eda..c9a8555 100644
--- a/modules/freadseek
+++ b/modules/freadseek
@@ -6,7 +6,7 @@ lib/freadseek.h
lib/freadseek.c
Depends-on:
-freadahead
+freadptr
lseek
configure.ac:
diff --git a/tests/test-fflush2.c b/tests/test-fflush2.c
index 884b555..0b6d6c9 100644
--- a/tests/test-fflush2.c
+++ b/tests/test-fflush2.c
@@ -54,7 +54,7 @@ main (int argc, char **argv)
The Austin Group has not yet decided how this should behave. */
#endif
#if 0
- /* Check fflush after a non-backup ungetc() call. This is case 1 in terms of
+ /* Check fflush after a non-backup ungetc() call. This is case 2 in terms of
<http://lists.gnu.org/archive/html/bug-gnulib/2008-03/msg00131.html>.
The Austin Group has not yet decided how this should behave. */
/* Check that fflush after a non-backup ungetc() call discards the ungetc
--
1.5.4
- Re: fflush after ungetc, (continued)
- Message not available
- Re: fflush after ungetc, Eric Blake, 2008/03/26
- Re: fflush after ungetc, Bruno Haible, 2008/03/06
- Re: fflush after ungetc, Eric Blake, 2008/03/06
- Re: fflush after ungetc, Bruno Haible, 2008/03/09
- Re: fflush after ungetc, Eric Blake, 2008/03/29
- Re: fflush after ungetc, Eric Blake, 2008/03/29
- Re: fflush after ungetc, Bruno Haible, 2008/03/29
- Re: fflush after ungetc,
Eric Blake <=
- Re: freadseek, Bruno Haible, 2008/03/30
- Re: fflush after ungetc, Bruno Haible, 2008/03/30
- Re: Cygwin ftell bug, Bruno Haible, 2008/03/06