소스 검색

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
 dpkg (1.15.8.4) unstable; urgency=low
 
 
   [ Guillem Jover ]
   [ Guillem Jover ]

+ 9 - 4
lib/dpkg/parse.c

@@ -249,14 +249,19 @@ int parsedb(const char *filename, enum parsedbflags flags,
       parse_error(&ps, &newpig,
       parse_error(&ps, &newpig,
                   _("several package info entries found, only one allowed"));
                   _("several package info entries found, only one allowed"));
     parse_must_have_field(&ps, &newpig, newpig.name, "package name");
     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,
       parse_ensure_have_field(&ps, &newpig,
                               &newpifp->description, "description");
                               &newpifp->description, "description");
       parse_ensure_have_field(&ps, &newpig,
       parse_ensure_have_field(&ps, &newpig,
                               &newpifp->maintainer, "maintainer");
                               &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)
     if (flags & pdb_recordavailable)
       parse_ensure_have_field(&ps, &newpig,
       parse_ensure_have_field(&ps, &newpig,