In perl.git, the branch blead has been updated

<https://perl5.git.perl.org/perl.git/commitdiff/dda4a47798d635b6b0d236c270660c8eacdda2fa?hp=c2167943161b3433eff239edc775830289f9936e>

- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 perlio.c      |  2 +-
 t/io/crlf.t   | 17 ++++++++++++++++-
 t/io/socket.t |  2 --
 3 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/perlio.c b/perlio.c
index ba934ff259..904d47a57e 100644
--- a/perlio.c
+++ b/perlio.c
@@ -4825,7 +4825,7 @@ PerlIOCrlf_binmode(pTHX_ PerlIO *f)
        PerlIO_pop(aTHX_ f);
 #endif
     }
-    return 0;
+    return PerlIOBase_binmode(aTHX_ f);
 }
 
 PERLIO_FUNCS_DECL(PerlIO_crlf) = {
diff --git a/t/io/crlf.t b/t/io/crlf.t
index 7fb4c1e4a8..d0275af9a0 100644
--- a/t/io/crlf.t
+++ b/t/io/crlf.t
@@ -18,7 +18,7 @@ my $crcr = uni_to_native("\x0d\x0d");
 my $ungetc_count = 8200;    # Somewhat over the likely buffer size
 
 {
-    plan(tests => 16 + 2 * $ungetc_count);
+    plan(tests => 21 + 2 * $ungetc_count);
     ok(open(FOO,">:crlf",$file));
     ok(print FOO 'a'.((('a' x 14).qq{\n}) x 2000) || close(FOO));
     ok(open(FOO,"<:crlf",$file));
@@ -87,6 +87,21 @@ my $ungetc_count = 8200;    # Somewhat over the likely 
buffer size
            unlike($foo, qr/$crcr/);
        }
     }
+
+    {
+        # check binmode removes :utf8
+        # 133604 - on Win32 :crlf is the base buffer layer, so
+        # binmode doesn't remove it, but the binmode handler didn't
+        # remove :utf8 either
+        ok(open(my $fh, ">", $file), "open a file");
+        ok(binmode($fh, ":utf8"), "add :utf8");
+        ok((() = grep($_ eq "utf8", PerlIO::get_layers($fh))),
+           "check :utf8 set");
+        ok(binmode($fh), "remove :utf8");
+        ok(!(() = grep($_ eq "utf8", PerlIO::get_layers($fh))),
+           "check :utf8 removed");
+        close $fh;
+    }
 }
 
 sub count_chars {
diff --git a/t/io/socket.t b/t/io/socket.t
index 10c9ef3b26..be3abc0e1e 100644
--- a/t/io/socket.t
+++ b/t/io/socket.t
@@ -141,8 +141,6 @@ SKIP: {
     # separate to avoid interfering with the data expected above
     $local or skip("No localhost", 1);
     $fork or skip("No fork", 1);
-    $^O eq "MSWin32"
-      and skip("binmode acting strangely here on Win32", 1);
 
     note "recv/send :utf8 tests";
     ok(socket(my $serv, PF_INET, SOCK_STREAM, $tcp), "make a tcp socket 
(recv/send :utf8 handling)");

-- 
Perl5 Master Repository

Reply via email to