ソースを参照

libdpkg: Do not print bogus warnings when parsing status files

When reaching the half-installed state during the unpacking of a
package which was previously in not-installed state, the current code
was producing bogus warnings when parsing the status or status log
files on missing Description and Maintainer fields, given that those
are not yet in place.

This bug was uncovered when enabling parser warnings for everything in
commit 30bd7ddbffe3ad4b5d5dc78c5dd1b0f5b07ccfd6.
Guillem Jover 16 年 前
コミット
672b0664cb
共有2 個のファイルを変更した17 個の追加4 個の削除を含む
  1. 8 0
      debian/changelog
  2. 9 4
      lib/dpkg/parse.c

+ 8 - 0
debian/changelog

@@ -1,3 +1,11 @@
+dpkg (1.15.8.5) UNRELEASED; urgency=low
+
+  * Do not print a warning when parsing status or status log files on
+    half-installed packages w/o a Description or Maintainer field, as
+    this happens normally when the package was never installed before.
+
+ -- Guillem Jover <guillem@debian.org>  Sat, 21 Aug 2010 08:09:39 +0200
+
 dpkg (1.15.8.4) unstable; urgency=low
 
   [ Guillem Jover ]

+ 9 - 4
lib/dpkg/parse.c

@@ -249,14 +249,19 @@ int parsedb(const char *filename, enum parsedbflags flags,
       parse_error(&ps, &newpig,
                   _("several package info entries found, only one allowed"));
     parse_must_have_field(&ps, &newpig, newpig.name, "package name");
-    if ((flags & pdb_recordavailable) || newpig.status != stat_notinstalled) {
+    /* XXX: We need to check for status != stat_halfinstalled as while
+     * unpacking a deselected package, it will not have yet all data in
+     * place. But we cannot check for > stat_halfinstalled as stat_configfiles
+     * always should have those fields. */
+    if ((flags & pdb_recordavailable) ||
+        (newpig.status != stat_notinstalled &&
+         newpig.status != stat_halfinstalled)) {
       parse_ensure_have_field(&ps, &newpig,
                               &newpifp->description, "description");
       parse_ensure_have_field(&ps, &newpig,
                               &newpifp->maintainer, "maintainer");
-      if (newpig.status != stat_halfinstalled)
-        parse_must_have_field(&ps, &newpig,
-                              newpifp->version.version, "version");
+      parse_must_have_field(&ps, &newpig,
+                            newpifp->version.version, "version");
     }
     if (flags & pdb_recordavailable)
       parse_ensure_have_field(&ps, &newpig,