Explorar o código

Dpkg::Source::Patch: don't choke on empty patches

Commit 255e73e11d1365fbb1e8d78287fad751a8ebc6e5 introduced a regression
with empty patches by assuming that a patch analysis would always give
back at least one filename.

Reported-by: Niels Thykier <niels@thykier.net>
Raphaël Hertzog %!s(int64=15) %!d(string=hai) anos
pai
achega
7ea2064c46
Modificáronse 2 ficheiros con 3 adicións e 1 borrados
  1. 2 0
      debian/changelog
  2. 1 1
      scripts/Dpkg/Source/Patch.pm

+ 2 - 0
debian/changelog

@@ -100,6 +100,8 @@ dpkg (1.16.0) UNRELEASED; urgency=low
     in Uploaders. Closes: #598922
   * Ignore whitespaces after options in headers of changelog entries.
     Closes: #605719
+  * Fix dpkg-source's regression with empty patches (introduced while fixing
+    #613023). Closes: #619541
 
   [ Jonathan Nieder ]
   * Remove support for use of synchronous sync(2), due to its pernicious

+ 1 - 1
scripts/Dpkg/Source/Patch.pm

@@ -543,7 +543,7 @@ sub apply {
     # and remove .dpkg-orig files
     my @files = keys %{$analysis->{'filepatched'}};
     my $now = $opts{"timestamp"};
-    $now ||= fs_time($files[0]) if $opts{"force_timestamp"};
+    $now ||= fs_time($files[0]) if $opts{"force_timestamp"} and scalar @files;
     foreach my $fn (@files) {
 	if ($opts{"force_timestamp"}) {
 	    utime($now, $now, $fn) || $! == ENOENT ||