texlive[47711] Master/tlpkg/TeXLive/TLPDB.pm: use copy&remove instead

commits+preining at tug.org commits+preining at tug.org
Mon May 14 15:01:35 CEST 2018


Revision: 47711
          http://tug.org/svn/texlive?view=revision&revision=47711
Author:   preining
Date:     2018-05-14 15:01:34 +0200 (Mon, 14 May 2018)
Log Message:
-----------
use copy&remove instead of rename

this should help Windows Users cope with AV programs

Modified Paths:
--------------
    trunk/Master/tlpkg/TeXLive/TLPDB.pm

Modified: trunk/Master/tlpkg/TeXLive/TLPDB.pm
===================================================================
--- trunk/Master/tlpkg/TeXLive/TLPDB.pm	2018-05-14 10:48:06 UTC (rev 47710)
+++ trunk/Master/tlpkg/TeXLive/TLPDB.pm	2018-05-14 13:01:34 UTC (rev 47711)
@@ -101,6 +101,7 @@
 use TeXLive::TLWinGoo;
 
 use Cwd 'abs_path';
+use File::Copy qw//;
 
 my $_listdir;
 
@@ -628,9 +629,11 @@
   open(FOO, ">$tmppath") || die "$0: open(>$tmppath) failed: $!";
   $self->writeout(\*FOO);
   close(FOO);
+  # on Windows the renaming sometimes fails, try to copy and unlink the
+  # .tmp file. This we do for all archs, cannot hurt.
   # if we managed that one, we move it over
-  die ("rename $tmppath to $path failed: $!")
-    unless rename($tmppath, $path);
+  File::Copy::copy ($tmppath, $path) or die ("copy $tmppath to $path failed: $!");
+  unlink ($tmppath) or tlwarn ("TLPDB: cannot unlink $tmppath: $!\n");
 }
 
 =pod



More information about the tex-live-commits mailing list