瀏覽代碼

libdpkg: Only ignore older packages if the existing version is informative

When ignoring older packages (either by explicit request, or when
parsing available files), we should not ignore them when the existing
version is empty, because then we would consider that the empty version
(equivalent to "0-0") is newer than "0~0-0" for example.

This affects any program using libdpkg to parse the available file.

Regression introduced in commit 86823d5792af8328107c3d86e486d2cf373da128.

Closes: #676664
Guillem Jover 13 年之前
父節點
當前提交
71d6e1b6c1
共有 2 個文件被更改,包括 4 次插入 和 0 次删除
  1. 3 0
      debian/changelog
  2. 1 0
      lib/dpkg/parse.c

+ 3 - 0
debian/changelog

@@ -79,6 +79,9 @@ dpkg (1.17.0) UNRELEASED; urgency=low
   * Remove update-alternatives, dpkg-divert and dpkg-statoverride
   * Remove update-alternatives, dpkg-divert and dpkg-statoverride
     compatibility symlinks under /usr/sbin/.
     compatibility symlinks under /usr/sbin/.
   * Remove install-info wrapper.
   * Remove install-info wrapper.
+  * Only ignore older packages if the existing version is informative. This
+    allows any program using libdpkg to parse the available file to see again
+    packages with versions lesser than 0-0 (like 0~0-0). Closes: #676664
 
 
   [ Updated manpages translations ]
   [ Updated manpages translations ]
   * Fix incorrect translation of "fortify" in French manpage for dpkg-buildflags
   * Fix incorrect translation of "fortify" in French manpage for dpkg-buildflags

+ 1 - 0
lib/dpkg/parse.c

@@ -742,6 +742,7 @@ int parsedb(const char *filename, enum parsedbflags flags,
       db_pkgbin = &db_pkg->installed;
       db_pkgbin = &db_pkg->installed;
 
 
     if (((flags & pdb_ignoreolder) || ps.type == pdb_file_available) &&
     if (((flags & pdb_ignoreolder) || ps.type == pdb_file_available) &&
+        dpkg_version_is_informative(&db_pkgbin->version) &&
         dpkg_version_compare(&new_pkgbin->version, &db_pkgbin->version) < 0)
         dpkg_version_compare(&new_pkgbin->version, &db_pkgbin->version) < 0)
       continue;
       continue;