ソースを参照

dpkg: Fix logic on reinstallation of previously configured shared conffiles

When checking for the validity of the Conffiles database field, do not
just assume that a package that is just in stat_unpacked has never
before been configured. Instead check if the last configured version
is the same as the currently extracted version, which will mean the
values in the Conffiles field are valid.

Closes: #684776
Guillem Jover 14 年 前
コミット
05a8ddb482
共有2 個のファイルを変更した10 個の追加1 個の削除を含む
  1. 2 0
      debian/changelog
  2. 8 1
      src/archives.c

+ 2 - 0
debian/changelog

@@ -40,6 +40,8 @@ dpkg (1.16.9) UNRELEASED; urgency=low
     only the first package instance being configured will have a *.dpkg-new
     conffile available to be processed, the subsequent ones need to use the
     hash from the previously processed entries.
+  * Fix logic for previously configured conffiles, so that the shared
+    conffile checks actually work on reinstallation. Closes: #684776
 
   [ Updated programs translations ]
   * Czech (Miroslav Kure).

+ 8 - 1
src/archives.c

@@ -194,7 +194,14 @@ md5hash_prev_conffile(struct pkginfo *pkg, char *oldhash, const char *oldname,
       continue;
     /* The hash in the Conffiles is only meaningful if the package
      * configuration has been at least tried. */
-    if (otherpkg->status <= stat_unpacked)
+    if (otherpkg->status < stat_unpacked)
+      continue;
+    /* If we are reinstalling, even if the other package is only unpacked,
+     * we can always make use of the Conffiles hash value from an initial
+     * installation, if that happened at all. */
+    if (otherpkg->status == stat_unpacked &&
+        dpkg_version_compare(&otherpkg->installed.version,
+                             &otherpkg->configversion) != 0)
       continue;
     for (conff = otherpkg->installed.conffiles; conff; conff = conff->next) {
       if (conff->obsolete)