[devscripts] 02/02: uscan: fix crash when --rename is passed

Antonio Terceiro terceiro at moszumanska.debian.org
Tue Jan 5 15:25:41 UTC 2016


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

terceiro pushed a commit to branch master
in repository devscripts.

commit ed9350e7123a562e85636d5ff07c7ccde6d286f5
Author: Antonio Terceiro <terceiro at debian.org>
Date:   Tue Jan 5 13:22:54 2016 -0200

    uscan: fix crash when --rename is passed
---
 debian/changelog |  1 +
 scripts/uscan.pl | 30 ++++++++++++++++--------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 0451e4c..7d158bf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ devscripts (2.15.11) UNRELEASED; urgency=medium
   * uscan:
     - fix regression in uscan when --destdir is set (Closes: #809662)
       Patch by Alex Mestiashvili <mailatgoogl at gmail.com>
+    - fix crash when --rename is passed
 
  -- Antonio Terceiro <terceiro at debian.org>  Tue, 05 Jan 2016 13:01:05 -0200
 
diff --git a/scripts/uscan.pl b/scripts/uscan.pl
index 3e704b0..47d317f 100755
--- a/scripts/uscan.pl
+++ b/scripts/uscan.pl
@@ -3700,23 +3700,25 @@ EOF
     } else {
 	open(USCANLOG, ">> $uscanlog") or uscan_die "$progname: could not open $uscanlog for append: $!\n";
     }
-    my $umd5sum = Digest::MD5->new;
-    my $omd5sum = Digest::MD5->new;
-    open (my $ufh, '<', "${destdir}/${newfile_base}") or die "Can't open '${destdir}/${newfile_base}': $!";
-    open (my $ofh, '<', "${destdir}/${target}") or die "Can't open '${destdir}/${target}': $!";
-    $umd5sum->addfile($ufh);
-    $omd5sum->addfile($ofh);
-    close($ufh);
-    close($ofh);
-    my $umd5hex = $umd5sum->hexdigest;
-    my $omd5hex = $omd5sum->hexdigest;
-    if ($umd5hex eq $omd5hex) {
+    if ($symlink ne "rename") {
+      my $umd5sum = Digest::MD5->new;
+      my $omd5sum = Digest::MD5->new;
+      open (my $ufh, '<', "${destdir}/${newfile_base}") or die "Can't open '${destdir}/${newfile_base}': $!";
+      open (my $ofh, '<', "${destdir}/${target}") or die "Can't open '${destdir}/${target}': $!";
+      $umd5sum->addfile($ufh);
+      $omd5sum->addfile($ofh);
+      close($ufh);
+      close($ofh);
+      my $umd5hex = $umd5sum->hexdigest;
+      my $omd5hex = $omd5sum->hexdigest;
+      if ($umd5hex eq $omd5hex) {
 	print USCANLOG "# == ${newfile_base}\t-->\t${target}\t(same)\n";
-    } else {
+      } else {
 	print USCANLOG "# !! ${newfile_base}\t-->\t${target}\t(changed)\n";
+      }
+      print USCANLOG "$umd5hex  ${newfile_base}\n";
+      print USCANLOG "$omd5hex  ${target}\n";
     }
-    print USCANLOG "$umd5hex  ${newfile_base}\n";
-    print USCANLOG "$omd5hex  ${target}\n";
     close USCANLOG or uscan_die "$progname: could not close $uscanlog: $!\n";
 
     dehs_msg "$mk_origtargz_out\n" if defined $mk_origtargz_out;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list