Quellcode durchsuchen

dpkg: Perform trigger cycle detection earlier or later depending on dependtry

Do trigger cycle detection after dependency checks in dependtry <= 1,
and before dependency cycle breaking in dependtry > 1. This makes sure
to always catch trigger cycles, but still gives the opportunity to try
to process triggers for packages that are not yet ready in the first
dependtry, but which might be a bit later on, without wrongly detecting
avoidable and bogus trigger cycles.

Closes: #766557
Guillem Jover vor 11 Jahren
Ursprung
Commit
317083c110
2 geänderte Dateien mit 17 neuen und 4 gelöschten Zeilen
  1. 6 0
      debian/changelog
  2. 11 4
      src/trigproc.c

+ 6 - 0
debian/changelog

@@ -14,6 +14,12 @@ dpkg (1.17.21) UNRELEASED; urgency=low
     And a new --await option to dpkg-trigger. This might allow possibly
     switching the default meaning after a transition period no shorter than
     two minor versions, so in 1.19.x or 1.20.x. Perhaps.
+  * Do trigger cycle detection after dependency checks in dependtry <= 1,
+    and before dependency cycle breaking in dependtry > 1. This makes sure
+    to always catch trigger cycles, but still gives the opportunity to try
+    to process triggers for packages that are not yet ready in the first
+    dependtry, but which might be a bit later on, without wrongly detecting
+    avoidable and bogus trigger cycles. Closes: #766557
 
   [ Updated programs translations ]
   * Catalan (Guillem Jover).

+ 11 - 4
src/trigproc.c

@@ -332,9 +332,14 @@ trigproc(struct pkginfo *pkg)
 		assert(pkg->status == PKG_STAT_TRIGGERSPENDING ||
 		       pkg->status == PKG_STAT_TRIGGERSAWAITED);
 
-		if (dependtry > 1)
+		if (dependtry > 1) {
+			gaveup = check_trigger_cycle(pkg);
+			if (gaveup == pkg)
+				return;
+
 			if (findbreakcycle(pkg))
 				sincenothing = 0;
+		}
 
 		ok = dependencies_ok(pkg, NULL, &depwhynot);
 		if (ok == DEP_CHECK_DEFER) {
@@ -352,9 +357,11 @@ trigproc(struct pkginfo *pkg)
 			varbuf_destroy(&depwhynot);
 		}
 
-		gaveup = check_trigger_cycle(pkg);
-		if (gaveup == pkg)
-			return;
+		if (dependtry <= 1) {
+			gaveup = check_trigger_cycle(pkg);
+			if (gaveup == pkg)
+				return;
+		}
 
 		printf(_("Processing triggers for %s (%s) ...\n"),
 		       pkg_name(pkg, pnaw_nonambig),