소스 검색

dpkg: Fail on trigger processing when it is required to progress

Trigger processing is sometimes required and sometimes opportunistic.
When trying to make progress on the packages queue, we need to consider
it an error if the dependencies cannot be satisfied in this run. But if
we are running the deferred trigger processing, then we should not fail,
as that's just opportunistic.

Closes: #768852
Guillem Jover 11 년 전
부모
커밋
9a9ba74915
5개의 변경된 파일30개의 추가작업 그리고 6개의 파일을 삭제
  1. 3 0
      debian/changelog
  2. 8 1
      src/main.h
  3. 1 1
      src/packages.c
  4. 17 3
      src/trigproc.c
  5. 1 1
      src/unpack.c

+ 3 - 0
debian/changelog

@@ -23,6 +23,9 @@ dpkg (1.17.22) UNRELEASED; urgency=low
     unpack. Regression introduced in dpkg 1.17.14. Closes: #769211
   * Restore multiple processing instances check for packages and archives
     specified on the command-line. Regression introduced in dpkg 1.17.20.
+  * Fail on trigger processing when it is required to progress. Trigger
+    processing is sometimes required and sometimes opportunistic, and we
+    should only fail on the former but ignore the latter. Closes: #768852
 
   [ Updated programs translations ]
   * German (Sven Joachim).

+ 8 - 1
src/main.h

@@ -272,11 +272,18 @@ void log_action(const char *action, struct pkginfo *pkg, struct pkgbin *pkgbin);
 
 /* from trigproc.c */
 
+enum trigproc_type {
+	/** Opportunistic trigger processing. */
+	TRIGPROC_TRY,
+	/** Required trigger processing. */
+	TRIGPROC_REQUIRED,
+};
+
 void trigproc_install_hooks(void);
 void trigproc_run_deferred(void);
 void trigproc_reset_cycle(void);
 
-void trigproc(struct pkginfo *pkg);
+void trigproc(struct pkginfo *pkg, enum trigproc_type type);
 
 void trig_activate_packageprocessing(struct pkginfo *pkg);
 

+ 1 - 1
src/packages.c

@@ -278,7 +278,7 @@ void process_queue(void) {
     case act_configure:
       /* Do whatever is most needed. */
       if (pkg->trigpend_head)
-        trigproc(pkg);
+        trigproc(pkg, TRIGPROC_REQUIRED);
       else
         deferred_configure(pkg);
       break;

+ 17 - 3
src/trigproc.c

@@ -124,7 +124,7 @@ trigproc_run_deferred(void)
 		                        pkg_name(pkg, pnaw_nonambig));
 
 		pkg->clientdata->trigprocdeferred = NULL;
-		trigproc(pkg);
+		trigproc(pkg, TRIGPROC_TRY);
 
 		pop_error_context(ehflag_normaltidy);
 	}
@@ -312,7 +312,7 @@ check_trigger_cycle(struct pkginfo *processing_now)
  * that case does nothing but fix up any stale awaiters.
  */
 void
-trigproc(struct pkginfo *pkg)
+trigproc(struct pkginfo *pkg, enum trigproc_type type)
 {
 	static struct varbuf namesarg;
 
@@ -347,8 +347,22 @@ trigproc(struct pkginfo *pkg)
 			enqueue_package(pkg);
 			return;
 		} else if (ok == DEP_CHECK_HALT) {
+			/* When doing opportunistic trigger processig, nothing
+			 * requires us to be able to make progress; skip the
+			 * package and silently ignore the error due to
+			 * unsatisfiable dependencies. */
+			if (type == TRIGPROC_TRY) {
+				varbuf_destroy(&depwhynot);
+				return;
+			}
+
+			sincenothing = 0;
+			varbuf_end_str(&depwhynot);
+			notice(_("dependency problems prevent processing "
+			         "triggers for %s:\n%s"),
+			       pkg_name(pkg, pnaw_nonambig), depwhynot.buf);
 			varbuf_destroy(&depwhynot);
-			return;
+			ohshit(_("dependency problems - leaving triggers unprocessed"));
 		} else if (depwhynot.used) {
 			varbuf_end_str(&depwhynot);
 			notice(_("%s: dependency problems, but processing "

+ 1 - 1
src/unpack.c

@@ -669,7 +669,7 @@ void process_archive(const char *filename) {
       if (!depisok(dsearch, &depprobwhy, NULL, &fixbytrigaw, true)) {
         if (fixbytrigaw) {
           while (fixbytrigaw->trigaw.head)
-            trigproc(fixbytrigaw->trigaw.head->pend);
+            trigproc(fixbytrigaw->trigaw.head->pend, TRIGPROC_REQUIRED);
         } else {
           varbuf_end_str(&depprobwhy);
           notice(_("regarding %s containing %s, pre-dependency problem:\n%s"),