Re: seekable stdin test failure on OS X

2007-04-12 Thread Bruno Haible
Eric Blake wrote: > 2007-04-09 Eric Blake <[EMAIL PROTECTED]> > > * modules/fflush: New file. I'm completing the module description like this (for documentation purposes): 2007-04-12 Bruno Haible <[EMAIL PROTECTED]> * modules/fflush (Include): Mention . * modules/strt

Re: seekable stdin test failure on OS X

2007-04-12 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 4/10/2007 4:29 PM: > Hi Eric, > > The 'e1' variable is not needed, I think. No standard specifies that errno > must be preserved across function calls: > - C99 does not mention 'errno' in the description of fflush, > -

Re: seekable stdin test failure on OS X

2007-04-12 Thread Gary V. Vaughan
Hi Eric, [for bug-gnulib, this is on Mac OS 10.4.9 intel] On 11 Apr 2007, at 13:39, Eric Blake wrote: gnulib-tool --with-tests --test fflush make check-TESTS File offset is wrong. FAIL: test-fflush PASS: test-stdio PASS: test-unistd === 1 of 3 tests failed ==

Re: seekable stdin test failure on OS X

2007-04-10 Thread Bruno Haible
Hi Eric, The 'e1' variable is not needed, I think. No standard specifies that errno must be preserved across function calls: - C99 does not mention 'errno' in the description of fflush, - POSIX does, and says in http://www.opengroup.org/susv3/functions/xsh_chap02_03.html that "The value o

Re: seekable stdin test failure on OS X

2007-04-09 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Paul Eggert on 4/9/2007 11:51 AM: > Eric Blake <[EMAIL PROTECTED]> writes: > >> +#elif HAVE___FPURGE >> + /* __fpurge has no return value, so we must check errno. */ >> + errno = 0; >> + __fpurge (stream); >> + if (errno) >> +res

Re: seekable stdin test failure on OS X

2007-04-09 Thread Paul Eggert
Eric Blake <[EMAIL PROTECTED]> writes: > +#elif HAVE___FPURGE > + /* __fpurge has no return value, so we must check errno. */ > + errno = 0; > + __fpurge (stream); > + if (errno) > +result = EOF; > + else > +{ > + result = 0; > + errno = e1; > +} This doesn't look righ

Re: seekable stdin test failure on OS X

2007-04-07 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Paul Eggert on 4/2/2007 12:41 PM: > > Anyway, for what it's worth I think fflush (stdin) should behave like > 1988 POSIX and glibc, at least for apps that care about this sort of > thing. Here's my first attempt at this. I don't have ea

Re: seekable stdin test failure on OS X

2007-04-03 Thread Gary V. Vaughan
Hi Eric, On 2 Apr 2007, at 18:15, Eric Blake-1 wrote: Even on Linux, the fflush man page doesn't mention input streams: http://www.die.net/doc/linux/man/man3/fflush.3.html So it seems that using fflush(stdin) is probably the wrong thing to do altogether for a portable application. On the

Re: seekable stdin test failure on OS X

2007-04-02 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Ben Pfaff on 4/2/2007 12:56 PM: > Is there a version of POSIX newer than "The Open Group Base > Specifications Issue 6: IEEE Std 1003.1, 2004 Edition"? This > version doesn't say anything about the behavior of fflush for > input streams,

Re: seekable stdin test failure on OS X

2007-04-02 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Paul Eggert on 4/2/2007 12:41 PM: > Ben Pfaff <[EMAIL PROTECTED]> writes: > >> ISO C89 and C99 say that fflush(stdin) yields undefined behavior, >> so I'm inclined to agree. > > It's more complicated than that, I'm afraid. > > Here's ho

Re: seekable stdin test failure on OS X

2007-04-02 Thread Ben Pfaff
Paul Eggert <[EMAIL PROTECTED]> writes: > Ben Pfaff <[EMAIL PROTECTED]> writes: > >> ISO C89 and C99 say that fflush(stdin) yields undefined behavior, >> so I'm inclined to agree. > > Here's how I remember it; I haven't checked the actual documents. In > the late 1980s the POSIX committee decided

Re: seekable stdin test failure on OS X

2007-04-02 Thread Paul Eggert
Ben Pfaff <[EMAIL PROTECTED]> writes: > ISO C89 and C99 say that fflush(stdin) yields undefined behavior, > so I'm inclined to agree. It's more complicated than that, I'm afraid. Here's how I remember it; I haven't checked the actual documents. In the late 1980s the POSIX committee decided that

Re: seekable stdin test failure on OS X

2007-04-02 Thread Ben Pfaff
"Gary V. Vaughan" <[EMAIL PROTECTED]> writes: > So it seems that using fflush(stdin) is probably the wrong thing > to do altogether for a portable application. ISO C89 and C99 say that fflush(stdin) yields undefined behavior, so I'm inclined to agree. -- Ben Pfaff [EMAIL PROTECTED]

Re: seekable stdin test failure on OS X

2007-04-02 Thread Eric Blake-1
- View this message in context: http://www.nabble.com/Re%3A-seekable-stdin-test-failure-on-OS-X-tf3505729.html#a9794974 Sent from the Gnulib mailing list archive at Nabble.com.

Re: seekable stdin test failure on OS X

2007-04-02 Thread Gary V. Vaughan
On 2 Apr 2007, at 17:24, Paul Eggert wrote: "Gary V. Vaughan" <[EMAIL PROTECTED]> writes: At worst we need an autoconf test to see whether fflush works on stdin, but maybe all that is needed is to call fpurge when present, and fallback to fflush otherwise? For what it's worth, on Solaris it

Re: seekable stdin test failure on OS X

2007-04-02 Thread Paul Eggert
"Gary V. Vaughan" <[EMAIL PROTECTED]> writes: > At worst we need an autoconf test to see whether fflush works on stdin, > but maybe all that is needed is to call fpurge when present, and > fallback to fflush otherwise? For what it's worth, on Solaris it's called __fpurge and is declared in (alon

Re: seekable stdin test failure on OS X

2007-04-02 Thread Gary V. Vaughan
Hi Eric, Here is the relevant code from modules/m4.c in CVS HEAD: 508/* POSIX requires that if m4 doesn't consume all input, but stdin is 509 opened on a seekable file, that the file pointer be left at the 510 next character on exit (but places no restrictions on t

Re: seekable stdin test failure on OS X

2007-04-02 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Gary V. Vaughan on 4/2/2007 6:44 AM: > Hi Eric, Hi Gary, and adding gnulib readers, >> >> Yuck. I think this means that on your platform, fflush(stdin) is >> neglecting to reset the underlying fd position when stdin is seekable, >> whic