Преглед на файлове

libdpkg: Do not warn on missing Architecture in config-files state

dpkg before commit 2ef42b027e4267432a41343e28f102b1dae668d2 (versions
older than 1.10.19) did not keep the Architecture field in the status
file, and as such removed (but not purged) packages might still be
around in live systems lacking the Architecture field. Let's shut up
the warning for now.

Closes: #604241

Analysis-by: Raphael Hertzog <hertzog@debian.org>
Signed-off-by: Guillem Jover <guillem@debian.org>
Guillem Jover преди 15 години
родител
ревизия
2ed0a42cb3
променени са 2 файла, в които са добавени 10 реда и са изтрити 0 реда
  1. 2 0
      debian/changelog
  2. 8 0
      lib/dpkg/parse.c

+ 2 - 0
debian/changelog

@@ -71,6 +71,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
   * Add ‘.hgsigs’ to the default dpkg-source ignore lists.
     Based on a patch by Jakub Wilk <jwilk@debian.org>. Closes: #627462
   * Do not allow blank lines in field values. Closes: #308082
+  * Do not warn on missing architecture on packages in config-files state,
+    but then make sure the architecture field is usable. Closes: #604241
 
   [ Updated dpkg translations ]
   * German (Sven Joachim). Closes: #620312

+ 8 - 0
lib/dpkg/parse.c

@@ -177,11 +177,19 @@ pkg_parse_verify(struct parsedb_state *ps,
     parse_ensure_have_field(ps, pkg, &pkgbin->description, "description");
     parse_ensure_have_field(ps, pkg, &pkgbin->maintainer, "maintainer");
     parse_must_have_field(ps, pkg, pkgbin->version.version, "version");
+  }
 
+  /* XXX: Versions before dpkg 1.10.19 did not preserve the Architecture
+   * field in the status file. So there's still live systems with packages
+   * in stat_configfiles, ignore those too for now. */
+  if ((ps->flags & pdb_recordavailable) ||
+      pkg->status > stat_halfinstalled) {
     /* We always want usable architecture information (as long as the package
      * is in such a state that it make sense), so that it can be used safely
      * on string comparisons and the like. */
     parse_ensure_have_field(ps, pkg, &pkgbin->arch, "architecture");
+  } else if (pkgbin->arch == NULL) {
+    pkgbin->arch = "";
   }
 
   /* Check the Config-Version information: