bitbake: toaster: prevent infinite loop when finding task dependencies

Toaster occasionally records a task which depends on itself.
This causes a problem when trying to display that task if it
is "covered" by itself, as the code does the following: for
task A, find a task B which covers A; then, recursively
find the task which covers B etc. If B == A, this loop becomes
infinite and never terminates.

To prevent this, add the condition that, when finding a task B
which covers A, don't allow B == A.

[YOCTO #9952]

(Bitbake rev: 88c471c7e5995abb5bca62990b91650277b6c926)

Signed-off-by: Elliot Smith <elliot.smith@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Elliot Smith 2016-07-29 12:25:46 +01:00 committed by Richard Purdie
parent 2ff892d87c
commit 98ef970c8e
1 changed files with 10 additions and 0 deletions

View File

@ -822,11 +822,21 @@ def _find_task_dep(task_object):
def _find_task_revdep(task_object):
tdeps = Task_Dependency.objects.filter(depends_on=task_object).filter(task__order__gt=0)
tdeps = tdeps.exclude(task__outcome = Task.OUTCOME_NA).select_related("task", "task__recipe", "task__build")
# exclude self-dependencies to prevent infinite dependency loop
# in generateCoveredList2()
tdeps = tdeps.exclude(task=task_object)
return [tdep.task for tdep in tdeps]
def _find_task_revdep_list(tasklist):
tdeps = Task_Dependency.objects.filter(depends_on__in=tasklist).filter(task__order__gt=0)
tdeps = tdeps.exclude(task__outcome=Task.OUTCOME_NA).select_related("task", "task__recipe", "task__build")
# exclude self-dependencies to prevent infinite dependency loop
# in generateCoveredList2()
tdeps = tdeps.exclude(task=F('depends_on'))
return [tdep.task for tdep in tdeps]
def _find_task_provider(task_object):