On Sun, Nov 05, 2017 at 02:07:02PM -0700, Andrew Hewus Fresh wrote:
> It probably should.  This is the patch I'm going to submit upstream if
> you'd like to try it out.

As noticed by naddy, my test was faulty and I need this to happen in a
BEGIN block because 

The test needs to use the HiRes utime or else it loses the hires time we
tried to hard to set.


Index: gnu/usr.bin/perl/lib/File/Copy.pm
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/File/Copy.pm,v
retrieving revision 1.17
diff -u -p -r1.17 Copy.pm
--- gnu/usr.bin/perl/lib/File/Copy.pm   5 Feb 2017 00:32:15 -0000       1.17
+++ gnu/usr.bin/perl/lib/File/Copy.pm   5 Nov 2017 22:14:38 -0000
@@ -16,6 +16,8 @@ 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;
Index: gnu/usr.bin/perl/lib/File/Copy.t
===================================================================
RCS file: /cvs/src/gnu/usr.bin/perl/lib/File/Copy.t,v
retrieving revision 1.2
diff -u -p -r1.2 Copy.t
--- gnu/usr.bin/perl/lib/File/Copy.t    5 Feb 2017 00:32:15 -0000       1.2
+++ gnu/usr.bin/perl/lib/File/Copy.t    5 Nov 2017 22:14:38 -0000
@@ -24,6 +24,11 @@ BEGIN { *CORE::GLOBAL::rename = sub { CO
 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

-- 
andrew - http://afresh1.com

Whatever happened to the days when hacking started at the cerebral cortex 
and not the keyboard?
                      -- Sid from UserFriendly.org

Reply via email to