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 Date: Thu, 24 Jul 2003 22:46:22 -0400 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: 1.5.0: Problem with fseeko() after fdopen() (gold star alert) Message-ID: <20030725024622.GA9919@redhat.com> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <16160 DOT 1351 DOT 752705 DOT 773318 AT phish DOT entomo DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <16160.1351.752705.773318@phish.entomo.com> User-Agent: Mutt/1.4.1i 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 -- 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/