Re: 'fflush' test failure on Cygwin

2007-04-26 Thread Eric Blake
According to Eric Blake on 4/25/2007 7:22 AM: > Thanks. The next problem is figuring out how to work around the fact that > on mingw, fflush(stdin) returns 0 and moves the file offset to the end of > the buffer, rather than failing with EBADF, unlike all the other platforms > where fflush(stdin) i

Re: 'fflush' test failure on Cygwin

2007-04-26 Thread Bruno Haible
Eric Blake wrote: > Meanwhile, I'm checking in this. > > 2007-04-25 Eric Blake <[EMAIL PROTECTED]> > > * lib/fpurge.c (includes): Use stdlib.h for free. > * tests/test-fflush.c (main): Also test fflush-fseeko. Thanks. Addendum: 2007-04-26 Bruno Haible <[EMAIL PROTECTED]>

Re: 'fflush' test failure on Cygwin

2007-04-25 Thread Eric Blake
According to Bruno Haible on 4/25/2007 1:56 AM: > Eric Blake wrote on 2007-04-17: >> we also need a module for >> ftell/ftello (until that is written, fflush fails to compile on mingw). > > With this, fflush at least compiles on mingw: Thanks. The next problem is figuring out how to work around

Re: 'fflush' test failure on Cygwin

2007-04-25 Thread Bruno Haible
On 2007-04-13, I wrote: > 2) fseek() is heavily optimized: fseeko (fp, pos, SEEK_SET) will position >the file descriptor to pos & ~fp->_blksize and then read one buffer, >[or if pos is inside the current buffer, optimize even more: just >change some pointers and counters, without

Re: 'fflush' test failure on Cygwin

2007-04-25 Thread Bruno Haible
Eric Blake wrote on 2007-04-17: > we also need a module for > ftell/ftello (until that is written, fflush fails to compile on mingw). With this, fflush at least compiles on mingw: 2007-04-25 Bruno Haible <[EMAIL PROTECTED]> * modules/fflush (Depends-on): Add ftello. *** modules/fflush

Re: 'fflush' test failure on Cygwin

2007-04-23 Thread Eric Blake
According to Bruno Haible on 4/23/2007 2:56 AM: >> Make fflush rely on fpurge. > > This fails to compile on some system (sorry, I don't remember which one), > because off_t is not defined. Since off_t is defined by either > or , here's a proposed fix. ( is simpler, is required > by ISO C, do

Re: 'fflush' test failure on Cygwin

2007-04-23 Thread Bruno Haible
Eric Blake wrote: > 2007-04-16 Eric Blake <[EMAIL PROTECTED]> > > Make fflush rely on fpurge. > * lib/fflush.c (rpl_fflush): Rely on fpurge module, rather than > open coding all variants. > * modules/fflush (Depends-on): Add fpurge and unistd. > * modules/fflush-tes

Re: 'fflush' test failure on Cygwin

2007-04-16 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 4/12/2007 7:30 PM: > > 1) fpurge exists on MacOS X, but only clears the buffer, without changing >the file descriptor's position in the kernel. So it needs this change >(otherwise the stream's position before the f

Re: 'fflush' test failure on Cygwin

2007-04-13 Thread Bruno Haible
Eric Blake wrote: > what I do is make rpl_fflush check if fp->_seek is __sseek, in > which case I replace it with rpl_sseek. rpl_sseek is written to call > __sseek, and to restore __sseek to fp->_seek if whence is not SEEK_CUR. Whee... You are aware that here you hook yourself into an API that is

Re: 'fflush' test failure on Cygwin

2007-04-13 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 4/13/2007 4:15 AM: > Eric Blake wrote: >> I'm still worried, though, that after using >> rpl_fflush/rpl_fseek, will fread/fgetc pick up at the correct character? >> I hope not to rewrite the entire stdio. > > This should b

Re: 'fflush' test failure on Cygwin

2007-04-13 Thread Bruno Haible
Eric Blake wrote: > I'm still worried, though, that after using > rpl_fflush/rpl_fseek, will fread/fgetc pick up at the correct character? > I hope not to rewrite the entire stdio. This should be feasible, since a stream has a state when the buffer is empty and the file descriptor is not block-ali

Re: 'fflush' test failure on Cygwin

2007-04-12 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 4/12/2007 7:30 PM: > > But it's the goal of the 'fflush' module to make this test work, no? Yes > >> But seeing as how the failure symptom is the same as that of MacOSX, > > Indeed, on MacOS X 10.3.9, the lseek call in

Re: 'fflush' test failure on Cygwin

2007-04-12 Thread Bruno Haible
Eric Blake wrote: > > File offset is wrong. > > FAIL: test-fflush.exe > > > > In test-fflush.c line 70, the return value from lseek() is 10 instead of the > > expected 5. > > That is due to a bug in newlib's fflush that I fixed on 2006-12-14. > > I personally don't use a cygwin that old, nor

Re: 'fflush' test failure on Cygwin

2007-04-12 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 4/12/2007 2:52 PM: > Hi Eric, > > On Cygwin 2006 (/usr/bin/cygwin1.dll dated 2006-01-20), the test-fflush test > fails: > > File offset is wrong. > FAIL: test-fflush.exe > > In test-fflush.c line 70, the return value

'fflush' test failure on Cygwin

2007-04-12 Thread Bruno Haible
Hi Eric, On Cygwin 2006 (/usr/bin/cygwin1.dll dated 2006-01-20), the test-fflush test fails: File offset is wrong. FAIL: test-fflush.exe In test-fflush.c line 70, the return value from lseek() is 10 instead of the expected 5. Bruno