develooper Front page | perl.perl5.porters | Postings from August 2003

[PATCH] maint / blead tweaks in perlio.c for Cygwin

Thread Next
Gerrit P. Haase
August 27, 2003 23:13
[PATCH] maint / blead tweaks in perlio.c for Cygwin
Message ID:
Hallo Jarkko,

currently I'm applying one additional patch to the perl sources when
building for Cygwin.  There seems to be a problem with binmode() since
I removed Cygwin from the DOSISH platforms, see e.g. this bug report:

The patch is 'donated' by Don Slutz which he found during his research
he did because of a bug which he also reported:

He also donated a little testsuite to test different perlio
settings on Cygwin textmode and binmode mounts and it works pretty
well with his patch applied.

Though, would be interesting to hear from NIS about this change, if it
makes sense and what it does at all since I cannot claim to understand
this and most of the rest of perlio.

If this patch gets applied, RT #10007 can be closed.

--- perl-5.8.1/perlio.c~        2003-07-13 02:51:57.000000000 +0200
+++ perl-5.8.1/perlio.c 2003-07-13 02:55:48.000000000 +0200
@@ -2484,7 +2484,7 @@ PerlIOStdio_mode(const char *mode, char 
     while (*mode) {
        *tmode++ = *mode++;
+#if defined(PERLIO_USING_CRLF) || defined(__CYGWIN__)
     *tmode++ = 'b';
     *tmode = '\0';
@@ -2585,15 +2585,23 @@ PerlIOStdio_open(pTHX_ PerlIO_funcs *sel
                fd = PerlLIO_open3(path, imode, perm);
            else {
+#ifdef __CYGWIN__
+        FILE *stdio = PerlSIO_fopen(path, (mode = PerlIOStdio_mode(mode, tmode)));
                FILE *stdio = PerlSIO_fopen(path, mode);
                if (stdio) {
                    PerlIOStdio *s;
                    if (!f) {
                        f = PerlIO_allocate(aTHX);
+#ifdef __CYGWIN__
+            if ((f = PerlIO_push(aTHX_ f, self, mode, PerlIOArg))) {
                    if ((f = PerlIO_push(aTHX_ f, self,
                                    (mode = PerlIOStdio_mode(mode, tmode)),
                                    PerlIOArg))) {
                        s = PerlIOSelf(f, PerlIOStdio);
                        s->stdio = stdio;



Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About