[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser-build/master] Bug 40182: Use File::Copy::Recursive instead of File::Copy



commit b097472580099e3bc9f5e81913d1dea1844d0261
Author: Nicolas Vigier <boklm@xxxxxxxxxxxxxx>
Date:   Thu Dec 10 21:49:40 2020 +0100

    Bug 40182: Use File::Copy::Recursive instead of File::Copy
    
    File::Copy is not supposed to be able to move directories, only single
    files. It only works by chance if the source and destination are on
    the same filesystem and a rename is working.
---
 tools/signing/nightly/sign-nightly | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/signing/nightly/sign-nightly b/tools/signing/nightly/sign-nightly
index 8c4c330..c7efd8e 100755
--- a/tools/signing/nightly/sign-nightly
+++ b/tools/signing/nightly/sign-nightly
@@ -6,6 +6,7 @@ use POSIX qw(setlocale LC_ALL);
 use File::Path qw(make_path);
 use File::Temp;
 use File::Copy;
+use File::Copy::Recursive qw(dirmove);
 use File::Basename;
 use LWP::Simple;
 use Path::Tiny;
@@ -153,7 +154,8 @@ sub fetch_version {
         download_file("$urldir/$file", "$tmpdir/$file", $sums{$file});
     }
     make_path("$topdir/nightly/$publish_dir");
-    move $tmpdir, $destdir;
+    dirmove($tmpdir, $destdir)
+        or exit_error "Error moving $tmpdir to $destdir: $!";
     chmod 0755, $destdir;
 }
 
@@ -222,7 +224,8 @@ sub update_responses {
        system("$topdir/tools/update-responses/update_responses") == 0;
     path("$topdir/nightly/updates/$publish_dir/nightly")->remove_tree({ safe => 0 });
     make_path("$topdir/nightly/updates/$publish_dir");
-    move($htdocsdir, "$topdir/nightly/updates/$publish_dir/nightly");
+    dirmove($htdocsdir, "$topdir/nightly/updates/$publish_dir/nightly")
+        or exit_error "Error moving $htdocsdir to $topdir/nightly/updates/$publish_dir/nightly: $!";
 }
 
 sub remove_oldversions {

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits