* Re: Updated: Perl 5.8.0-3 breaks binmode()
[not found] <1F7DF2D5EE161D4ABD7371B32CA91ED6582633@mail.arrayinc.com>
@ 2003-06-25 16:53 ` Don Slutz
0 siblings, 0 replies; 3+ messages in thread
From: Don Slutz @ 2003-06-25 16:53 UTC (permalink / raw)
To: 'Gerrit P. Haase', Don Slutz, cygwin
I have found a change (patch) that will make stdio work the same as perlio.
Both are broken for text mounts in that they force binary mode. The is a
bug/feature in fgetc/fopen in the way perl uses them that prevents text mode
from working on read, but works on write.
Here are the diff files:
diff -ur perl-5.8.0~/perlio.c perl-5.8.0/perlio.c
--- perl-5.8.0~/perlio.c 2002-07-11 12:39:36.000000000 -0400
+++ perl-5.8.0/perlio.c 2003-06-17 16:06:39.000000000 -0400
@@ -2484,7 +2484,7 @@
while (*mode) {
*tmode++ = *mode++;
}
-#ifdef PERLIO_USING_CRLF
+#if defined(PERLIO_USING_CRLF) || defined(__CYGWIN__)
*tmode++ = 'b';
#endif
*tmode = '\0';
@@ -2585,15 +2585,15 @@
fd = PerlLIO_open3(path, imode, perm);
}
else {
- FILE *stdio = PerlSIO_fopen(path, mode);
+ FILE *stdio = PerlSIO_fopen(path,
+ (mode = PerlIOStdio_mode(mode, tmode)));
if (stdio) {
PerlIOStdio *s;
if (!f) {
f = PerlIO_allocate(aTHX);
}
if ((f = PerlIO_push(aTHX_ f, self,
- (mode = PerlIOStdio_mode(mode, tmode)),
- PerlIOArg))) {
+ mode, PerlIOArg))) {
s = PerlIOSelf(f, PerlIOStdio);
s->stdio = stdio;
PerlIOUnix_refcnt_inc(fileno(s->stdio));
Which causes stdio to open ALL files/pipes/etc in binary mode. (Which is
the same thing that perlio/unix does...)
-Don Slutz
Don Slutz wrote:
> Nope, I no longer have the perl 5.6.0 patch I was working on (lost the
> disk it was on) and found that binmode() would get around the issue and
> so got put on the back burner...
>
> I will take a quick look at the latest source via setup and see if I can
> figure out the 5.8 version...
>
> I have attached the test files.
>
> -Don
>
> -----Original Message-----
> From: Gerrit P. Haase [mailto:gp@familiehaase.de]
> Sent: Monday, June 09, 2003 6:12 PM
> To: Don Slutz
> Cc: cygwin@cygwin.com
> Subject: Re: Updated: Perl 5.8.0-3 breaks binmode()
>
> Hallo Don,
>
> > This update breaks the usage of binmode(FH). I am sure that:
>
> >> News: Changes: - Moved Cygwin to the non DOSish platforms.
>
> > is the main reason. Last time I was in the perl sources, I saw that
> > perl only expected two types of file opens; text or binary. However
> > cygwin supports 3: default, text, and binary.
>
> > I would expect that declaring cygwin to be like VOS (text open is
> > different then binary open; but do not change end of line handling)
> > would be the fix.
>
> Where and what to apply? Do you have a patch handy for me to test
> with?
>
> > I have also found that | some times does things to end of lines also.
>
> > Here is output of some tests that I ran to validate this issue (tests
> > are available via direct e-mail):
>
> Yes, please send me your tests.
>
> Gerrit
> --
> =^..^=
>
> ------------------------------------------------------------------------
>
> Part 1.2 Type: application/ms-tnef
> Encoding: base64
--
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Updated: Perl 5.8.0-3 breaks binmode()
2003-06-09 19:10 Don Slutz
@ 2003-06-09 22:15 ` Gerrit P. Haase
0 siblings, 0 replies; 3+ messages in thread
From: Gerrit P. Haase @ 2003-06-09 22:15 UTC (permalink / raw)
To: Don Slutz; +Cc: cygwin
Hallo Don,
> This update breaks the usage of binmode(FH). I am sure that:
>> News: Changes: - Moved Cygwin to the non DOSish platforms.
> is the main reason. Last time I was in the perl sources, I saw that
> perl only expected two types of file opens; text or binary. However
> cygwin supports 3: default, text, and binary.
> I would expect that declaring cygwin to be like VOS (text open is
> different then binary open; but do not change end of line handling)
> would be the fix.
Where and what to apply? Do you have a patch handy for me to test
with?
> I have also found that | some times does things to end of lines also.
> Here is output of some tests that I ran to validate this issue (tests
> are available via direct e-mail):
Yes, please send me your tests.
Gerrit
--
=^..^=
--
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Updated: Perl 5.8.0-3 breaks binmode()
@ 2003-06-09 19:10 Don Slutz
2003-06-09 22:15 ` Gerrit P. Haase
0 siblings, 1 reply; 3+ messages in thread
From: Don Slutz @ 2003-06-09 19:10 UTC (permalink / raw)
To: cygwin
This update breaks the usage of binmode(FH). I am sure that:
> News: Changes: - Moved Cygwin to the non DOSish platforms.
is the main reason. Last time I was in the perl sources, I saw that
perl
only expected two types of file opens; text or binary. However cygwin
supports 3: default, text, and binary.
I would expect that declaring cygwin to be like VOS (text open is
different
then binary open; but do not change end of line handling) would be the
fix.
I have also found that | some times does things to end of lines also.
Here is output of some tests that I ran to validate this issue (tests
are available
via direct e-mail):
test/txt/idos test/txt/odos-binmode differ: char 3, line 1
test/txt/idos
0000000 1 cr nl 2 cr nl
0000006
test/txt/odos-binmode
0000000 1 cr cr nl 2 cr cr nl
0000010
Which is the output from:
#! /usr/bin/perl -w
$line = 0;
open(I,"<$ARGV[0]");
binmode(I);
open(O,">$ARGV[1]");
binmode(O);
while(<I>) {
$line++;
print O;
}
close (I);
close (O);
# print "Lines: $line\n";
-Don Slutz
--
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/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-06-25 16:49 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1F7DF2D5EE161D4ABD7371B32CA91ED6582633@mail.arrayinc.com>
2003-06-25 16:53 ` Updated: Perl 5.8.0-3 breaks binmode() Don Slutz
2003-06-09 19:10 Don Slutz
2003-06-09 22:15 ` Gerrit P. Haase
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).