This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=1973a0789cea5ac0e7da10a81cc5cca8384200df

commit 1973a0789cea5ac0e7da10a81cc5cca8384200df
Author: Guillem Jover <[email protected]>
AuthorDate: Wed May 1 23:19:17 2019 +0200

    perl: Use File::Copy instead of spawning mv/cp commands
    
    We use cp() in Dpkg::Source::Package to preserve the file attributes,
    but just move() in dpkg-buildpackage where it does not matter.
---
 debian/changelog               | 1 +
 scripts/Dpkg/Source/Package.pm | 5 +++--
 scripts/dpkg-buildpackage.pl   | 4 ++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index bcec8748f..0418c6fe6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,6 +20,7 @@ dpkg (1.20.0) UNRELEASED; urgency=medium
     - man: Fix uncommon wording constructs.
   * Code internals:
     - Dpkg::Source::Package: Refactor original tarball handling.
+    - perl: Use File::Copy instead of spawning mv/cp commands.
   * Build system:
     - Bump minimal Perl version to 5.24.1.
 
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index df3ac8737..e800a6392 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -44,6 +44,7 @@ our @EXPORT_OK = qw(
 use Exporter qw(import);
 use POSIX qw(:errno_h :sys_wait_h);
 use Carp;
+use File::Copy qw(cp);
 use File::Basename;
 
 use Dpkg::Gettext;
@@ -519,8 +520,8 @@ sub extract {
             my $src = File::Spec->catfile($self->{basedir}, $orig);
             my $dst = File::Spec->catfile($destdir, $orig);
             if (not check_files_are_the_same($src, $dst, 1)) {
-                system('cp', '--', $src, $dst);
-                subprocerr("cp $src to $dst") if $?;
+                cp($src, $dst)
+                    or syserror(g_('cannot copy %s to %s'), $src, $dst);
             }
         }
     }
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index e48f972a9..2c49738b5 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -851,8 +851,8 @@ sub signfile {
            '--output', "$signfile.asc", $signfile);
     my $status = $?;
     if ($status == 0) {
-       system('mv', '--', "$signfile.asc", "../$file")
-           and subprocerr('mv');
+        move("$signfile.asc", "../$file")
+            or syserror(g_('cannot move %s to %s'), "$signfile.asc", 
"../$file");
     }
 
     print "\n";

-- 
Dpkg.Org's dpkg

Reply via email to