Incorrect DOS line ending conversion for cygwin build of perl

Gerrit P. Haase gp@familiehaase.de
Wed Oct 2 12:42:00 GMT 2002


Hallo Bertie,

Am Mittwoch, 2. Oktober 2002 um 15:33 schriebst du:

> 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.

Which version of perl do you use?
Have you tried to build perl with -UUSE_STDIO_PTR?
Does it work as expected by you?


Gerrit
-- 
=^..^=


--
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/



More information about the Cygwin mailing list