Prechádzať zdrojové kódy

dpkg-mergechangelogs: do not error out on invalid versions

The usage of version_compare() has the side effect of erroring out as
soon as you encounter an invalid version. Replacing this call
with a comparison operator invoked on Dpkg::Version objects fixes
the issue.

Closes: #651993
Reported-by: Martin Packman <martin.packman@canonical.com>
Raphaël Hertzog 14 rokov pred
rodič
commit
834f83e490
2 zmenil súbory, kde vykonal 5 pridanie a 1 odobranie
  1. 2 0
      debian/changelog
  2. 3 1
      scripts/dpkg-mergechangelogs.pl

+ 2 - 0
debian/changelog

@@ -62,6 +62,8 @@ dpkg (1.16.2) UNRELEASED; urgency=low
     it assumes all build dependencies must be satisfied on the listed
     architecture. Closes: #648180 Thanks to Colin Watson for the patch.
   * Error out if a dpkg database .list file is not a regular file. LP: #369898
+  * Fix dpkg-mergechangelogs to not error out on invalid versions.
+    Closes: #651993
 
   [ Jonathan Nieder ]
   * Bump po4a version in Build-Depends to 0.41, since earlier versions do

+ 3 - 1
scripts/dpkg-mergechangelogs.pl

@@ -179,7 +179,9 @@ sub compare_versions {
 	$a =~ s/~[^~]*$//;
 	$b =~ s/~[^~]*$//;
     }
-    return version_compare($a, $b);
+    $a = Dpkg::Version->new($a);
+    $b = Dpkg::Version->new($b);
+    return $a <=> $b;
 }
 
 # Merge changelog entries smartly by merging individually the different