This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 1.5.0: Problem with fseeko() after fdopen() (gold star alert)

On Thu, Jul 24, 2003 at 09:11:51AM -0700, David Rothenberger wrote:
Content-Description: message body text
>I'm running 1.5.0 with all the latest test packages installed.
>I recently noticed a problem with the test release of patch and its
>ability to read from stdin.  I started to investigate and have
>extracted the problematic code from patch into a test program.
>The program (and patch) use open() to create/open a file and then
>use fdopen() on the resulting file descriptor.  The file is opened
>in RW mode, some data is written to it, the file is flushed, and
>then an attempt is made to seek to the beginning of the file.
>This last seek fails.  The seek is done using fseeko().  If fseek()
>is used instead, all is fine.
>I did a bit of debugging in newlib and determined that fdopen()
>doesn't set pfp->_seek64, which causes the problem.  If I use
>fopen() to create the file, then pfp->_seek64 is set (since fopen()
>ends up calling fopen64()).

Thanks very much for the analysis.  This is a flaw in the 1.5.0 version
of cygwin.

I've submitted a patch request to fix this to the newlib mailing list
which I expect to fix the problem.  It does cause patch to operate
correctly when linked with a new cygwin dll.

When the patch is accepted, I'll generate a new cygwin snapshot but it
won't be very useful since the patch program will still not work right.
So, after the usual extensive snapshot testing, I'll roll up a cygwin
1.5.1 and then regenerate patch.exe.

I have to wonder how many of the many 1.5.0 test packages use fdopen and
fseek, though.  I hate to say it but package developers might have to go
through the pain of rebuilding everything for 1.5.x again.

Please give this man a gold star for going to the effort of tracking
down the problem in source code!


Unsubscribe info:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]