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 Message-Id: <3.0.1.32.20021002143318.02cd2270@mail.ncipher.com> X-Sender: bertie AT mail DOT ncipher DOT com Date: Wed, 02 Oct 2002 14:33:18 +0100 To: cygwin AT cygwin DOT com From: Bertie Subject: Incorrect DOS line ending conversion for cygwin build of perl Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" I note that the cygwin build of perl does not correctly translate DOS \r\n line endings into \n when opening files in text mode, this causes all sorts of grief in perl scripts which search for things like fred$ in DOS text files. After a bit of digging around in perl source it turns out that the problem is in the function str_gets() in x2p/str.c, this code uses the FILE *fp->_p variable to read directly from the FILE buffer, but alas cygwin only does the \r\n -> \n conversion when serving up the contents of the _p buffer ( in fread, fgets, fgetc etc ), not before, so reading the _p buffer directly circumvents the translation. There is a perl variable USE_STDIO_PTR which can be undefined to stop perl from using the FILE _p variable. I have built a cygwin version of perl with this undefined and the line ending conversion now works fine. You might consider this to be a bug in the perl build system (USE_STDIO_PTR should be undefined by default for cygwin builds), however at the very least cygwin should ship a version of perl which has been built correctly. Alternatively cygwin could be altered to do the line ending conversion before putting data into FILE *fp->_p, I imagine this might cause slight upheaval though. Bertie -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/