summaryrefslogtreecommitdiff
path: root/gnu/usr.bin
diff options
context:
space:
mode:
authorAndrew Fresh <afresh1@cvs.openbsd.org>2017-11-20 04:41:29 +0000
committerAndrew Fresh <afresh1@cvs.openbsd.org>2017-11-20 04:41:29 +0000
commit34b2426bebe64e5c631c80fada0a18b5e934cac4 (patch)
tree646ae869c3724f7bab3492a0abd7aa5420659f74 /gnu/usr.bin
parent0a305c368d765b4142a4b95d4348af71bfcc1e36 (diff)
Support Time::HiRes::utime in File::Copy
Fixes issues with cross-device moves, noticed with autoconf
Diffstat (limited to 'gnu/usr.bin')
-rw-r--r--gnu/usr.bin/perl/lib/File/Copy.pm4
-rw-r--r--gnu/usr.bin/perl/lib/File/Copy.t7
2 files changed, 9 insertions, 2 deletions
diff --git a/gnu/usr.bin/perl/lib/File/Copy.pm b/gnu/usr.bin/perl/lib/File/Copy.pm
index 842bd31cefe..f7440b3d7b0 100644
--- a/gnu/usr.bin/perl/lib/File/Copy.pm
+++ b/gnu/usr.bin/perl/lib/File/Copy.pm
@@ -16,13 +16,15 @@ use Config;
# And then we need these games to avoid loading overload, as that will
# confuse miniperl during the bootstrap of perl.
my $Scalar_Util_loaded = eval q{ require Scalar::Util; require overload; 1 };
+# We want HiRes stat and utime if available
+BEGIN { eval q{ use Time::HiRes qw( stat utime ) } };
our(@ISA, @EXPORT, @EXPORT_OK, $VERSION, $Too_Big, $Syscopy_is_copy);
sub copy;
sub syscopy;
sub cp;
sub mv;
-$VERSION = '2.31';
+$VERSION = '2.31_01';
require Exporter;
@ISA = qw(Exporter);
diff --git a/gnu/usr.bin/perl/lib/File/Copy.t b/gnu/usr.bin/perl/lib/File/Copy.t
index 9e49c7d3f08..5dd564dad29 100644
--- a/gnu/usr.bin/perl/lib/File/Copy.t
+++ b/gnu/usr.bin/perl/lib/File/Copy.t
@@ -24,6 +24,11 @@ BEGIN { *CORE::GLOBAL::rename = sub { CORE::rename($_[0], $_[1]) }; }
use File::Copy qw(copy move cp);
use Config;
+# If we have Time::HiRes, File::Copy loaded it for us.
+BEGIN {
+ eval { Time::HiRes->import(qw( stat utime )) };
+ note "Testing Time::HiRes::utime support" unless $@;
+}
foreach my $code ("copy()", "copy('arg')", "copy('arg', 'arg', 'arg', 'arg')",
"move()", "move('arg')", "move('arg', 'arg', 'arg')"
@@ -100,7 +105,7 @@ for my $cross_partition_test (0..1) {
ok -e "copy-$$", ' target still there';
# Doesn't really matter what time it is as long as its not now.
- my $time = 1000000000;
+ my $time = 1000000000.12345;
utime( $time, $time, "copy-$$" );
# Recheck the mtime rather than rely on utime in case we're on a