Browse Source

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 11 years ago
parent
commit
317083c110
2 changed files with 17 additions and 4 deletions
  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
     And a new --await option to dpkg-trigger. This might allow possibly
     switching the default meaning after a transition period no shorter than
     switching the default meaning after a transition period no shorter than
     two minor versions, so in 1.19.x or 1.20.x. Perhaps.
     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 ]
   [ Updated programs translations ]
   * Catalan (Guillem Jover).
   * Catalan (Guillem Jover).

+ 11 - 4
src/trigproc.c

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