Переглянути джерело

libdpkg: Config-Version should also be initialized on triggers-pending

A package in triggers-pending state should be considered an installed
package, by not doing so we might end up not passing the correct version
to the configure maintainer script and making it look like we are doing
a configuration for a first install, instead of an upgrade.

Closes: #801156
Reported-by: Andreas Beckmann <anbe@debian.org>
Stable-Candidate: 1.16.x 1.17.x
Guillem Jover 10 роки тому
батько
коміт
10d77ba878
2 змінених файлів з 16 додано та 7 видалено
  1. 4 0
      debian/changelog
  2. 12 7
      lib/dpkg/parse.c

+ 4 - 0
debian/changelog

@@ -4,6 +4,10 @@ dpkg (1.18.4) UNRELEASED; urgency=low
   * Switch dpkg-scansources and dpkg-scanpackages to use File::Find instead
     of find(1), as the former is more portable with more consistent behavior,
     and always canonicalizes the pathnames. Closes: #800649
+  * Initialize Config-Version also for packages previously in triggers-pending
+    state, otherwise we end up not passing the previously configured version
+    to «postinst configure», which might consider this a first install instead
+    of an upgrade. Closes: #801156
   * Build system:
     - Set PERL5LIB globally for the test suite to the local modules directory,
       to avoid using the system modules. Regression introduced in dpkg 1.17.8.

+ 12 - 7
lib/dpkg/parse.c

@@ -225,19 +225,24 @@ pkg_parse_verify(struct parsedb_state *ps,
       if (!dop->arch)
         dop->arch = pkgbin->arch;
 
-  /* Check the Config-Version information:
-   * If there is a Config-Version it is definitely to be used, but
-   * there shouldn't be one if the package is ‘installed’ (in which case
-   * the Version and/or Revision will be copied) or if the package is
-   * ‘not-installed’ (in which case there is no Config-Version). */
+  /*
+   * Check the Config-Version information:
+   *
+   * If there is a Config-Version it is definitely to be used, but there
+   * should not be one if the package is ‘installed’ or ‘triggers-pending’
+   * (in which case the Version will be copied) or if the package is
+   * ‘not-installed’ (in which case there is no Config-Version).
+   */
   if (!(ps->flags & pdb_recordavailable)) {
     if (pkg->configversion.version) {
       if (pkg->status == PKG_STAT_INSTALLED ||
-          pkg->status == PKG_STAT_NOTINSTALLED)
+          pkg->status == PKG_STAT_NOTINSTALLED ||
+          pkg->status == PKG_STAT_TRIGGERSPENDING)
         parse_error(ps,
                     _("Config-Version for package with inappropriate Status"));
     } else {
-      if (pkg->status == PKG_STAT_INSTALLED)
+      if (pkg->status == PKG_STAT_INSTALLED ||
+          pkg->status == PKG_STAT_TRIGGERSPENDING)
         pkg->configversion = pkgbin->version;
     }
   }