summaryrefslogtreecommitdiff
path: root/ext/Fcntl
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2017-09-20 13:27:11 +1000
committerTony Cook <tony@develop-help.com>2017-09-20 14:50:45 +1000
commite91a8fe59e04acc5aa33b600b132452b2e7e6165 (patch)
tree599bdb7be0a4b9c05d57c41dc6b1c380463d0863 /ext/Fcntl
parent3e09f0e17830742b74b979b35847f68f775468cd (diff)
downloadperl-e91a8fe59e04acc5aa33b600b132452b2e7e6165.tar.gz
avoid sysread()/syswrite() warnings from the default :utf8 from PERL_UNICODE
In a UTF-8 locale, if the PERL_UNICODE environment variable is set, perl may add a :utf8 layer. v5.23.1-197-gfb10a8a deprecated using sysread(), syswrite() etc on such handles, which meant that a test run under PERL_UNICODE could produce a significant number of deprecation warnings. Prevent those warnings, typically by binmode(), but in one case by disabling the warning.
Diffstat (limited to 'ext/Fcntl')
-rw-r--r--ext/Fcntl/t/fcntl.t2
-rw-r--r--ext/Fcntl/t/syslfs.t5
2 files changed, 6 insertions, 1 deletions
diff --git a/ext/Fcntl/t/fcntl.t b/ext/Fcntl/t/fcntl.t
index b689f781cc..af649b52ce 100644
--- a/ext/Fcntl/t/fcntl.t
+++ b/ext/Fcntl/t/fcntl.t
@@ -12,11 +12,13 @@ print "1..7\n";
print "ok 1\n";
if (sysopen(my $wo, "fcntl$$", O_WRONLY|O_CREAT)) {
+ binmode $wo;
print "ok 2\n";
if (syswrite($wo, "foo") == 3) {
print "ok 3\n";
close($wo);
if (sysopen(my $ro, "fcntl$$", O_RDONLY)) {
+ binmode $ro;
print "ok 4\n";
if (sysread($ro, my $read, 3)) {
print "ok 5\n";
diff --git a/ext/Fcntl/t/syslfs.t b/ext/Fcntl/t/syslfs.t
index 00e072ba60..7537d54876 100644
--- a/ext/Fcntl/t/syslfs.t
+++ b/ext/Fcntl/t/syslfs.t
@@ -72,6 +72,7 @@ if ($^O eq 'unicos') {
sysopen(BIG, $big1, O_WRONLY|O_CREAT|O_TRUNC) or
die "sysopen $big1 failed: $!";
+binmode BIG;
sysseek(BIG, 1_000_000, SEEK_SET) or
die "sysseek $big1 failed: $!";
syswrite(BIG, "big") or
@@ -85,6 +86,7 @@ print "# s1 = @s1\n";
sysopen(BIG, $big2, O_WRONLY|O_CREAT|O_TRUNC) or
die "sysopen $big2 failed: $!";
+binmode BIG;
sysseek(BIG, 2_000_000, SEEK_SET) or
die "sysseek $big2 failed: $!";
syswrite(BIG, "big") or
@@ -127,6 +129,7 @@ EOF
sysopen(BIG, $big0, O_WRONLY|O_CREAT|O_TRUNC) or
die "sysopen $big0 failed: $!";
+binmode BIG;
my $sysseek = sysseek(BIG, 5_000_000_000, SEEK_SET);
unless (! $r && defined $sysseek && $sysseek == 5_000_000_000) {
$sysseek = 'undef' unless defined $sysseek;
@@ -192,7 +195,7 @@ is(-e $big0, 1);
is(-f $big0, 1);
sysopen(BIG, $big0, O_RDONLY) or die "sysopen failed: $!";
-
+binmode BIG;
offset('sysseek(BIG, 4_500_000_000, SEEK_SET)', 4_500_000_000);
offset('sysseek(BIG, 0, SEEK_CUR)', 4_500_000_000);