Просмотр исходного кода

Dpkg::Vendor::Ubuntu::find_launchpad_closes(): don't return duplicate bug numbers

Ensure we don't return the same bug multiple times even if
it's closed multiple times.
Brian Murray лет назад: 16
Родитель
Сommit
5332e0f654
2 измененных файлов с 6 добавлено и 3 удалено
  1. 3 0
      debian/changelog
  2. 3 3
      scripts/Dpkg/Vendor/Ubuntu.pm

+ 3 - 0
debian/changelog

@@ -26,6 +26,9 @@ dpkg (1.15.6) UNRELEASED; urgency=low
   * Fix update-alternatives to not try to reinstall an unknown alternative
     when the link group is broken, instead switch to the best choice in
     automatic mode. Closes: #566406
+  * Don't return duplicate bug numbers in Launchpad-Bugs-Fixed:.
+    Thanks to Brian Murray <brian@ubuntu.com> for the report
+    and the patch. Closes: #569618
 
   [ Guillem Jover ]
   * Handle argument parsing in dpkg-checkbuilddeps and dpkg-scanpackages

+ 3 - 3
scripts/Dpkg/Vendor/Ubuntu.pm

@@ -105,14 +105,14 @@ numbers in an array reference.
 
 sub find_launchpad_closes {
     my ($changes) = @_;
-    my @closes = ();
+    my %closes;
 
     while ($changes &&
           ($changes =~ /lp:\s+\#\d+(?:,\s*\#\d+)*/ig)) {
-       push(@closes, $& =~ /\#?\s?(\d+)/g);
+        $closes{$_} = 1 foreach($& =~ /\#?\s?(\d+)/g);
     }
 
-    @closes = sort { $a <=> $b } @closes;
+    my @closes = sort { $a <=> $b } keys %closes;
 
     return \@closes;
 }