瀏覽代碼

dpkg: improve pre-dependency check on unpack

When a pre-dependency is not satisfied due to a package in
triggers-awaited state, immediately run the trigger processing
and continue without errors.

This make it possible to blindly use --no-triggers and not break
when you're not fully configuring a pre-dependency.

See test case t-predepends-no-triggers.
Raphaël Hertzog 15 年之前
父節點
當前提交
a946894f7a
共有 2 個文件被更改,包括 15 次插入7 次删除
  1. 2 0
      debian/changelog
  2. 13 7
      src/processarc.c

+ 2 - 0
debian/changelog

@@ -14,6 +14,8 @@ dpkg (1.16.1) UNRELEASED; urgency=low
     extend the current diff-ignore if it has already been set.
   * Fix dependency checking code to consider a dependency on a virtual
     package provided by a package in triggers-pending status as satisfied.
+  * Do not fail when encountering a pre-dependency in triggers-awaited state,
+    instead process the awaited triggers. Closes: #526774
 
   [ Guillem Jover ]
   * Install deb-src-control(5) man pages in dpkg-dev. Closes: #620520

+ 13 - 7
src/processarc.c

@@ -363,6 +363,7 @@ void process_archive(const char *filename) {
   struct filenamenode *namenode;
   struct stat stab, oldfs;
   struct pkg_deconf_list *deconpil, *deconpiltemp;
+  struct pkginfo *fixbytrigaw;
 
   cleanup_pkg_failed= cleanup_conflictor_failed= 0;
 
@@ -503,13 +504,18 @@ void process_archive(const char *filename) {
       /* Ignore these here. */
       break;
     case dep_predepends:
-      if (!depisok(dsearch, &depprobwhy, NULL, NULL, true)) {
-        varbuf_end_str(&depprobwhy);
-        fprintf(stderr, _("dpkg: regarding %s containing %s, pre-dependency problem:\n%s"),
-                pfilename, pkg->name, depprobwhy.buf);
-        if (!force_depends(dsearch->list))
-          ohshit(_("pre-dependency problem - not installing %.250s"),pkg->name);
-        warning(_("ignoring pre-dependency problem!"));
+      if (!depisok(dsearch, &depprobwhy, NULL, &fixbytrigaw, true)) {
+        if (fixbytrigaw) {
+          while (fixbytrigaw->trigaw.head)
+            trigproc(fixbytrigaw->trigaw.head->pend);
+        } else {
+          varbuf_end_str(&depprobwhy);
+          fprintf(stderr, _("dpkg: regarding %s containing %s, pre-dependency problem:\n%s"),
+                  pfilename, pkg->name, depprobwhy.buf);
+          if (!force_depends(dsearch->list))
+            ohshit(_("pre-dependency problem - not installing %.250s"),pkg->name);
+          warning(_("ignoring pre-dependency problem!"));
+        }
       }
     }
   }