Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Thu, 24 Jul 2003 22:56:19 -0400 (EDT) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com Subject: Re: 1.5.0: Problem with fseeko() after fdopen() (gold star alert) In-Reply-To: <20030725024622.GA9919@redhat.com> Message-ID: Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Thu, 24 Jul 2003, Christopher Faylor wrote: > 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! > > cgf And with no prompting, either. Yup, I thought he deserved one. Done. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski, Ph.D. '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! "I have since come to realize that being between your mentor and his route to the bathroom is a major career booster." -- Patrick Naughton -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/